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

Method execute_payload

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

Source from the content-addressed store, hash-verified

193 + 'static,
194{
195 async fn execute_payload(
196 &self,
197 parent_block_hash: B256,
198 attributes: Attrs::RpcPayloadAttributes,
199 ) -> RpcResult<ExecutionWitness> {
200 DebugApiExtMetrics::record_operation_async(DebugApis::DebugExecutePayload, async {
201 let _permit = self.inner.semaphore.acquire().await;
202
203 let parent_header = self.parent_header(parent_block_hash).to_rpc_result()?;
204
205 // Cancels the blocking task if this future is dropped (e.g. the client disconnected).
206 let cancel = CancelOnDrop::default();
207 let task_cancel = cancel.clone();
208 let (tx, rx) = oneshot::channel();
209 let this = Arc::clone(&self.inner);
210 let eth_api = self.inner.eth_api.provider().clone();
211 self.inner.task_spawner.spawn_blocking_task(async move {
212 let result = async {
213 let parent_hash = parent_header.hash();
214 let attributes = Attrs::try_new(parent_hash, attributes, PAYLOAD_ID_VERSION)
215 .map_err(PayloadBuilderError::other)?;
216 let payload_id = attributes.payload_job_id();
217
218 let config =
219 PayloadConfig::new(Arc::new(parent_header), attributes, payload_id);
220 let ctx = BasePayloadBuilderCtx {
221 evm_config: this.evm_config.clone(),
222 chain_spec: this.provider.chain_spec(),
223 config,
224 cancel: task_cancel,
225 best_payload: Default::default(),
226 builder_config: Default::default(),
227 };
228
229 let state_provider = this
230 .state_provider_factory
231 .state_provider(Some(BlockId::Hash(parent_hash.into())))
232 .await
233 .map_err(PayloadBuilderError::other)?;
234
235 let builder = Builder::new(|_, _| {
236 NoopPayloadTransactions::<BasePooledTransaction>::default()
237 });
238
239 builder
240 .witness(state_provider, eth_api, &ctx)
241 .map_err(PayloadBuilderError::other)
242 };
243
244 let _ = tx.send(result.await);
245 });
246
247 rx.await
248 .map_err(|err| internal_rpc_err(err.to_string()))?
249 .map_err(|err| internal_rpc_err(err.to_string()))
250 })
251 .await
252 }

Callers

nothing calls this directly

Calls 12

payload_job_idMethod · 0.80
state_providerMethod · 0.80
channelFunction · 0.50
newFunction · 0.50
acquireMethod · 0.45
parent_headerMethod · 0.45
cloneMethod · 0.45
providerMethod · 0.45
hashMethod · 0.45
chain_specMethod · 0.45
witnessMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected