mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: Remove ChainSpec from PayloadConfig (#11103)
Co-authored-by: garwah <garwah@garwah> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -45,7 +45,7 @@ use reth_basic_payload_builder::{
|
||||
BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig, BuildArguments, BuildOutcome,
|
||||
PayloadBuilder, PayloadConfig,
|
||||
};
|
||||
use reth_chainspec::{Chain, ChainSpec};
|
||||
use reth_chainspec::{Chain, ChainSpec, ChainSpecProvider};
|
||||
use reth_node_api::{
|
||||
payload::{EngineApiMessageVersion, EngineObjectValidationError, PayloadOrAttributes},
|
||||
validate_version_specific_fields, EngineTypes, EngineValidator, PayloadAttributes,
|
||||
@ -285,7 +285,6 @@ where
|
||||
pool,
|
||||
ctx.task_executor().clone(),
|
||||
payload_job_config,
|
||||
ctx.chain_spec(),
|
||||
payload_builder,
|
||||
);
|
||||
let (payload_service, payload_builder) =
|
||||
@ -304,7 +303,7 @@ pub struct CustomPayloadBuilder;
|
||||
|
||||
impl<Pool, Client> PayloadBuilder<Pool, Client> for CustomPayloadBuilder
|
||||
where
|
||||
Client: StateProviderFactory,
|
||||
Client: StateProviderFactory + ChainSpecProvider<ChainSpec = ChainSpec>,
|
||||
Pool: TransactionPool,
|
||||
{
|
||||
type Attributes = CustomPayloadBuilderAttributes;
|
||||
@ -315,7 +314,9 @@ where
|
||||
args: BuildArguments<Pool, Client, Self::Attributes, Self::BuiltPayload>,
|
||||
) -> Result<BuildOutcome<Self::BuiltPayload>, PayloadBuilderError> {
|
||||
let BuildArguments { client, pool, cached_reads, config, cancel, best_payload } = args;
|
||||
let PayloadConfig { parent_block, extra_data, attributes, chain_spec } = config;
|
||||
let PayloadConfig { parent_block, extra_data, attributes } = config;
|
||||
|
||||
let chain_spec = client.chain_spec();
|
||||
|
||||
// This reuses the default EthereumPayloadBuilder to build the payload
|
||||
// but any custom logic can be implemented here
|
||||
@ -326,12 +327,7 @@ where
|
||||
client,
|
||||
pool,
|
||||
cached_reads,
|
||||
config: PayloadConfig {
|
||||
parent_block,
|
||||
extra_data,
|
||||
attributes: attributes.0,
|
||||
chain_spec,
|
||||
},
|
||||
config: PayloadConfig { parent_block, extra_data, attributes: attributes.0 },
|
||||
cancel,
|
||||
best_payload,
|
||||
})
|
||||
@ -342,9 +338,10 @@ where
|
||||
client: &Client,
|
||||
config: PayloadConfig<Self::Attributes>,
|
||||
) -> Result<Self::BuiltPayload, PayloadBuilderError> {
|
||||
let PayloadConfig { parent_block, extra_data, attributes, chain_spec } = config;
|
||||
let PayloadConfig { parent_block, extra_data, attributes } = config;
|
||||
let chain_spec = client.chain_spec();
|
||||
<reth_ethereum_payload_builder::EthereumPayloadBuilder as PayloadBuilder<Pool, Client>>::build_empty_payload(&reth_ethereum_payload_builder::EthereumPayloadBuilder::new(EthEvmConfig::new(chain_spec.clone())),client,
|
||||
PayloadConfig { parent_block, extra_data, attributes: attributes.0, chain_spec })
|
||||
PayloadConfig { parent_block, extra_data, attributes: attributes.0})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ use reth::{
|
||||
transaction_pool::TransactionPool,
|
||||
};
|
||||
use reth_basic_payload_builder::{BasicPayloadJobGeneratorConfig, PayloadBuilder, PayloadConfig};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_node_api::PayloadBuilderAttributes;
|
||||
use reth_payload_builder::{PayloadBuilderError, PayloadJobGenerator};
|
||||
use reth_primitives::{BlockNumberOrTag, Bytes};
|
||||
@ -22,8 +21,6 @@ pub struct EmptyBlockPayloadJobGenerator<Client, Pool, Tasks, Builder> {
|
||||
executor: Tasks,
|
||||
/// The configuration for the job generator.
|
||||
_config: BasicPayloadJobGeneratorConfig,
|
||||
/// The chain spec.
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
/// The type responsible for building payloads.
|
||||
///
|
||||
/// See [PayloadBuilder]
|
||||
@ -40,10 +37,9 @@ impl<Client, Pool, Tasks, Builder> EmptyBlockPayloadJobGenerator<Client, Pool, T
|
||||
pool: Pool,
|
||||
executor: Tasks,
|
||||
config: BasicPayloadJobGeneratorConfig,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
builder: Builder,
|
||||
) -> Self {
|
||||
Self { client, pool, executor, _config: config, builder, chain_spec }
|
||||
Self { client, pool, executor, _config: config, builder }
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,12 +76,7 @@ where
|
||||
// we already know the hash, so we can seal it
|
||||
block.seal(attributes.parent())
|
||||
};
|
||||
let config = PayloadConfig::new(
|
||||
Arc::new(parent_block),
|
||||
Bytes::default(),
|
||||
attributes,
|
||||
Arc::clone(&self.chain_spec),
|
||||
);
|
||||
let config = PayloadConfig::new(Arc::new(parent_block), Bytes::default(), attributes);
|
||||
Ok(EmptyBlockPayloadJob {
|
||||
client: self.client.clone(),
|
||||
_pool: self.pool.clone(),
|
||||
|
||||
@ -56,7 +56,6 @@ where
|
||||
pool,
|
||||
ctx.task_executor().clone(),
|
||||
payload_job_config,
|
||||
ctx.chain_spec().clone(),
|
||||
reth_ethereum_payload_builder::EthereumPayloadBuilder::new(EthEvmConfig::new(
|
||||
ctx.chain_spec(),
|
||||
)),
|
||||
|
||||
Reference in New Issue
Block a user