-
Notifications
You must be signed in to change notification settings - Fork 562
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: use u128 for calc data fee result #757
Merged
Merged
Conversation
This file contains 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
DaniPopes
approved these changes
Sep 28, 2023
Closed
1 task
rakita
reviewed
Sep 28, 2023
crates/primitives/src/env.rs
Outdated
@@ -424,10 +424,10 @@ impl Env { | |||
/// | |||
/// [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> { |
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.
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) |
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.
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())) |
Rjected
force-pushed
the
fix-calc-data-fee
branch
from
September 28, 2023 14:25
ce99cb0
to
6ba6015
Compare
Merged
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_fee
method to compute a u128.