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 blob fee calc functions #4440

Merged
merged 1 commit into from
Aug 31, 2023
Merged

feat: add blob fee calc functions #4440

merged 1 commit into from
Aug 31, 2023

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Aug 31, 2023

closes #4437

adds calc functions as defined https://eips.ethereum.org/EIPS/eip-4844#helpers

@mattsse mattsse requested a review from gakonst as a code owner August 31, 2023 20:26
@mattsse mattsse requested a review from Rjected August 31, 2023 20:26
@mattsse mattsse added the M-eip This change relates to the implementation of an EIP label Aug 31, 2023
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 104 to 125
#[test]
fn test_fake_exp() {
for (factor, num, denom, expected) in &[
(1u64, 0u64, 1u64, 1u64),
(38493, 0, 1000, 38493),
(0, 1234, 2345, 0),
(1, 2, 1, 6), // approximate 7.389
(1, 4, 2, 6),
(1, 3, 1, 16), // approximate 20.09
(1, 6, 2, 18),
(1, 4, 1, 49), // approximate 54.60
(1, 8, 2, 50),
(10, 8, 2, 542), // approximate 540.598
(11, 8, 2, 596), // approximate 600.58
(1, 5, 1, 136), // approximate 148.4
(1, 5, 2, 11), // approximate 12.18
(2, 5, 2, 23), // approximate 24.36
(1, 50000000, 2225652, 5709098764),
] {
let res = fake_exponential(U256::from(*factor), U256::from(*num), U256::from(*denom));
assert_eq!(res, U256::from(*expected));
Copy link
Member

Choose a reason for hiding this comment

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

nice

@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #4440 (eae7ed1) into main (1a40dae) will decrease coverage by 0.06%.
Report is 2 commits behind head on main.
The diff coverage is 71.73%.

Impacted file tree graph

Files Changed Coverage Δ
crates/primitives/src/header.rs 94.88% <0.00%> (-0.92%) ⬇️
crates/primitives/src/constants/eip4844.rs 85.45% <82.50%> (-7.88%) ⬇️

... and 7 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.67% <0.00%> (-0.03%) ⬇️
unit-tests 63.80% <71.73%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 29.61% <ø> (ø)
blockchain tree 83.52% <ø> (ø)
pipeline 90.47% <ø> (ø)
storage (db) 74.81% <ø> (ø)
trie 94.88% <ø> (ø)
txpool 48.11% <ø> (-0.49%) ⬇️
networking 77.47% <ø> (-0.11%) ⬇️
rpc 57.55% <ø> (ø)
consensus 63.42% <ø> (ø)
revm 31.74% <ø> (ø)
payload builder 6.37% <ø> (ø)
primitives 86.12% <71.73%> (-0.08%) ⬇️

@mattsse mattsse enabled auto-merge August 31, 2023 20:35
@mattsse mattsse added this pull request to the merge queue Aug 31, 2023
Merged via the queue into main with commit 97cf356 Aug 31, 2023
24 checks passed
@mattsse mattsse deleted the matt/add-blob-fee-calc branch August 31, 2023 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-eip This change relates to the implementation of an EIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Header::get_blob_price and Header::get_next_blob_price
2 participants