Skip to content

Commit d1ed6b6

Browse files
committed
feat(verkle): add parent root to witness & fix proof.
1 parent 7b25809 commit d1ed6b6

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/ethereum_test_specs/blockchain.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,14 @@ def generate_block_data(
607607
)
608608
)
609609
transition_tool_output.alloc = previous_alloc
610+
# TODO: hack for now, replace with actual witness output once available from t8n
610611
if transition_tool_output.result.verkle_conversion_ended:
611-
# TODO: hack for now, replace with actual witness output once available from t8n
612+
witness_parent_root = transition_tool_output.result.parent_root
613+
assert witness_parent_root == header.parent_hash
612614
transition_tool_output.witness = Witness(
613615
verkle_proof=transition_tool_output.result.verkle_proof,
614616
state_diff=transition_tool_output.result.state_diff,
617+
parent_root=witness_parent_root,
615618
)
616619
else:
617620
transition_tool_output.witness = None

src/ethereum_test_types/verkle/tests/test_verkle_witness.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ def witness_data(state_diff_data, verkle_proof_data):
152152
return {
153153
"stateDiff": state_diff_data,
154154
"verkleProof": verkle_proof_data,
155+
"parentRoot": "0x5b5fdfedd6a0e932da408ac7d772a36513d1eee9b9926e52620c43a433aad7",
155156
}
156157

157158

@@ -170,3 +171,6 @@ def test_witness_validation(witness_data):
170171
== 0x647ED3C87A4F764421EA2F5BFC73195812F6B7DD15AC2B8D295730C1DEDE1EDF
171172
)
172173
assert witness.state_diff.root[0].suffix_diffs[0].new_value is None
174+
assert witness.parent_root == (
175+
0x5B5FDFEDD6A0E932DA408AC7D772A36513D1EEE9B9926E52620C43A433AAD7
176+
)

src/ethereum_test_types/verkle/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ethereum_test_base_types import (
1313
Address,
1414
CamelModel,
15-
HexNumber,
15+
ZeroPaddedHexNumber,
1616
PaddedFixedSizeBytes,
1717
)
1818
from ethereum_test_forks import Fork, Verkle
@@ -69,7 +69,7 @@ class VerkleProof(CamelModel):
6969
"""
7070

7171
other_stems: List[Stem]
72-
depth_extension_present: HexNumber
72+
depth_extension_present: ZeroPaddedHexNumber
7373
commitments_by_path: List[Hash]
7474
d: Hash
7575
ipa_proof: IpaProof | None = Field(None)
@@ -143,7 +143,7 @@ class Witness(CamelModel):
143143

144144
state_diff: StateDiff
145145
verkle_proof: VerkleProof
146-
# parent_state_root: Hash
146+
parent_root: Hash
147147

148148

149149
class VerkleTree(RootModel[Dict[Hash, Hash]]):

src/evm_transition_tool/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class Result(CamelModel):
112112

113113
verkle_proof: VerkleProof | None = None
114114
state_diff: StateDiff | None = None
115+
parent_root: Hash | None = None
115116

116117

117118
class TransitionToolInput(CamelModel):

0 commit comments

Comments
 (0)