1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! # Block Header Subqueries Circuit
//!
//! | Block Header Field | Max bytes |
//! |---------------------------|---------------|
//! | parentHash | 32 |
//! | ommersHash | 32 |
//! | beneficiary | 20 |
//! | stateRoot | 32 |
//! | transactionsRoot | 32 |
//! | receiptsRoot | 32 |
//! | logsBloom | 256 |
//! | difficulty | ≤7 |
//! | number | ≤4 |
//! | gasLimit | ≤4 |
//! | gasUsed | ≤4 |
//! | timestamp | ≤4 |
//! | extraData | ≤32 (mainnet) |
//! | mixHash | 32 |
//! | nonce | 8 |
//! | basefee (post-1559) | ≤32 or 0 |
//! | withdrawalsRoot (post-4895) | 32 or 0 |
//!
//! Header subquery
//! - `blockNumber` (uint32)
//! - `fieldIdx` (uint32)
//! - If the `fieldIdx` corresponds to `logsBloom`,
//! the `result` will be only the first 32 bytes.
//! We will add a special `LOGS_BLOOM_FIELD_IDX` so that if
//! `fieldIdx = LOGS_BLOOM_FIELD_IDX + logsBloomIdx`,
//! the result will be bytes `[32 * logsBloomIdx, 32 * logsBloomIdx + 32)`
//! for `logsBloomIdx` in `[0, 8)`.
//!
//! **Note:** We will always truncate `extraData` to 32 bytes
//! (for Goerli `extraData` can be longer, but we ignore the extra bytes).
/// Circuit and Component Implementation.
/// Verify all block hashes against a given Merkle Mountain Range. Used in [circuit]
/// Types
pub const MMR_MAX_NUM_PEAKS: usize = 32; // assuming block number stays in u32, < 2^32