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

fix(gas): amortize evm transaction fixed cost over bundle #442

Merged
merged 3 commits into from
Oct 5, 2023

Conversation

alex-miao
Copy link
Collaborator

#349

Proposed Changes

  • Only count the 21000 transaction gas cost once in the entire bundle

@codecov
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

Merging #442 (7bb3809) into main (22fc250) will increase coverage by 0.05%.
The diff coverage is 95.12%.

Impacted file tree graph

Files Coverage Δ
crates/builder/src/bundle_proposer.rs 88.90% <100.00%> (-0.02%) ⬇️
crates/sim/src/precheck.rs 68.40% <100.00%> (ø)
crates/sim/src/gas/gas.rs 89.63% <92.59%> (+0.59%) ⬆️
Flag Coverage Δ
unit-tests 52.03% <95.12%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
rundler binary 0.00% <ø> (ø)
builder 45.08% <100.00%> (-0.02%) ⬇️
dev 0.00% <ø> (ø)
pool 59.65% <ø> (ø)
provider 1.33% <ø> (ø)
rpc 18.51% <ø> (ø)
sim 82.19% <92.85%> (+0.07%) ⬆️
tasks ∅ <ø> (∅)
types 93.56% <ø> (ø)
utils 7.20% <ø> (ø)

where
I: Iterator<Item = &'a UserOperation>,
{
let ov = GasOverheads::default();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

somewhat unnecessary duplication since we are creating the GasOverheads object both here and within user_operation_gas_limit, but favoring this over needing to make GasOverheads public.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we're doing this here, we might as well do the same thing in calc_static_pre_verification_gas?

Either we make it part of both the interfaces, or we instantiate in each.

Again I eventually want these to look like bundle_gas_limit<C: ChainSpec> and then you can get these constants off of the chain spec.

Comment on lines 784 to 785
+ U256::from(5_000)
+ U256::from(21_000),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to get these from some common place? Tests will break if we ever modify these values.

These are the sorts of things I want to move to the ChainSpec config class in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed to exposing the relevant fields of GasOverheads, it's not great but just avoiding a major refactor for now.

Copy link
Collaborator

@dancoombs dancoombs left a comment

Choose a reason for hiding this comment

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

:shipit:

@alex-miao alex-miao merged commit e220e0a into main Oct 5, 2023
7 checks passed
@alex-miao alex-miao deleted the alex/amortize-fixed-gas branch October 5, 2023 17:52
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