From 0fd7e32799d072ca68ae063fa0fa96cfbc0be959 Mon Sep 17 00:00:00 2001 From: 0xKitsune <0xkitsune@protonmail.com> Date: Fri, 20 Dec 2024 18:02:40 -0500 Subject: [PATCH 1/3] update build empty payload --- .../crates/world/payload/src/builder.rs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/world-chain-builder/crates/world/payload/src/builder.rs b/world-chain-builder/crates/world/payload/src/builder.rs index eeb2f0de..11adf518 100644 --- a/world-chain-builder/crates/world/payload/src/builder.rs +++ b/world-chain-builder/crates/world/payload/src/builder.rs @@ -298,7 +298,10 @@ where impl PayloadBuilder for WorldChainPayloadBuilder where - Client: StateProviderFactory + ChainSpecProvider + BlockReaderIdExt, + Client: StateProviderFactory + + ChainSpecProvider + + BlockReaderIdExt + + Clone, Pool: TransactionPool>, EvmConfig: ConfigureEvm
, Txs: OpPayloadTransactions, @@ -326,23 +329,20 @@ where // system txs, hence on_missing_payload we return [MissingPayloadBehaviour::AwaitInProgress]. fn build_empty_payload( &self, - _client: &Client, - _config: PayloadConfig, + client: &Client, + config: PayloadConfig, ) -> Result { - // TODO: - // let args = BuildArguments { - // client, - // config, - // // we use defaults here because for the empty payload we don't need to execute anything - // pool: NoopWorldChainTransactionPool::default(), - // cached_reads: Default::default(), - // cancel: Default::default(), - // best_payload: None, - // }; - // self.build_payload(args)? - // .into_payload() - // .ok_or_else(|| PayloadBuilderError::MissingPayload) - todo!() + let args = BuildArguments { + client: client.clone(), + config, + pool: NoopWorldChainTransactionPool::default(), + cached_reads: Default::default(), + cancel: Default::default(), + best_payload: None, + }; + self.build_payload(args)? + .into_payload() + .ok_or_else(|| PayloadBuilderError::MissingPayload) } } From 123d8990adb1b2a102f32d36bacd568fb2337bc7 Mon Sep 17 00:00:00 2001 From: 0xKitsune <0xkitsune@protonmail.com> Date: Fri, 20 Dec 2024 18:19:53 -0500 Subject: [PATCH 2/3] add is better payload --- world-chain-builder/crates/world/payload/src/builder.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/world-chain-builder/crates/world/payload/src/builder.rs b/world-chain-builder/crates/world/payload/src/builder.rs index 11adf518..3e0fdc7d 100644 --- a/world-chain-builder/crates/world/payload/src/builder.rs +++ b/world-chain-builder/crates/world/payload/src/builder.rs @@ -13,8 +13,8 @@ use reth::revm::witness::ExecutionWitnessRecord; use reth::revm::{DatabaseCommit, State}; use reth::transaction_pool::{BestTransactionsAttributes, TransactionPool}; use reth_basic_payload_builder::{ - BuildArguments, BuildOutcome, BuildOutcomeKind, MissingPayloadBehaviour, PayloadBuilder, - PayloadConfig, + is_better_payload, BuildArguments, BuildOutcome, BuildOutcomeKind, MissingPayloadBehaviour, + PayloadBuilder, PayloadConfig, }; use reth_chain_state::ExecutedBlock; use reth_evm::{ConfigureEvm, NextBlockEnvAttributes}; @@ -695,10 +695,8 @@ impl WorldChainPayloadBuilderCtx { } /// Returns true if the fees are higher than the previous payload. - /// TODO: PBH pub fn is_better_payload(&self, total_fees: U256) -> bool { - // self.inner.is_better_payload( total_fees) - todo!() + is_better_payload(self.inner.best_payload.as_ref(), total_fees) } /// Commits the withdrawals from the payload attributes to the state. From c86e75acd56f5f506c67a07f8d2c0dc969019e1b Mon Sep 17 00:00:00 2001 From: 0xKitsune <0xkitsune@protonmail.com> Date: Fri, 20 Dec 2024 18:24:36 -0500 Subject: [PATCH 3/3] fix dup pbh test --- world-chain-builder/crates/world/node/tests/e2e.rs | 2 +- world-chain-builder/crates/world/payload/src/builder.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/world-chain-builder/crates/world/node/tests/e2e.rs b/world-chain-builder/crates/world/node/tests/e2e.rs index 64ff24e9..c7c94b4d 100644 --- a/world-chain-builder/crates/world/node/tests/e2e.rs +++ b/world-chain-builder/crates/world/node/tests/e2e.rs @@ -312,7 +312,7 @@ async fn test_dup_pbh_nonce() -> eyre::Result<()> { let raw_tx_0 = ctx.raw_pbh_tx_bytes(signer.clone(), 0, 0).await; ctx.node.rpc.inject_tx(raw_tx_0.clone()).await?; - let raw_tx_1 = ctx.raw_pbh_tx_bytes(signer.clone(), 0, 1).await; + let raw_tx_1 = ctx.raw_pbh_tx_bytes(signer.clone(), 0, 0).await; // Now that the nullifier has successfully been stored in // the `ExecutedPbhNullifierTable`, inserting a new tx with the diff --git a/world-chain-builder/crates/world/payload/src/builder.rs b/world-chain-builder/crates/world/payload/src/builder.rs index 3e0fdc7d..80878b83 100644 --- a/world-chain-builder/crates/world/payload/src/builder.rs +++ b/world-chain-builder/crates/world/payload/src/builder.rs @@ -36,7 +36,7 @@ use reth_provider::{ }; use reth_transaction_pool::error::{InvalidPoolTransactionError, PoolTransactionError}; use reth_transaction_pool::{BestTransactions, ValidPoolTransaction}; -use revm::{Database, StateBuilder}; +use revm::Database; use revm_primitives::{ BlockEnv, Bytes, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg, InvalidTransaction, ResultAndState, TxEnv, B256, U256,