Headers store
Each supported chain has its headers reflected in the storage of this contract state.
These headers can be added only if the header
parentHash
has already been passed to the CommitmentsInbox
.Headers can be submitted by anyone, a header is only valid if it's hash computed on chain matches the hash attested previously by the
CommitmentsInbox
.Each time a headers is processed it's parent hash will be saved in the contract state in order to enable the previous header in the chain to be processed the same way.
When processing a block, it's parameters can be saved in the smart contracts state.
Each blockchain contains different parameters in its header. For instance, an EVM header on Ethereum L1 contains the following properties:
baseFeePerGas
difficulty
extraData
gasLimit
gasUsed
parentHash
receiptsRoot
transactionsRoot
stateRoot
timestamp
logsBloom
nonce
miner
mixHash
sha3Uncles
number
extraData
Specifying the parameters that must be saved occurs by passing an integer value which encodes a map from the parameter index to whether it should be saved or not.
The indexes for each parameter are:
PARENT_HASH = 0
UNCLES_HASH = 1
MINER = 2
STATE_ROOT = 3
TRANSACTION_ROOT = 4
RECEIPTS_ROOT = 5
LOGS_BLOOM = 6
DIFFICULTY = 7
BLOCK_NUMBER = 8
GAS_LIMIT = 9
GAS_USED = 10
TIMESTAMP = 11
EXTRA_DATA = 12
MIX_HASH = 13
NONCE = 14
BASE_FEE = 15
For example, in order to set only the state root, the value for that parameter would be
8
as its binary representation is 000000000001000
. Which equals to 2**3
where 3
is the index of the state root. Last modified 7mo ago