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(sim): fix gas limit calcs #429

Merged
merged 1 commit into from
Sep 27, 2023
Merged

fix(sim): fix gas limit calcs #429

merged 1 commit into from
Sep 27, 2023

Conversation

dancoombs
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@0xfourzerofour 0xfourzerofour left a comment

Choose a reason for hiding this comment

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

Nice

pub fn user_operation_max_gas_cost(uo: &UserOperation, chain_id: u64) -> U256 {
user_operation_gas_limit(uo, chain_id) * uo.max_fee_per_gas
pub fn user_operation_max_gas_cost(uo: &UserOperation) -> U256 {
let mul = if uo.paymaster().is_some() { 3 } else { 1 };
Copy link
Collaborator

Choose a reason for hiding this comment

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

In the no paymaster case why is this now 1 but in user_operation_execution_gas_limit it's still 2, we can still hit the innerHandleOp code and incur cost there

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question. The 2 is there because of that incorrect check that requires us to have one validationGasLimit buffer left in the transaction's gas. However, since no postOp will ever run when not using a paymaster, the maximum a user will ever need to pay for is 1 validationGasLimit

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #429 (57e8e5f) into main (9008526) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #429      +/-   ##
==========================================
- Coverage   51.98%   51.98%   -0.01%     
==========================================
  Files          93       93              
  Lines       13328    13324       -4     
==========================================
- Hits         6929     6926       -3     
+ Misses       6399     6398       -1     
Flag Coverage Δ
unit-tests 51.98% <100.00%> (-0.01%) ⬇️

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

Files Coverage Δ
crates/builder/src/bundle_proposer.rs 88.91% <100.00%> (ø)
crates/sim/src/estimation/estimation.rs 90.62% <100.00%> (ø)
crates/sim/src/gas/gas.rs 89.04% <100.00%> (+0.37%) ⬆️
crates/sim/src/precheck.rs 68.40% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dancoombs dancoombs merged commit dfb3d1f into main Sep 27, 2023
8 checks passed
@dancoombs dancoombs deleted the danc/fix-gas-total branch September 27, 2023 19:31
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