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

Robust script for estimating the max segment and the tranche counts #872

Closed
PaulRBerg opened this issue Mar 29, 2024 · 4 comments
Closed
Assignees
Labels
effort: high Large or difficult task. priority: 1 This is important. It should be dealt with shortly. type: feature New feature or request. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise.

Comments

@PaulRBerg
Copy link
Member

PaulRBerg commented Mar 29, 2024

Context

While reviewing Shub's gas estimation script here, it dawned on me that we have been too lax about the values of MAX_SEGMENT_COUNT and MAX_TRANCHE_COUNT.

Basically, we have relied on heuristics and quick-and-dirty scripts to obtain them.

It's about time to develop a robust shell script for estimating the max segment and the tranche counts. My rationale is thus:

  • We are deploying to 10+ chains, a number which will only increase over time
  • Chains can change their total gas limit, which may require us to be agile and redeploy the contracts with new max counts
  • There are nuances regarding the block gas limits on some chains such as Avalanche

Mechanism of Action

The script would work something like this:

  • Hard-code the (known) block gas limits for our deployment chains (until Forge Std implements my feature request)
  • Gas golf createWithDurations (which is always more expensive than createWithTimestamps) until the consumed gas is right below the block gas limit per chain
  • Allow the user to run the script for only one chain, or for all of them
  • Subtract 10 from the previously obtained value (as an additional precaution)
  • Do this for LockupDynamic and LockupTranched (separately)

A related suggestion is that we may want to turn the maxCount variable into a mapping in BaseScript.

@PaulRBerg PaulRBerg added type: feature New feature or request. effort: high Large or difficult task. priority: 1 This is important. It should be dealt with shortly. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise. labels Mar 29, 2024
@PaulRBerg
Copy link
Member Author

Relevant information for how to read the block gas limit on OP Stack chains:

foundry-rs/forge-std#535 (comment)

@PaulRBerg

This comment was marked as resolved.

@smol-ninja

This comment was marked as resolved.

@smol-ninja
Copy link
Member

@PaulRBerg tagging you since its been added in #908.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: high Large or difficult task. priority: 1 This is important. It should be dealt with shortly. type: feature New feature or request. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise.
Projects
None yet
Development

No branches or pull requests

4 participants
@smol-ninja @PaulRBerg @andreivladbrg and others