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

Auto 8888 properly account for l 1 gas overhead for l 2 chains op scroll arb #11983

Conversation

RyanRHall
Copy link
Contributor

@RyanRHall RyanRHall commented Feb 9, 2024

Changes in this PR

  • Remove Gas overhead capping and prepayment check in transmit

    • The gas overhead capping was there to prevent edge cases when upkeep didn't have enough funds during accounting. Having this added many edge cases when accounting for chain specific differences and calculating the exact overhead cap, so we are removing it. In most cases the upkeep is expected to have enough funds since we also have the gasMultiplier applied during checkUpkeep, however in rare edge cases, we just zero out the upkeep balance if it doesn't have enough funds
    • Having this logic also allows us to remove the prepayment check in transmit. Now we just rely on payment check during checkUpkeep, if report comes on chain upkeep can have less balance then we zero out the balance. The balance could have been different from checkUpkeep time due to L1 fluctuations. (fastGasFeed, linkNative are the same as check time, so they don't fluctuate, upkeep balance can't be withdrawn without cancellation). Since we already put calldata on L1, it's just better to perform the upkeep and charge it for what it has.
    • Removing this also simplifies maxLinkPayment Function which is now only called during checkUpkeep simulation
  • Refine gas calculation during transmit to be simpler and more accurate

    • Remove accounting per signer overhead since accounting is independent of 'f' so it was redundant
    • instead of accounting for report.length16, use msg.data16 for the whole calldata
  • Refine L1 fee distribution in batch

    • Instead of equal division, divide them according to performData weight (+overhead) for more accurate charging
  • Refine maxLinkPayment gas overhead calculation

    • Add variables for calldata bytes overhead in addition to performdata
    • Account for chain module overheads, fetched from the module itself and account for this in maxLinkPayment
  • Refine ChainModules for arb, op and scroll to be more accurate

  • Small refactor in transmit path to create TransmitVars to circumvent stack too deep errors

  • Small cleanup to remove setChainSpecificModule which is redundant as the module can be set in setConfig

@RyanRHall RyanRHall requested review from a team and RensR February 9, 2024 18:44
Copy link
Contributor

github-actions bot commented Feb 9, 2024

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@RyanRHall RyanRHall force-pushed the AUTO-8888-properly-account-for-l-1-gas-overhead-for-l-2-chains-op-scroll-arb branch from 2259457 to 877edd3 Compare February 9, 2024 22:13
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

infiloop2
infiloop2 previously approved these changes Feb 16, 2024
Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

Copy link
Contributor

Go solidity wrappers are out-of-date, regenerate them via the make wrappers-all command

@cl-sonarqube-production
Copy link

@FelixFan1992 FelixFan1992 added this pull request to the merge queue Feb 16, 2024
Merged via the queue into develop with commit 7685116 Feb 16, 2024
106 checks passed
@FelixFan1992 FelixFan1992 deleted the AUTO-8888-properly-account-for-l-1-gas-overhead-for-l-2-chains-op-scroll-arb branch February 16, 2024 20:29
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.

4 participants