fix: use u128 for calc data fee result#757
Merged
rakita merged 2 commits intobluealloy:mainfrom Sep 28, 2023
Merged
Conversation
DaniPopes
approved these changes
Sep 28, 2023
Closed
1 task
rakita
reviewed
Sep 28, 2023
crates/primitives/src/env.rs
Outdated
| /// [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844 | ||
| #[inline] | ||
| pub fn calc_data_fee(&self) -> Option<u64> { | ||
| pub fn calc_data_fee(&self) -> Option<u128> { |
Member
There was a problem hiding this comment.
Suggested change
| pub fn calc_data_fee(&self) -> Option<u128> { | |
| pub fn calc_data_fee(&self) -> Option<U256> { |
revm balance is represented as U256 so it would be good to return same type.
rakita
reviewed
Sep 28, 2023
crates/primitives/src/env.rs
Outdated
| self.block | ||
| .get_blob_gasprice() | ||
| .map(|blob_gas_price| blob_gas_price * self.tx.get_total_blob_gas()) | ||
| .map(|blob_gas_price| blob_gas_price as u128 * self.tx.get_total_blob_gas() as u128) |
Member
There was a problem hiding this comment.
Suggested change
| .map(|blob_gas_price| blob_gas_price as u128 * self.tx.get_total_blob_gas() as u128) | |
| .map(|blob_gas_price| U256::from(blob_gas_price).saturating_mul(U256::from(self.tx.get_total_blob_gas())) |
ce99cb0 to
6ba6015
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A hive test runs with these parameters:
The data fee overflowed in this case, causing an invalid state root in the test. This fixes the
calc_data_feemethod to compute a u128.