Skip to content
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

Merged
merged 2 commits into from
Apr 24, 2023

Conversation

clabby
Copy link
Member

@clabby clabby commented Apr 17, 2023

Overview

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.

@changeset-bot
Copy link

changeset-bot bot commented Apr 17, 2023

⚠️ No Changeset found

Latest commit: 8796b41

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@clabby
Copy link
Member Author

clabby commented Apr 17, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@netlify
Copy link

netlify bot commented Apr 17, 2023

Deploy Preview for opstack-docs canceled.

Name Link
🔨 Latest commit 8796b41
🔍 Latest deploy log https://app.netlify.com/sites/opstack-docs/deploys/6446c7aed85c540008133b5f

@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from b5c2a44 to 2201cee Compare April 17, 2023 17:03
tynes added a commit that referenced this pull request Apr 17, 2023
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.
@maurelian
Copy link
Contributor

Fixes CLI-3832

@mergify
Copy link
Contributor

mergify bot commented Apr 18, 2023

Hey @clabby! This PR has merge conflicts. Please fix them before continuing review.

@mergify mergify bot added the conflict label Apr 18, 2023
@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from 2201cee to ec0adb7 Compare April 18, 2023 22:07
@clabby clabby changed the base branch from develop to jm/nonreentrant-with-replays April 18, 2023 22:07
@mergify mergify bot removed the conflict label Apr 18, 2023
@clabby clabby changed the base branch from jm/nonreentrant-with-replays to develop April 18, 2023 22:13
@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from ec0adb7 to 0dfefff Compare April 18, 2023 22:13
@clabby clabby changed the base branch from develop to jm/nonreentrant-with-replays April 18, 2023 22:18
Base automatically changed from jm/nonreentrant-with-replays to develop April 19, 2023 00:30
@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from 0dfefff to bc124c4 Compare April 19, 2023 02:16
@semgrep-app
Copy link
Contributor

semgrep-app bot commented Apr 19, 2023

Semgrep found 2 unchecked-type-assertion findings:

  • op-bindings/bindings/l2crossdomainmessenger.go: L432
  • op-bindings/bindings/l1crossdomainmessenger.go: L463

Unchecked type assertion.

Created by unchecked-type-assertion.

@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from bc124c4 to 5b8ab37 Compare April 19, 2023 13:20
@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from 38bc389 to cfb60fb Compare April 19, 2023 14:34
@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from cfb60fb to f7e83ad Compare April 19, 2023 14:59
@clabby clabby marked this pull request as ready for review April 19, 2023 15:24
@clabby clabby requested a review from a team as a code owner April 19, 2023 15:24
Copy link
Contributor

@refcell refcell left a 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!

Copy link
Contributor

@refcell refcell left a 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.

@clabby
Copy link
Member Author

clabby commented Apr 23, 2023

Waiting for @tynes' approval to remove the do-not-merge and mergify-ignore labels.

@tynes
Copy link
Contributor

tynes commented Apr 24, 2023

Do you mind squashing this PR in a commit or a few commits?

@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch 2 times, most recently from c136b42 to 48ef885 Compare April 24, 2023 17:36
@tynes tynes removed the request for review from sebastianst April 24, 2023 17:47
@clabby clabby force-pushed the clabby/ctb/call-with-min-gas-fix branch from 48ef885 to 1c61224 Compare April 24, 2023 17:55
@mergify
Copy link
Contributor

mergify bot commented Apr 24, 2023

This PR has been added to the merge queue, and will be merged soon.

@mergify
Copy link
Contributor

mergify bot commented Apr 24, 2023

This PR is next in line to be merged, and will be merged as soon as checks pass.

@OptimismBot OptimismBot merged commit dd2bef6 into develop Apr 24, 2023
@OptimismBot OptimismBot deleted the clabby/ctb/call-with-min-gas-fix branch April 24, 2023 18:32
@mergify mergify bot removed the on-merge-train label Apr 24, 2023
seolaoh added a commit to kroma-network/kroma that referenced this pull request Aug 9, 2023
…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
nitaliano pushed a commit that referenced this pull request May 20, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants