-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ctb): Account for worst-case CALL
gas in SafeCall
#5470
Conversation
|
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
✅ Deploy Preview for opstack-docs canceled.
|
b5c2a44
to
2201cee
Compare
packages/contracts-bedrock/contracts/universal/CrossDomainMessenger.sol
Outdated
Show resolved
Hide resolved
Clean up the script that is used to migrate legacy withdrawals. This script is very important for testing the legacy withdrawal migration. A bug was introduced with #4911 which was a sherlock audit fix. This was a bug because the change resulted in the withdrawal hashes changing, meaning that the storage slots computed client side also changed. This resulted in breaking the script. This commit reverts this change. The changes landing in #5470 will cause the buffer in the gas limit for the migrated withdrawals to be too small, so we can reintroduce this code behind a switch with the network. Its not ideal that the migration code isn't going to match 1:1 with goerli but thats ok because we will be able to thoroughly test it.
Fixes CLI-3832 |
Hey @clabby! This PR has merge conflicts. Please fix them before continuing review. |
2201cee
to
ec0adb7
Compare
ec0adb7
to
0dfefff
Compare
0dfefff
to
bc124c4
Compare
Semgrep found 2
Unchecked type assertion. Created by unchecked-type-assertion. |
bc124c4
to
5b8ab37
Compare
packages/contracts-bedrock/contracts/L2/L2CrossDomainMessenger.sol
Outdated
Show resolved
Hide resolved
38bc389
to
cfb60fb
Compare
cfb60fb
to
f7e83ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments, otherwise looks great!
packages/contracts-bedrock/contracts/L2/L2CrossDomainMessenger.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/contracts/L1/L1CrossDomainMessenger.sol
Outdated
Show resolved
Hide resolved
packages/contracts-bedrock/contracts/universal/CrossDomainMessenger.sol
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty ironed out to me at this point pending other's reviews.
Waiting for @tynes' approval to remove the |
Do you mind squashing this PR in a commit or a few commits? |
c136b42
to
48ef885
Compare
48ef885
to
1c61224
Compare
This PR has been added to the merge queue, and will be merged soon. |
This PR is next in line to be merged, and will be merged as soon as checks pass. |
…Gas` Adjusts `SafeCall.callWithMinGas` to account for the worst-case cost of 3/5 of the `CALL` opcode's dynamic gas factors: - `address_access_cost` - `positive_value_cost` - `value_to_empty_account_cost` As for `memory_expansion_cost` & `code_execution_cost`, these are expected to be covered by the `minGasLimit` itself. Also removes the division from `hasMinGas` for extra precision. See: - ethereum-optimism/optimism#5470 - ethereum-optimism/optimism#5540
Clean up the script that is used to migrate legacy withdrawals. This script is very important for testing the legacy withdrawal migration. A bug was introduced with #4911 which was a sherlock audit fix. This was a bug because the change resulted in the withdrawal hashes changing, meaning that the storage slots computed client side also changed. This resulted in breaking the script. This commit reverts this change. The changes landing in #5470 will cause the buffer in the gas limit for the migrated withdrawals to be too small, so we can reintroduce this code behind a switch with the network. Its not ideal that the migration code isn't going to match 1:1 with goerli but thats ok because we will be able to thoroughly test it.
Overview
Adjusts
SafeCall.callWithMinGas
to account for the worst-case cost of 3/5 of theCALL
opcode's dynamic gas factors:address_access_cost
positive_value_cost
value_to_empty_account_cost
As for
memory_expansion_cost
&code_execution_cost
, these are expected to be covered by theminGasLimit
itself.