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

Arbitrum gas limit multiplier #4781

Merged
merged 14 commits into from
Apr 30, 2024

Conversation

albert-llimos
Copy link
Contributor

@albert-llimos albert-llimos commented Apr 19, 2024

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have updated documentation where appropriate.

Summary

Gas required for transactions in Arbitrum changes over time depending on several factors, mainly Ethereum calldata price. It's not that Arbitrum gas price for a transaction changes over time, which it also does, but the amount of gas needed per transaction changes over time.

Therefore, I am implementing a gas_limit_multiplier that is used to track the gas limit variability. For now this is only needed for ingress/egress fee calculations.

For context, Arbitrum have NodeInterface call that returns parameters related to fees. That includes, among others, a gas estimation that I'm using to calculate the multiplier, and the current l2 base fee. Since we are anyway not doing anything fancy with fee_history we can instead replace it for the value returned by the NodeInterface. I have checked that it behaves correctly.

Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 10.00000% with 72 lines in your changes are missing coverage. Please review.

Project coverage is 72%. Comparing base (5b074d5) to head (6fa3795).
Report is 3 commits behind head on main.

Files Patch % Lines
engine/src/evm/retry_rpc/node_interface.rs 0% 28 Missing ⚠️
engine/src/evm/rpc/node_interface.rs 0% 25 Missing ⚠️
engine/src/witness/arb/chain_tracking.rs 0% 13 Missing ⚠️
state-chain/chains/src/arb.rs 0% 4 Missing ⚠️
state-chain/chains/src/arb/benchmarking.rs 0% 1 Missing ⚠️
...ain/runtime/src/migrations/arbitrum_integration.rs 0% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main   #4781    +/-   ##
======================================
- Coverage     72%     72%    -0%     
======================================
  Files        424     426     +2     
  Lines      72319   72239    -80     
  Branches   72319   72239    -80     
======================================
- Hits       52261   52045   -216     
- Misses     17519   17647   +128     
- Partials    2539    2547     +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@albert-llimos albert-llimos changed the title Chore/arbitrum chaintracking gas estimates Arbitrum gas limit multiplier Apr 19, 2024
@albert-llimos albert-llimos marked this pull request as ready for review April 19, 2024 12:10
Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

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

LGTM - will wait for @kylezs and/or @AlastairHolmes to give the all-clear on the witnessing side.

Comment on lines 11 to 12
// This is a kind of precompile on Arbitrum (although not deployed on chain)
const NODE_INTERFACE_ADDRESS: &str = "0x00000000000000000000000000000000000000C8";
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean? Is there some kind of reference we can provide a link to here, or somewhere we can check this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://docs.arbitrum.io/build-decentralized-apps/nodeinterface/reference
It's an implementation at a node level as if it were a contract deployed at that address but it's not really deployed. I'll improve that comment with the link.

@albert-llimos albert-llimos added this pull request to the merge queue Apr 30, 2024
Merged via the queue into main with commit 4c52b53 Apr 30, 2024
44 checks passed
@albert-llimos albert-llimos deleted the chore/arbitrum-chaintracking-gas-estimates branch April 30, 2024 13:52
syan095 added a commit that referenced this pull request May 1, 2024
* origin/main:
  Arbitrum gas limit multiplier (#4781)
  fix: don't set code red on "agg-key set by gov-key" (#4813)
  fix: sign tx with correct key during rotation (#4794)
  chore: arbitrum witnesser permission (#4798)
  Solana (#4414)
  feat: try-runtime build step on dev ci (#4807)
  feat: optimistic build, streamlined ci-main (#4806)
  chore: log raw dispatch error (#4809)
  feat: allow for single binary CFE upgrades (#4634)
  fix: take fee on to usdc (#4801) (#4804)
  refactor: minor cleanup of retrier code and vault pallet (#4803)
  feat: cf_boost_pool_details rpc (#4780)

# Conflicts:
#	Cargo.lock
#	state-chain/chains/src/sol.rs
#	state-chain/chains/src/sol/program_instructions.rs
#	state-chain/chains/src/sol/sol_tx_building_blocks.rs
#	state-chain/chains/src/sol/token_instructions.rs
#	state-chain/runtime/src/safe_mode.rs
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.

3 participants