-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Current Behavior
When calculating the genesis hash as previous hash of block 1, the transactions root is not set.
I'm not sure whether there is any transactions in genesis block.
But, even there is no transactions, the transactions root still could NOT be zeros, since there is a default value RLP_NULL.
axon/core/consensus/src/engine.rs
Lines 73 to 79 in 8f3eded
| let txs_root = if !txs.hashes.is_empty() { | |
| TrieMerkle::from_iter(txs.hashes.iter().enumerate()) | |
| .root_hash() | |
| .unwrap_or_default() | |
| } else { | |
| RLP_NULL | |
| }; |
axon/protocol/src/types/primitive.rs
Lines 33 to 36 in 8f3eded
| pub const RLP_NULL: H256 = H256([ | |
| 0x56, 0xe8, 0x1f, 0x17, 0x1b, 0xcc, 0x55, 0xa6, 0xff, 0x83, 0x45, 0xe6, 0x92, 0xc0, 0xf8, 0x6e, | |
| 0x5b, 0x48, 0xe0, 0x1b, 0x99, 0x6c, 0xad, 0xc0, 0x01, 0x62, 0x2f, 0xb5, 0xe3, 0x63, 0xb4, 0x21, | |
| ]); |
Expected Behavior
Transactions root in genesis block should follow the consensus rules.
As a comparison, the receipts root and state root are refreshed before saved.
Lines 168 to 172 in 8f3eded
| self.apply_genesis_data(resp.state_root, resp.receipt_root)?; | |
| log::info!("The genesis block is created {:?}", self.genesis.block); | |
| save_block(storage, &self.genesis).await?; |
OS
Not Associated
Axon version
v0.1.0-beta.5
Kernel
Not Associated
Relevant log output
No response
Anything else?
Sadly, if it has a fix, the fix will be a break change.
And, please check all of the following fields again:
axon/devtools/chain/genesis_single_node.json
Lines 4 to 29 in 8f3eded
| "prev_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
| "proposer": "0x0000000000000000000000000000000000000000", | |
| "state_root": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
| "transactions_root": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
| "signed_txs_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
| "receipts_root": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
| "log_bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | |
| "difficulty": "0x0", | |
| "timestamp": 1679656015, | |
| "number": 0, | |
| "gas_used": "0x0", | |
| "gas_limit": "0x0", | |
| "extra_data": [], | |
| "mixed_hash": null, | |
| "nonce": "0x0000000000000000", | |
| "base_fee_per_gas": "0x539", | |
| "proof": { | |
| "number": 0, | |
| "round": 0, | |
| "block_hash": "0x0000000000000000000000000000000000000000000000000000000000000000", | |
| "signature": [], | |
| "bitmap": [] | |
| }, | |
| "call_system_script_count": 0, | |
| "chain_id": 2022 | |
| }, |
Which fields should be reset after the genesis block executed?
Select them in the following list:
- version
- prev_hash
- proposer
- state_root
- transactions_root
- signed_txs_hash
- receipts_root
- log_bloom
- difficulty
- timestamp
- number
- gas_used
- gas_limit
- extra_data
- mixed_hash
- nonce
- base_fee_per_gas
- proof
- call_system_script_count
- chain_id