-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't panic when a precompile errors (#728)
* fix: don't panic when a precompile errors * Create polite-plums-ring.md
- Loading branch information
Showing
5 changed files
with
48 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@nomicfoundation/edr": patch | ||
--- | ||
|
||
fix: don't panic when a precompile errors |
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
23 changes: 23 additions & 0 deletions
23
...ternal/hardhat-network/stack-traces/test-files/0_8/special-cases/precompile-failure/c.sol
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,23 @@ | ||
pragma solidity ^0.8.1; | ||
|
||
contract C { | ||
address internal constant POINT_EVALUATION_PRECOMPILE_ADDRESS = address(0x0a); | ||
|
||
function test() public { | ||
bytes memory forcingFailureBytes = "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; | ||
|
||
_verifyPointEvaluation(0x0, 0x0, 0x0, forcingFailureBytes, forcingFailureBytes); | ||
} | ||
|
||
function _verifyPointEvaluation( | ||
bytes32 _currentDataHash, | ||
uint256 _dataEvaluationPoint, | ||
uint256 _dataEvaluationClaim, | ||
bytes memory _kzgCommitment, | ||
bytes memory _kzgProof | ||
) internal view { | ||
POINT_EVALUATION_PRECOMPILE_ADDRESS.staticcall( | ||
abi.encodePacked(_currentDataHash, _dataEvaluationPoint, _dataEvaluationClaim, _kzgCommitment, _kzgProof) | ||
); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...al/hardhat-network/stack-traces/test-files/0_8/special-cases/precompile-failure/test.json
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,13 @@ | ||
{ | ||
"description": "This test checks that EDR doesn't crash when a precompile call results in an error. See https://github.com/NomicFoundation/edr/issues/727", | ||
"transactions": [ | ||
{ | ||
"file": "c.sol", | ||
"contract": "C" | ||
}, | ||
{ | ||
"to": 0, | ||
"function": "test" | ||
} | ||
] | ||
} |