-
Notifications
You must be signed in to change notification settings - Fork 50
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: calculate l1 gas consumed #257
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @yoavGrs)
a discussion (no related file):
Where is the connection to the block hash? It should have changed from this PR. Is it not connected yet?
src/block_hash/receipt_commitment.rs
line 17 at r1 (raw file):
pub fn calculate_receipt_commitment<H: HashFunction>( transactions_receipt: &[TransactionReceipt], l1_data_gas_wei_price: GasPrice,
Why wei? IIRC It depends on the transaction. If it's a v3 transaction you should put fri here
src/block_hash/receipt_commitment.rs
line 82 at r1 (raw file):
// L1 gas consumed (In the current RPC: // L1 gas consumed for calldata + L1 gas consumed for steps and builtins. // Calculated as: total L1 gas consumed - L1 data gas consumed for blob),
total L1 gas consumed is L1 gas consumed. Data gas is not gas
You can write here (actual_fee - actual_l1_data_gas_fee) / l1_gas_price
eb045b3
to
d4f5e94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @yoavGrs)
src/block_hash/receipt_commitment.rs
line 112 at r2 (raw file):
} fn get_price_by_version(
This is a useful function. Add a TODO to move it to transaction.rs and make it public
src/block_hash/receipt_commitment_test.rs
line 45 at r2 (raw file):
}; let l1_data_gas_price = GasPricePerToken { price_in_fri: GasPrice(456), price_in_wei: GasPrice(456) };
Make the prices different to check that you're calling the correct price.
You can have two prices, one with fri = x, wei = y for the v2 transaction, and one with fri = y, wei = z for the v3 transaction
d4f5e94
to
7564068
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @ShahakShama)
a discussion (no related file):
Previously, ShahakShama wrote…
Where is the connection to the block hash? It should have changed from this PR. Is it not connected yet?
Right, I will update the block hash (251, 248) after this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)
7564068
to
977151a
Compare
This change is