-
Notifications
You must be signed in to change notification settings - Fork 25
refactor: execute PoL in normal transaction pipeline #271
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ use crate::{ | |
| hardforks::BerachainHardforks, | ||
| node::evm::{block_context::BerachainBlockExecutionCtx, error::BerachainExecutionError}, | ||
| primitives::{BerachainBlock, BerachainHeader}, | ||
| transaction::{BerachainTxEnvelope, BerachainTxType, pol::create_pol_transaction}, | ||
| transaction::{BerachainTxEnvelope, BerachainTxType}, | ||
| }; | ||
| use alloy_consensus::{Block, BlockBody, BlockHeader, EMPTY_OMMER_ROOT_HASH, TxReceipt, proofs}; | ||
| use alloy_eips::merge::BEACON_NONCE; | ||
|
|
@@ -53,7 +53,7 @@ where | |
| evm_env, | ||
| execution_ctx: ctx, | ||
| parent, | ||
| mut transactions, | ||
| transactions, | ||
| output: BlockExecutionResult { receipts, requests, gas_used, blob_gas_used }, | ||
| state_root, | ||
| .. | ||
|
|
@@ -64,27 +64,13 @@ where | |
| // Validate proposer pubkey presence for Prague1 | ||
| validate_proposer_pubkey_prague1(&*self.chain_spec, timestamp, ctx.prev_proposer_pubkey)?; | ||
|
|
||
| // Check if Prague1 is active and we need to inject POL transaction | ||
| // Post-Prague1, PoL must already be tx #0 with a matching receipt. | ||
| if self.chain_spec.is_prague1_active_at_timestamp(timestamp) { | ||
| let prev_proposer_pubkey = ctx.prev_proposer_pubkey.unwrap(); | ||
|
|
||
| // Synthesize POL transaction and prepend to transactions list | ||
| let base_fee = evm_env.block_env.basefee(); | ||
| let pol_transaction = create_pol_transaction( | ||
| self.chain_spec.clone(), | ||
| prev_proposer_pubkey, | ||
| evm_env.block_env.number(), | ||
| base_fee, | ||
| )?; | ||
|
|
||
| transactions.insert(0, pol_transaction); | ||
|
|
||
| // Validate that we have receipts after POL transaction execution | ||
| if receipts.is_empty() { | ||
| return Err(BerachainExecutionError::MissingPolReceipts.into()); | ||
| } | ||
|
Comment on lines
+67
to
71
Author
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. #272 Not adding receipt/tx alignment checks here since receipts are built in order during execution and a mismatch would fail on the root computation right below. |
||
|
|
||
| // Validate that the first transaction in the list is indeed a POL transaction | ||
| // Validate that the first transaction is a PoL transaction | ||
| if let Some(first_tx) = transactions.first() { | ||
| if !matches!(first_tx, BerachainTxEnvelope::Berachain(_)) { | ||
| return Err(BerachainExecutionError::MissingPolTransactionAtIndex0.into()); | ||
|
|
||
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.
opened #272
Fixed the
expect, it now returns aMissingProposerPubkeyerror instead of panicking.The RLP length isn't something this PR changed. PoL was never counted in
block_transactions_rlp_lengthbefore either, and the check afterfinish()already rejects any block overMAX_RLP_BLOCK_SIZE. PoL is only ~150-200 bytes and the loop already keeps a 1024 buffer, so leaving that as is.