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

Method get_l2_block

actions/harness/src/engine.rs:657–687  ·  view source on GitHub ↗
(&self, block: BlockId)

Source from the content-addressed store, hash-verified

655 }
656
657 fn get_l2_block(&self, block: BlockId) -> EthGetBlock<<Base as Network>::BlockResponse> {
658 let inner = Arc::clone(&self.inner);
659 let block_id = block;
660 EthGetBlock::new_provider(
661 block,
662 Box::new(move |_kind| {
663 let inner = Arc::clone(&inner);
664 ProviderCall::BoxedFuture(Box::pin(async move {
665 let guard = inner.lock().expect("action engine inner lock poisoned");
666 let rpc_block = match block_id {
667 BlockId::Number(num_or_tag) => {
668 let number = match num_or_tag {
669 BlockNumberOrTag::Number(n) => n,
670 _ => return Ok(None),
671 };
672 guard
673 .executed_headers
674 .get(&number)
675 .map(|h| Self::header_to_l2_rpc_block(h, h.hash_slow()))
676 }
677 BlockId::Hash(block_hash) => guard
678 .executed_headers
679 .values()
680 .find(|h| h.hash_slow() == block_hash.block_hash)
681 .map(|h| Self::header_to_l2_rpc_block(h, h.hash_slow())),
682 };
683 Ok(rpc_block)
684 }))
685 }),
686 )
687 }
688
689 fn get_proof(
690 &self,

Callers

nothing calls this directly

Calls 3

lockMethod · 0.80
hash_slowMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected