@@ -27,12 +27,12 @@ pub enum Error<P: Platform> {
2727/// payload state transition checkpoints.
2828///
2929/// Usually instances of this type are created once as a response to CL client
30- /// `ForkchoiceUpdated` requests with `PayloadAttributes` that signals the need
31- /// to start constructing a new payload on top of a given block, then different
32- /// versions of payload checkpoints are created on top of this instance using
33- /// the [`BlockContext::start`] method.
30+ /// `ForkchoiceUpdated` requests with `PayloadAttributes`.
31+ /// This signals the need to start constructing a new payload on top of a given
32+ /// block. Then different versions of payload checkpoints are created on top of
33+ /// this instance using the [`BlockContext::start`] method.
3434///
35- /// This type is cheap to clone.
35+ /// This type is inexpensive to clone.
3636pub struct BlockContext < P : Platform > {
3737 inner : Arc < BlockContextInner < P > > ,
3838}
@@ -47,27 +47,30 @@ impl<P: Platform> Clone for BlockContext<P> {
4747
4848/// Constructors
4949impl < P : Platform > BlockContext < P > {
50- /// To create a new block context we need:
50+ /// To create a new [`BlockContext`], we need:
5151 /// - The parent block header on top of which we are building this block.
5252 /// - The payload builder attributes for the next block. This usually comes
53- /// from [`reth_payload_builder::JobGenerator:: new_payload_job`] as a
54- /// response to Engine API forkchoiceUpdated requests.
53+ /// from [`PayloadJobGenerator:: new_payload_job`] as a response to Engine
54+ /// API `ForkchoiceUpdated` requests.
5555 /// - The state of the chain at the parent block. This can be acquired from
56- /// `StateProviderFactory::state_by_block_hash(parent)`.
56+ /// [ `StateProviderFactory::state_by_block_hash`]
5757 /// - The chainspec of the chain we're building for.
58+ ///
59+ /// [`PayloadJobGenerator::new_payload_job`]: reth_payload_builder::PayloadJobGenerator::new_payload_job
60+ /// [`StateProviderFactory::state_by_block_hash`]: reth::providers::StateProviderFactory::state_by_block_hash
5861 pub fn new (
5962 parent : SealedHeader < types:: Header < P > > ,
6063 attribs : types:: PayloadBuilderAttributes < P > ,
6164 base_state : StateProviderBox ,
6265 chainspec : Arc < types:: ChainSpec < P > > ,
6366 ) -> Result < Self , Error < P > > {
64- let evm_config = P :: evm_config :: < P > ( Arc :: clone ( & chainspec) ) ;
6567 let block_env = P :: next_block_environment_context :: < P > (
6668 & chainspec,
6769 parent. header ( ) ,
68- & attribs, //
70+ & attribs,
6971 ) ;
7072
73+ let evm_config = P :: evm_config :: < P > ( Arc :: clone ( & chainspec) ) ;
7174 let evm_env = evm_config
7275 . next_evm_env ( & parent, & block_env)
7376 . map_err ( Error :: EvmEnv ) ?;
@@ -105,8 +108,8 @@ impl<P: Platform> BlockContext<P> {
105108 & self . inner . parent
106109 }
107110
108- /// Returns the payload attributes that were supplied by the CL client
109- /// during the `ForkchoiceUpdated` request.
111+ /// Returns the payload attributes supplied by the CL client during the
112+ /// `ForkchoiceUpdated` request.
110113 pub fn attributes ( & self ) -> & types:: PayloadBuilderAttributes < P > {
111114 & self . inner . attribs
112115 }
@@ -118,13 +121,13 @@ impl<P: Platform> BlockContext<P> {
118121 self . inner . base_state . database . as_ref ( )
119122 }
120123
121- /// Returns the EVM configuration that is used to create EVM instances
122- /// for executing transactions in the payload under construction.
124+ /// Returns the EVM configuration used to create EVM instances for executing
125+ /// transactions in the payload under construction.
123126 pub fn evm_config ( & self ) -> & P :: EvmConfig {
124127 & self . inner . evm_config
125128 }
126129
127- /// Returns a evm environment preconfigured for executing transactions in
130+ /// Returns an evm environment preconfigured for executing transactions in
128131 /// the payload under construction.
129132 pub fn evm_env ( & self ) -> & types:: EvmEnv < P > {
130133 & self . inner . evm_env
@@ -137,7 +140,7 @@ impl<P: Platform> BlockContext<P> {
137140 & self . inner . block_env
138141 }
139142
140- /// Returns the chainspec that defines the chain and fork specific parameters
143+ /// Returns the chainspec that defines the chain- and fork- specific parameters
141144 /// that are used to configure the EVM environment and the next block
142145 /// environment for the block that is being built.
143146 pub fn chainspec ( & self ) -> & Arc < types:: ChainSpec < P > > {
@@ -168,9 +171,9 @@ struct BlockContextInner<P: Platform> {
168171 /// during the `ForkchoiceUpdated` request.
169172 attribs : types:: PayloadBuilderAttributes < P > ,
170173
171- /// Context object for constucting evm instance for the block that is being
172- /// built. We use this context to apply any chain and fork specific state
173- /// updates that are defined in the chainspec.
174+ /// Context object for constructing evm instance for the block being built.
175+ /// We use this context to apply any chain- and fork- specific state updates
176+ /// that are defined in the chainspec.
174177 evm_env : types:: EvmEnv < P > ,
175178
176179 /// Context required for configuring this block environment.
0 commit comments