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

Method execute_payload

crates/execution/rpc/src/debug.rs:189–240  ·  view source on GitHub ↗
(
        &self,
        parent_block_hash: B256,
        attributes: Attrs::RpcPayloadAttributes,
    )

Source from the content-addressed store, hash-verified

187 + 'static,
188{
189 async fn execute_payload(
190 &self,
191 parent_block_hash: B256,
192 attributes: Attrs::RpcPayloadAttributes,
193 ) -> RpcResult<ExecutionWitness> {
194 DebugApiExtMetrics::record_operation_async(DebugApis::DebugExecutePayload, async {
195 let _permit = self.inner.semaphore.acquire().await;
196
197 let parent_header = self.parent_header(parent_block_hash).to_rpc_result()?;
198
199 let (tx, rx) = oneshot::channel();
200 let this = Arc::clone(&self.inner);
201 self.inner.task_spawner.spawn_blocking_task(async move {
202 let result = async {
203 let parent_hash = parent_header.hash();
204 let attributes = Attrs::try_new(parent_hash, attributes, 3)
205 .map_err(PayloadBuilderError::other)?;
206 let payload_id = attributes.payload_job_id();
207
208 let config =
209 PayloadConfig::new(Arc::new(parent_header), attributes, payload_id);
210 let ctx = BasePayloadBuilderCtx {
211 evm_config: this.evm_config.clone(),
212 chain_spec: this.provider.chain_spec(),
213 config,
214 cancel: Default::default(),
215 best_payload: Default::default(),
216 builder_config: Default::default(),
217 };
218
219 let state_provider = this
220 .state_provider_factory
221 .state_provider(Some(BlockId::Hash(parent_hash.into())))
222 .await
223 .map_err(PayloadBuilderError::other)?;
224
225 let builder = Builder::new(|_| {
226 NoopPayloadTransactions::<BasePooledTransaction>::default()
227 });
228
229 builder.witness(state_provider, &ctx).map_err(PayloadBuilderError::other)
230 };
231
232 let _ = tx.send(result.await);
233 });
234
235 rx.await
236 .map_err(|err| internal_rpc_err(err.to_string()))?
237 .map_err(|err| internal_rpc_err(err.to_string()))
238 })
239 .await
240 }
241
242 async fn execution_witness(&self, block_id: BlockNumberOrTag) -> RpcResult<ExecutionWitness> {
243 DebugApiExtMetrics::record_operation_async(DebugApis::DebugExecutionWitness, async {

Callers

nothing calls this directly

Calls 9

acquireMethod · 0.80
payload_job_idMethod · 0.80
state_providerMethod · 0.80
parent_headerMethod · 0.45
hashMethod · 0.45
cloneMethod · 0.45
chain_specMethod · 0.45
witnessMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected