Skip to content

fix(script): use weighted average for gas price calculation#13225

Open
dizer-ti wants to merge 1 commit intofoundry-rs:masterfrom
dizer-ti:fix/weighted-avg-gas-price
Open

fix(script): use weighted average for gas price calculation#13225
dizer-ti wants to merge 1 commit intofoundry-rs:masterfrom
dizer-ti:fix/weighted-avg-gas-price

Conversation

@dizer-ti
Copy link
Contributor

The previous formula sum(gas_price) / count was incorrect because it didn't account for varying gas consumption per transaction. The correct formula is sum(gas_used * gas_price) / sum(gas_used) which ensures that total_gas * avg_gas_price = total_paid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant