Skip to content

Commit

Permalink
Pass args
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Sep 27, 2024
1 parent 7026ff0 commit ad5e7bc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
14 changes: 10 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ impl GnosisNode {
where
Node: FullNodeTypes<Engine = EthEngineTypes>,
{
// TODO: fix address
let block_rewards_contract = SYSTEM_ADDRESS;

EthereumNode::components()
.payload(GnosisPayloadServiceBuilder::new(GnosisEvmConfig {
// TODO: fix address
collector_address: SYSTEM_ADDRESS,
}))
.payload(GnosisPayloadServiceBuilder::new(
GnosisEvmConfig {
// TODO: fix address
collector_address: SYSTEM_ADDRESS,
},
block_rewards_contract,
))
.executor(GnosisExecutorBuilder::default())
.consensus(GnosisConsensusBuilder::default())
}
Expand Down
29 changes: 21 additions & 8 deletions src/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ use reth_evm_ethereum::eip6110::parse_deposits_from_receipts;
use reth_node_ethereum::EthEngineTypes;
use reth_provider::{CanonStateSubscriptions, ExecutionOutcome, StateProviderFactory};
use revm::{db::states::bundle_state::BundleRetention, DatabaseCommit, State};
use revm_primitives::{EVMError, EnvWithHandlerCfg, InvalidTransaction, ResultAndState, U256};
use revm_primitives::{
Address, EVMError, EnvWithHandlerCfg, InvalidTransaction, ResultAndState, U256,
};

use crate::{evm_config::GnosisEvmConfig, execute::gnosis_post_block_system_calls};

Expand All @@ -43,12 +45,16 @@ use crate::{evm_config::GnosisEvmConfig, execute::gnosis_post_block_system_calls
pub struct GnosisPayloadServiceBuilder<EVM = GnosisEvmConfig> {
/// The EVM configuration to use for the payload builder.
pub evm_config: EVM,
block_rewards_contract: Address,
}

impl<EVM> GnosisPayloadServiceBuilder<EVM> {
/// Create a new instance with the given evm config.
pub const fn new(evm_config: EVM) -> Self {
Self { evm_config }
pub const fn new(evm_config: EVM, block_rewards_contract: Address) -> Self {
Self {
evm_config,
block_rewards_contract,
}
}
}

Expand All @@ -63,7 +69,8 @@ where
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<PayloadBuilderHandle<Node::Engine>> {
let payload_builder = GnosisPayloadBuilder::new(self.evm_config);
let payload_builder =
GnosisPayloadBuilder::new(self.evm_config, self.block_rewards_contract);
let conf = ctx.payload_builder_config();

let payload_job_config = BasicPayloadJobGeneratorConfig::default()
Expand Down Expand Up @@ -95,11 +102,16 @@ where
pub struct GnosisPayloadBuilder<EvmConfig = GnosisEvmConfig> {
/// The type responsible for creating the evm.
evm_config: EvmConfig,
/// AuRa BlockRewards contract address for its system call
block_rewards_contract: Address,
}

impl<EvmConfig> GnosisPayloadBuilder<EvmConfig> {
pub const fn new(evm_config: EvmConfig) -> Self {
Self { evm_config }
pub const fn new(evm_config: EvmConfig, block_rewards_contract: Address) -> Self {
Self {
evm_config,
block_rewards_contract,
}
}
}

Expand All @@ -117,7 +129,7 @@ where
&self,
args: BuildArguments<Pool, Client, EthPayloadBuilderAttributes, EthBuiltPayload>,
) -> Result<BuildOutcome<EthBuiltPayload>, PayloadBuilderError> {
default_ethereum_payload_builder(self.evm_config.clone(), args)
default_ethereum_payload_builder(self.evm_config.clone(), args, self.block_rewards_contract)
}

fn build_empty_payload(
Expand Down Expand Up @@ -280,6 +292,7 @@ where
pub fn default_ethereum_payload_builder<EvmConfig, Pool, Client>(
evm_config: EvmConfig,
args: BuildArguments<Pool, Client, EthPayloadBuilderAttributes, EthBuiltPayload>,
block_rewards_contract: Address,
) -> Result<BuildOutcome<EthBuiltPayload>, PayloadBuilderError>
where
EvmConfig: ConfigureEvm,
Expand Down Expand Up @@ -499,7 +512,7 @@ where
Some(proofs::calculate_withdrawals_root(&attributes.withdrawals))
};

let balance_incroooooo = gnosis_post_block_system_calls(
gnosis_post_block_system_calls(
&chain_spec,
&evm_config,
&mut db,
Expand Down

0 comments on commit ad5e7bc

Please sign in to comment.