-
Notifications
You must be signed in to change notification settings - Fork 38
fix: jovian hardfork tests & fixes #320
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4fa4c1a
chore: fixes for jovian
danyalprout d1b2a8c
blob fee fixes
danyalprout 69aff23
Update tests to Jovian
danyalprout 5ec6e2b
run miner limit tests on both standard/flashblocks
danyalprout effdf8e
Ensure builder transactions count towards DA usage
danyalprout eb0e675
Increment DA usage for non-deposit sequencer transactions (e.g. via C…
danyalprout File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ use either::Either; | |
| use eyre::WrapErr as _; | ||
| use reth::payload::PayloadBuilderAttributes; | ||
| use reth_basic_payload_builder::BuildOutcome; | ||
| use reth_chainspec::EthChainSpec; | ||
| use reth_evm::{ConfigureEvm, execute::BlockBuilder}; | ||
| use reth_node_api::{Block, NodePrimitives, PayloadBuilderError}; | ||
| use reth_optimism_consensus::{calculate_receipt_root_no_memo_optimism, isthmus}; | ||
|
|
@@ -222,6 +223,21 @@ where | |
| ) -> eyre::Result<OpPayloadBuilderCtx<FlashblocksExtraCtx>> { | ||
| let chain_spec = self.client.chain_spec(); | ||
| let timestamp = config.attributes.timestamp(); | ||
|
|
||
| let extra_data = if chain_spec.is_jovian_active_at_timestamp(timestamp) { | ||
| config | ||
| .attributes | ||
| .get_jovian_extra_data(chain_spec.base_fee_params_at_timestamp(timestamp)) | ||
| .wrap_err("failed to get holocene extra data for flashblocks payload builder")? | ||
| } else if chain_spec.is_holocene_active_at_timestamp(timestamp) { | ||
| config | ||
| .attributes | ||
| .get_holocene_extra_data(chain_spec.base_fee_params_at_timestamp(timestamp)) | ||
| .wrap_err("failed to get holocene extra data for flashblocks payload builder")? | ||
| } else { | ||
| Default::default() | ||
| }; | ||
|
|
||
| let block_env_attributes = OpNextBlockEnvAttributes { | ||
| timestamp, | ||
| suggested_fee_recipient: config.attributes.suggested_fee_recipient(), | ||
|
|
@@ -234,18 +250,12 @@ where | |
| .attributes | ||
| .payload_attributes | ||
| .parent_beacon_block_root, | ||
| extra_data: if chain_spec.is_holocene_active_at_timestamp(timestamp) { | ||
| config | ||
| .attributes | ||
| .get_holocene_extra_data(chain_spec.base_fee_params_at_timestamp(timestamp)) | ||
| .wrap_err("failed to get holocene extra data for flashblocks payload builder")? | ||
| } else { | ||
| Default::default() | ||
| }, | ||
| extra_data, | ||
| }; | ||
|
|
||
| let evm_env = self | ||
| .evm_config | ||
| let evm_config = self.evm_config.clone(); | ||
|
|
||
| let evm_env = evm_config | ||
| .next_evm_env(&config.parent_header, &block_env_attributes) | ||
| .wrap_err("failed to create next evm env")?; | ||
|
|
||
|
|
@@ -352,6 +362,7 @@ where | |
| // We subtract gas limit and da limit for builder transaction from the whole limit | ||
| let builder_tx_gas = builder_txs.iter().fold(0, |acc, tx| acc + tx.gas_used); | ||
| let builder_tx_da_size: u64 = builder_txs.iter().fold(0, |acc, tx| acc + tx.da_size); | ||
| info.cumulative_da_bytes_used += builder_tx_da_size; | ||
|
|
||
| let (payload, fb_payload) = build_block( | ||
| &mut state, | ||
|
|
@@ -628,6 +639,7 @@ where | |
|
|
||
| let builder_tx_gas = builder_txs.iter().fold(0, |acc, tx| acc + tx.gas_used); | ||
| let builder_tx_da_size: u64 = builder_txs.iter().fold(0, |acc, tx| acc + tx.da_size); | ||
| info.cumulative_da_bytes_used += builder_tx_da_size; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| target_gas_for_batch = target_gas_for_batch.saturating_sub(builder_tx_gas); | ||
|
|
||
| // saturating sub just in case, we will log an error if da_limit too small for builder_tx_da_size | ||
|
|
@@ -1032,10 +1044,7 @@ where | |
| // create the block header | ||
| let transactions_root = proofs::calculate_transaction_root(&info.executed_transactions); | ||
|
|
||
| // OP doesn't support blobs/EIP-4844. | ||
| // https://specs.optimism.io/protocol/exec-engine.html#ecotone-disable-blob-transactions | ||
| // Need [Some] or [None] based on hardfork to match block hash. | ||
| let (excess_blob_gas, blob_gas_used) = ctx.blob_fields(); | ||
| let (excess_blob_gas, blob_gas_used) = ctx.blob_fields(info); | ||
| let extra_data = ctx.extra_data()?; | ||
|
|
||
| let header = Header { | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,6 +201,21 @@ where | |
|
|
||
| let chain_spec = self.client.chain_spec(); | ||
| let timestamp = config.attributes.timestamp(); | ||
|
|
||
| let extra_data = if chain_spec.is_jovian_active_at_timestamp(timestamp) { | ||
| config | ||
| .attributes | ||
| .get_jovian_extra_data(chain_spec.base_fee_params_at_timestamp(timestamp)) | ||
| .map_err(PayloadBuilderError::other)? | ||
| } else if chain_spec.is_holocene_active_at_timestamp(timestamp) { | ||
| config | ||
| .attributes | ||
| .get_holocene_extra_data(chain_spec.base_fee_params_at_timestamp(timestamp)) | ||
| .map_err(PayloadBuilderError::other)? | ||
| } else { | ||
| Default::default() | ||
| }; | ||
|
|
||
| let block_env_attributes = OpNextBlockEnvAttributes { | ||
| timestamp, | ||
| suggested_fee_recipient: config.attributes.suggested_fee_recipient(), | ||
|
|
@@ -213,14 +228,7 @@ where | |
| .attributes | ||
| .payload_attributes | ||
| .parent_beacon_block_root, | ||
| extra_data: if chain_spec.is_holocene_active_at_timestamp(timestamp) { | ||
| config | ||
| .attributes | ||
| .get_holocene_extra_data(chain_spec.base_fee_params_at_timestamp(timestamp)) | ||
| .map_err(PayloadBuilderError::other)? | ||
| } else { | ||
| Default::default() | ||
| }, | ||
| extra_data, | ||
| }; | ||
|
|
||
| let evm_env = self | ||
|
|
@@ -358,6 +366,7 @@ impl<Txs: PayloadTxsBounds> OpBuilder<'_, Txs> { | |
| }; | ||
|
|
||
| let builder_tx_gas = builder_txs.iter().fold(0, |acc, tx| acc + tx.gas_used); | ||
|
|
||
| let block_gas_limit = ctx.block_gas_limit().saturating_sub(builder_tx_gas); | ||
| if block_gas_limit == 0 { | ||
| error!( | ||
|
|
@@ -366,6 +375,7 @@ impl<Txs: PayloadTxsBounds> OpBuilder<'_, Txs> { | |
| } | ||
| // Save some space in the block_da_limit for builder tx | ||
| let builder_tx_da_size = builder_txs.iter().fold(0, |acc, tx| acc + tx.da_size); | ||
| info.cumulative_da_bytes_used += builder_tx_da_size; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be in here as the builder tx isn't necessarily committed yet |
||
| let block_da_limit = ctx | ||
| .da_config | ||
| .max_da_block_size() | ||
|
|
@@ -459,6 +469,11 @@ impl<Txs: PayloadTxsBounds> OpBuilder<'_, Txs> { | |
| }; | ||
|
|
||
| let block_number = ctx.block_number(); | ||
| // OP doesn't support blobs/EIP-4844. | ||
| // https://specs.optimism.io/protocol/exec-engine.html#ecotone-disable-blob-transactions | ||
| // Need [Some] or [None] based on hardfork to match block hash. | ||
| let (excess_blob_gas, blob_gas_used) = ctx.blob_fields(&info); | ||
|
|
||
| let execution_outcome = ExecutionOutcome::new( | ||
| db.take_bundle(), | ||
| vec![info.receipts], | ||
|
|
@@ -521,10 +536,6 @@ impl<Txs: PayloadTxsBounds> OpBuilder<'_, Txs> { | |
| // create the block header | ||
| let transactions_root = proofs::calculate_transaction_root(&info.executed_transactions); | ||
|
|
||
| // OP doesn't support blobs/EIP-4844. | ||
| // https://specs.optimism.io/protocol/exec-engine.html#ecotone-disable-blob-transactions | ||
| // Need [Some] or [None] based on hardfork to match block hash. | ||
| let (excess_blob_gas, blob_gas_used) = ctx.blob_fields(); | ||
| let extra_data = ctx.extra_data()?; | ||
|
|
||
| let header = Header { | ||
|
|
||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
this should be in here as the builder tx isn't necessarily committed yet