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: make base fee computation parameters configurable via chain spec #3992

Merged
merged 1 commit into from
Aug 7, 2023
Merged

feat: make base fee computation parameters configurable via chain spec #3992

merged 1 commit into from
Aug 7, 2023

Conversation

roberto-bayardo
Copy link
Contributor

@roberto-bayardo roberto-bayardo commented Jul 30, 2023

Making these parameters configurable will, for example, allow chains to have a different gas target per block.

@roberto-bayardo roberto-bayardo marked this pull request as ready for review July 30, 2023 17:08
@rkrasiuk rkrasiuk added the A-op-reth Related to Optimism and op-reth label Jul 30, 2023
Copy link
Member

@rkrasiuk rkrasiuk left a comment

Choose a reason for hiding this comment

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

got some minor comments, lgtm otherwise

crates/consensus/auto-seal/src/task.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/maintain.rs Outdated Show resolved Hide resolved
crates/rpc/rpc/src/eth/api/fees.rs Outdated Show resolved Hide resolved
@rkrasiuk rkrasiuk added the C-enhancement New feature or request label Jul 30, 2023
@rkrasiuk
Copy link
Member

Context: ported from anton-rs#32

@codecov
Copy link

codecov bot commented Jul 30, 2023

Codecov Report

Merging #3992 (6723a03) into main (e3457b8) will decrease coverage by 52.32%.
Report is 3 commits behind head on main.
The diff coverage is 19.04%.

❗ Current head 6723a03 differs from pull request most recent head 6365d49. Consider uploading reports for the commit 6365d49 to get more accurate results

Impacted file tree graph

Files Changed Coverage Δ
bin/reth/src/args/rpc_server_args.rs 0.00% <0.00%> (-53.99%) ⬇️
bin/reth/src/init.rs 0.00% <0.00%> (-97.21%) ⬇️
crates/consensus/auto-seal/src/lib.rs 0.00% <0.00%> (ø)
crates/consensus/auto-seal/src/task.rs 0.00% <0.00%> (ø)
crates/consensus/common/src/validation.rs 0.00% <0.00%> (-72.53%) ⬇️
crates/payload/builder/src/payload.rs 0.00% <0.00%> (ø)
crates/primitives/src/basefee.rs 0.00% <0.00%> (-97.83%) ⬇️
crates/primitives/src/constants/mod.rs 0.00% <ø> (-100.00%) ⬇️
crates/primitives/src/hardfork.rs 4.42% <0.00%> (-95.58%) ⬇️
crates/primitives/src/header.rs 36.27% <0.00%> (-59.29%) ⬇️
... and 12 more

... and 374 files with indirect coverage changes

Flag Coverage Δ
integration-tests 16.38% <19.04%> (-0.16%) ⬇️
unit-tests ?

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

Components Coverage Δ
reth binary 5.96% <0.00%> (-19.72%) ⬇️
blockchain tree 0.00% <ø> (-83.05%) ⬇️
pipeline 0.00% <ø> (-90.08%) ⬇️
storage (db) 18.22% <66.66%> (-56.20%) ⬇️
trie 0.00% <ø> (-94.71%) ⬇️
txpool 14.94% <0.00%> (-34.03%) ⬇️
networking 27.45% <ø> (-50.00%) ⬇️
rpc 23.77% <12.50%> (-33.69%) ⬇️
consensus 1.00% <0.00%> (-63.08%) ⬇️
revm 1.42% <ø> (-31.12%) ⬇️
payload builder 6.53% <0.00%> (-0.06%) ⬇️
primitives 22.62% <32.55%> (-65.40%) ⬇️

Copy link
Member

@rkrasiuk rkrasiuk left a comment

Choose a reason for hiding this comment

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

one more fix, otherwise lgtm! @mattsse PTAL

crates/rpc/rpc/src/eth/api/mod.rs Outdated Show resolved Hide resolved
@rkrasiuk
Copy link
Member

rkrasiuk commented Jul 31, 2023

@roberto-bayardo sanity_check test which calls full_validation seems to be failing

crates/primitives/src/header.rs Outdated Show resolved Hide resolved
@onbjerg onbjerg changed the title make the base fee computation parameters configurable via chain spec feat: make base fee computation parameters configurable via chain spec Jul 31, 2023
@onbjerg onbjerg added the M-changelog This change should be included in the changelog label Jul 31, 2023
@roberto-bayardo
Copy link
Contributor Author

I tried to make everything consistent (with change_denomiator always preceeding elasticity) in my last commit but apparently missed updating next_block_base_fee ... thanks for the catch. fixed now.

Copy link
Member

@rkrasiuk rkrasiuk left a comment

Choose a reason for hiding this comment

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

one last thing, otherwise lgtm

crates/rpc/rpc/src/eth/api/mod.rs Outdated Show resolved Hide resolved
crates/primitives/src/chain/spec.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

supportive, but I'd like to make this a bit more ergonomic,

we can also add the inverse of the next_base_fee via ChainSpec::next_base_fee(&block) that could also be convenient

crates/primitives/src/header.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/maintain.rs Outdated Show resolved Hide resolved
@merklefruit
Copy link
Contributor

Closes #3750

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

nice, only two pedantic nits

gas_used: u64,
gas_limit: u64,
base_fee: u64,
base_fee_params: &crate::BaseFeeParams,
Copy link
Collaborator

Choose a reason for hiding this comment

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

they can be passed as copy

Suggested change
base_fee_params: &crate::BaseFeeParams,
base_fee_params: crate::BaseFeeParams,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, also changed next_block_base_fee to accept copy instead of reference.

crates/primitives/src/basefee.rs Outdated Show resolved Hide resolved
}
.into()
});

/// BaseFeeParams contains the config parameters that control block base fee computation
#[derive(Serialize, Deserialize, Debug, Clone)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
#[derive(Serialize, Deserialize, Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, also added "Copy" since we're now passing copies

crates/primitives/src/chain/spec.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@mattsse mattsse added this pull request to the merge queue Aug 7, 2023
Merged via the queue into paradigmxyz:main with commit 9569deb Aug 7, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-op-reth Related to Optimism and op-reth C-enhancement New feature or request M-changelog This change should be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants