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: add additional gas usage info from bootloader #590

Merged
merged 5 commits into from
Sep 24, 2024

Conversation

nbaztec
Copy link
Collaborator

@nbaztec nbaztec commented Sep 24, 2024

Motivation

The gas usage value in VmExecutionStatistics is not representative of the actual gas a user pays which is observable when checking the values from the RefundTracer.

Gas Limit: 1073741824
Gas spent on computation: 260304
Gas spent on pubdata: 15827000
Pubdata published: 931
...
...
VmExecutionStatistics { gas_used: 25901, ... }

Solution

Utilize the BootloaderDebugTracer from era-test-node's modified bootloader.yul to utilize the gas usage parameters, to compute the accurate information.

Gas Limit: 1073741824
Gas spent on computation: 260304
Gas spent on pubdata: 15827000
Pubdata published: 931
...
BootloaderDebug { total_gas_limit_from_user: 1073741824, reserved_gas: 993741824, gas_per_pubdata: 17000, gas_limit_after_intrinsic: 79975930, gas_after_validation: 79906438, gas_spent_on_execution: 166742, gas_spent_on_bytecode_preparation: 120492, refund_computed: 79739696, refund_by_operator: 1057914824, intrinsic_overhead: 14070, required_overhead: 11200, operator_overhead: 10000, overhead_for_length: 11200, overhead_for_slot: 10000 }
...
...
gas usage limit=80000000 execution=260304 pubdata=15827000 refunded=1057914824

@nbaztec nbaztec requested a review from elfedy September 24, 2024 11:34
Copy link
Contributor

@elfedy elfedy left a comment

Choose a reason for hiding this comment

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

👏

@nbaztec nbaztec merged commit 8422d71 into main Sep 24, 2024
11 checks passed
@nbaztec nbaztec deleted the nish-add-gas-usage-info branch September 24, 2024 12:41
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