MCPcopy Create free account
hub / github.com/base/base / build_payload

Method build_payload

crates/execution/payload/src/builder.rs:178–213  ·  view source on GitHub ↗
(
        &self,
        args: BuildArguments<Attrs, BaseBuiltPayload<N>>,
        best: impl FnOnce(BestTransactionsAttributes) -> Txs + Send + Sync + 'a,
    )

Source from the content-addressed store, hash-verified

176 fields(payload_id = tracing::field::Empty, parent_num = tracing::field::Empty)
177 )]
178 fn build_payload<'a, Txs>(
179 &self,
180 args: BuildArguments<Attrs, BaseBuiltPayload<N>>,
181 best: impl FnOnce(BestTransactionsAttributes) -> Txs + Send + Sync + 'a,
182 ) -> Result<BuildOutcome<BaseBuiltPayload<N>>, PayloadBuilderError>
183 where
184 Txs: PayloadTransactions<
185 Transaction: PoolTransaction<Consensus = N::SignedTx> + BasePooledTx,
186 >,
187 {
188 let BuildArguments { mut cached_reads, config, cancel, best_payload, .. } = args;
189
190 let ctx = BasePayloadBuilderCtx {
191 evm_config: self.evm_config.clone(),
192 builder_config: self.config.clone(),
193 chain_spec: self.client.chain_spec(),
194 config,
195 cancel,
196 best_payload,
197 };
198 tracing::Span::current().record("payload_id", tracing::field::display(ctx.payload_id()));
199 tracing::Span::current().record("parent_num", ctx.parent().number());
200
201 let builder = Builder::new(best);
202
203 let state_provider = self.client.state_by_block_hash(ctx.parent().hash())?;
204 let state = StateProviderDatabase::new(&state_provider);
205
206 if ctx.attributes().no_tx_pool() {
207 builder.build(state, &state_provider, ctx)
208 } else {
209 // sequencer mode we can reuse cachedreads from previous runs
210 builder.build(cached_reads.as_db_mut(state), &state_provider, ctx)
211 }
212 .map(|out| out.with_cached_reads(cached_reads))
213 }
214
215 /// Computes the witness for the payload.
216 pub fn payload_witness(

Callers 2

try_buildMethod · 0.45
build_empty_payloadMethod · 0.45

Calls 10

no_tx_poolMethod · 0.80
cloneMethod · 0.45
chain_specMethod · 0.45
recordMethod · 0.45
payload_idMethod · 0.45
numberMethod · 0.45
parentMethod · 0.45
hashMethod · 0.45
attributesMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected