1
1
use crate :: {
2
- builders:: {
3
- BuilderConfig , OpPayloadBuilderCtx ,
4
- flashblocks:: { FlashblocksConfig , payload:: FlashblocksExtraCtx } ,
5
- } ,
2
+ builders:: { BuilderConfig , OpPayloadBuilderCtx , flashblocks:: FlashblocksConfig } ,
6
3
gas_limiter:: AddressGasLimiter ,
7
4
metrics:: OpRBuilderMetrics ,
8
5
traits:: ClientBounds ,
9
6
} ;
10
- use eyre:: WrapErr as _;
11
7
use op_revm:: OpSpecId ;
12
8
use reth_basic_payload_builder:: PayloadConfig ;
13
- use reth_evm:: { ConfigureEvm as _ , EvmEnv } ;
14
- use reth_optimism_chainspec:: { OpChainSpec , OpHardforks as _ } ;
9
+ use reth_evm:: EvmEnv ;
10
+ use reth_optimism_chainspec:: OpChainSpec ;
15
11
use reth_optimism_evm:: { OpEvmConfig , OpNextBlockEnvAttributes } ;
16
12
use reth_optimism_payload_builder:: { OpPayloadBuilderAttributes , config:: OpDAConfig } ;
17
13
use reth_optimism_primitives:: OpTransactionSigned ;
18
- use reth_payload_primitives:: PayloadBuilderAttributes as _;
19
14
use std:: sync:: Arc ;
20
15
use tokio_util:: sync:: CancellationToken ;
21
16
22
- #[ derive( Debug ) ]
17
+ #[ derive( Debug , Clone ) ]
23
18
pub ( super ) struct OpPayloadSyncerCtx {
24
19
/// The type that knows how to perform system calls and configure the evm.
25
- pub evm_config : OpEvmConfig ,
20
+ evm_config : OpEvmConfig ,
26
21
/// The DA config for the payload builder
27
- pub da_config : OpDAConfig ,
22
+ da_config : OpDAConfig ,
28
23
/// The chainspec
29
- pub chain_spec : Arc < OpChainSpec > ,
30
- // /// How to build the payload.
31
- // pub config: PayloadConfig<OpPayloadBuilderAttributes<OpTransactionSigned>>,
32
- /// Block env attributes for the current block.
33
- //pub block_env_attributes: OpNextBlockEnvAttributes,
34
- /// Marker to check whether the job has been cancelled.
35
- //pub cancel: CancellationToken,
36
- /// Extra context for the payload builder
37
- pub extra_ctx : FlashblocksExtraCtx ,
24
+ chain_spec : Arc < OpChainSpec > ,
38
25
/// Max gas that can be used by a transaction.
39
- pub max_gas_per_txn : Option < u64 > ,
26
+ max_gas_per_txn : Option < u64 > ,
40
27
}
41
28
42
29
impl OpPayloadSyncerCtx {
30
+ pub ( super ) fn new < Client > (
31
+ client : & Client ,
32
+ builder_config : BuilderConfig < FlashblocksConfig > ,
33
+ evm_config : OpEvmConfig ,
34
+ ) -> eyre:: Result < Self >
35
+ where
36
+ Client : ClientBounds ,
37
+ {
38
+ let chain_spec = client. chain_spec ( ) ;
39
+ Ok ( Self {
40
+ evm_config,
41
+ da_config : builder_config. da_config . clone ( ) ,
42
+ chain_spec,
43
+ max_gas_per_txn : builder_config. max_gas_per_txn ,
44
+ } )
45
+ }
46
+
47
+ pub ( super ) fn evm_config ( & self ) -> & OpEvmConfig {
48
+ & self . evm_config
49
+ }
50
+
43
51
pub ( super ) fn into_op_payload_builder_ctx (
44
52
self ,
45
53
payload_config : PayloadConfig < OpPayloadBuilderAttributes < OpTransactionSigned > > ,
@@ -65,60 +73,3 @@ impl OpPayloadSyncerCtx {
65
73
}
66
74
}
67
75
}
68
-
69
- pub ( super ) fn get_op_payload_syncer_ctx < Client > (
70
- client : Client ,
71
- evm_config : OpEvmConfig ,
72
- builder_config : BuilderConfig < FlashblocksConfig > ,
73
- // address_gas_limiter: AddressGasLimiter,
74
- // config: reth_basic_payload_builder::PayloadConfig<
75
- // OpPayloadBuilderAttributes<op_alloy_consensus::OpTxEnvelope>,
76
- // >,
77
- extra_ctx : FlashblocksExtraCtx ,
78
- ) -> OpPayloadSyncerCtx
79
- where
80
- Client : ClientBounds ,
81
- {
82
- let chain_spec = client. chain_spec ( ) ;
83
- // let timestamp = config.attributes.timestamp();
84
- // let block_env_attributes = OpNextBlockEnvAttributes {
85
- // timestamp,
86
- // suggested_fee_recipient: config.attributes.suggested_fee_recipient(),
87
- // prev_randao: config.attributes.prev_randao(),
88
- // gas_limit: config
89
- // .attributes
90
- // .gas_limit
91
- // .unwrap_or(config.parent_header.gas_limit),
92
- // parent_beacon_block_root: config
93
- // .attributes
94
- // .payload_attributes
95
- // .parent_beacon_block_root,
96
- // extra_data: if chain_spec.is_holocene_active_at_timestamp(timestamp) {
97
- // config
98
- // .attributes
99
- // .get_holocene_extra_data(chain_spec.base_fee_params_at_timestamp(timestamp))
100
- // .wrap_err("failed to get holocene extra data for flashblocks payload builder")?
101
- // } else {
102
- // Default::default()
103
- // },
104
- // };
105
-
106
- // let evm_env = evm_config
107
- // .next_evm_env(&config.parent_header, &block_env_attributes)
108
- // .wrap_err("failed to create next evm env")?;
109
-
110
- OpPayloadSyncerCtx {
111
- evm_config : evm_config. clone ( ) ,
112
- da_config : builder_config. da_config . clone ( ) ,
113
- chain_spec,
114
- //config,
115
- // evm_env,
116
- // block_env_attributes,
117
- // cancel,
118
- // builder_signer: builder_config.builder_signer,
119
- // metrics: Default::default(),
120
- extra_ctx,
121
- max_gas_per_txn : builder_config. max_gas_per_txn ,
122
- //address_gas_limiter,
123
- }
124
- }
0 commit comments