@@ -9,6 +9,40 @@ Library for accessing block hashes way beyond the 256-block limit.
99
1010<!-- customintro:start --> <!-- customintro:end -->
1111
12+ ## Structs
13+
14+ ### ShortHeader
15+
16+ ``` solidity
17+ struct ShortHeader {
18+ bytes32 parentHash;
19+ bytes32 stateRoot;
20+ bytes32 transactionsRoot;
21+ bytes32 receiptsRoot;
22+ bytes32[8] logsBloom;
23+ }
24+ ```
25+
26+ Ethereum block header fields relevant to historical MPT proofs.
27+
28+ ## Custom Errors
29+
30+ ### BlockHashMismatch()
31+
32+ ``` solidity
33+ error BlockHashMismatch()
34+ ```
35+
36+ The keccak256 of the RLP-encoded block header does not equal to the block hash.
37+
38+ ### InvalidBlockHeaderEncoding()
39+
40+ ``` solidity
41+ error InvalidBlockHeaderEncoding()
42+ ```
43+
44+ The block header is not properly RLP-encoded.
45+
1246## Constants
1347
1448### HISTORY_STORAGE_ADDRESS
@@ -34,4 +68,34 @@ function blockHash(uint256 blockNumber)
3468
3569Retrieves the block hash for any historical block within the supported range.
3670The function gracefully handles future blocks and blocks beyond the history window by returning zero,
37- consistent with the EVM's native ` BLOCKHASH ` behavior.
71+ consistent with the EVM's native ` BLOCKHASH ` behavior.
72+
73+ ### verifyBlock(bytes,uint256)
74+
75+ ``` solidity
76+ function verifyBlock(bytes calldata encodedHeader, uint256 blockNumber)
77+ internal
78+ view
79+ returns (bytes32 result)
80+ ```
81+
82+ Reverts if ` keccak256(encodedHeader) != blockHash(blockNumber) ` ,
83+ where ` encodedHeader ` is a RLP-encoded block header.
84+ Else, returns ` blockHash(blockNumber) ` .
85+
86+ ### toShortHeader(bytes)
87+
88+ ``` solidity
89+ function toShortHeader(bytes calldata encodedHeader)
90+ internal
91+ pure
92+ returns (ShortHeader memory result)
93+ ```
94+
95+ Retrieves the most relevant fields for MPT proofs from an RLP-encoded block header.
96+ Leading fields are always present and have fixed offsets and lengths.
97+ This function efficiently extracts the fields without full RLP decoding.
98+ For the specification of field order and lengths, please refer to
99+ prefix. 6 of the Ethereum Yellow Paper:
100+ (https://ethereum.github.io/yellowpaper/paper.pdf )
101+ and the Ethereum Wiki (https://epf.wiki/#/wiki/EL/RLP).
0 commit comments