Commit ae01431
committed
fix(v2/chain): use actual parent consensus hash instead of slot-derived value
The V2 block production pipeline was incorrectly setting ConsensusBlock.parent_hash
to a slot-derived value (Hash256::from_low_u64_be(slot - 1)) instead of querying
the actual parent block's consensus hash from storage.
This caused block import failures with "Parent block not found" errors because:
1. Producer node creates block with fake derived parent hash (e.g., 0x0000...0b04)
2. Receiver node queries storage for parent by that hash
3. Storage lookup fails - the derived value doesn't match any real block hash
4. Block import rejected, breaking cross-node block propagation
Changes:
- Modified block production to capture both parent hashes from StorageActor:
* parent_execution_hash: Used for Geth forkchoice (execution layer)
* parent_consensus_hash: Used for ConsensusBlock.parent_hash (consensus layer)
- Updated ConsensusBlock creation to use actual parent_consensus_hash
- Matches V0 behavior where ConsensusBlock.parent_hash references real parent block
Impact:
- Fixes 100% block import failure rate between nodes
- Enables proper blockchain synchronization in multi-node networks
- Maintains correct parent-child relationships in consensus layer1 parent 9eba73e commit ae01431
1 file changed
+10
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
101 | | - | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | | - | |
106 | | - | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
110 | | - | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
193 | 195 | | |
194 | 196 | | |
195 | 197 | | |
196 | | - | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | | - | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| |||
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
271 | | - | |
272 | | - | |
273 | | - | |
| 273 | + | |
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| |||
0 commit comments