-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Require ECDSA DKG result challenger to be an EOA (#3756)
The `challengeDkgResult` function uses several `try-catch` blocks as part of its business logic. However, the EVM has a call stack depth limit equal to 1024. A third-party contract can leverage this limitation and force the `try-catch`-ed calls to revert unconditionally, by using recursion and letting those calls be executed at depth 1025. In such a case, the control flow is passed to the `catch` clauses which may lead to undesired side effects like invalidation of a proper DKG result. To address that problem, we are adding a requirement that `challengeDkgResult` can only be called by an EOA. This prevents third-party contracts from calling `challengeDkgResult`.
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
pragma solidity 0.8.17; | ||
|
||
import "../WalletRegistry.sol"; | ||
import "../libraries/EcdsaDkg.sol"; | ||
|
||
contract DkgChallenger { | ||
WalletRegistry internal walletRegistry; | ||
|
||
constructor(WalletRegistry _walletRegistry) { | ||
walletRegistry = _walletRegistry; | ||
} | ||
|
||
function challengeDkgResult(EcdsaDkg.Result calldata dkgResult) external { | ||
walletRegistry.challengeDkgResult(dkgResult); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters