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

Method block

acceptance/src/check.rs:132–146  ·  view source on GitHub ↗

Returns a validated block selected by tag or quantity before `deadline`.

(&self, url: &str, tag: &str, deadline: Instant)

Source from the content-addressed store, hash-verified

130
131 /// Returns a validated block selected by tag or quantity before `deadline`.
132 pub async fn block(&self, url: &str, tag: &str, deadline: Instant) -> Result<ObservedBlock> {
133 let value = self.rpc(url, "eth_getBlockByNumber", json!([tag, false]), deadline).await?;
134 if value.is_null() {
135 bail!("{tag} block is absent");
136 }
137 let block = ObservedBlock {
138 number: Self::hex(value.get("number"))?,
139 timestamp: Self::hex(value.get("timestamp"))?,
140 hash: Self::hash(value.get("hash"))?,
141 };
142 if tag.starts_with("0x") && block.number != Self::hex(Some(&Value::String(tag.into())))? {
143 bail!("RPC returned block {} for requested height {tag}", block.number);
144 }
145 Ok(block)
146 }
147
148 /// Executes one check within both its own and the scenario deadline.
149 ///

Callers 9

commit_built_payloadMethod · 0.45
get_sealed_payloadMethod · 0.45
healthyMethod · 0.45
progressMethod · 0.45
convergeMethod · 0.45
freshMethod · 0.45
open_windowMethod · 0.45
confirm_pre_forkMethod · 0.45
wait_readyMethod · 0.45

Calls 3

hashFunction · 0.50
rpcMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected