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: different scaling gas constants based on forked network #295

Merged

Conversation

zeapoz
Copy link
Contributor

@zeapoz zeapoz commented Jun 17, 2024

What 💻

  • Introduces a new enum ForkNetwork encapsulating network local values.

Why ✋

Currently, the scaling gas estimation parameters are hardcoded here and here. However, these should actually be dependant on the network we fork from. These values can not yet be fetched from a publicly available source and as such, this PR introduces a temporary measure for hardcoding different gas estimation constants for each valid network source.

Evidence 📷

  1. Running the test node with cargo run --release fork <NETWORK>.
  2. Sending the following request:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"zks_estimateFee","params":[{"from":"0x40609141Db628BeEE3BfAB8034Fc2D8278D0Cc78", "to": "0xBC989fDe9e54cAd2aB4392Af6dF60f04873A033A", "data":"0x06fdde03"}],"id":1}' http://localhost:8011
  1. Observing the logged values (note: tracing::trace! statements changed to println! for better clarity) results in:
Screenshot 2024-06-17 at 12 53 05

mainnet

Screenshot 2024-06-17 at 12 51 45

sepolia-testnet

@zeapoz zeapoz requested a review from a team as a code owner June 17, 2024 10:54
Copy link
Collaborator

@MexicanAce MexicanAce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MexicanAce MexicanAce merged commit 9c66ac3 into matter-labs:main Jun 25, 2024
10 checks passed
@zeapoz zeapoz deleted the feat/forking-scaling-gas-constants branch June 25, 2024 11:26
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.

2 participants