Skip to content

Commit eec5823

Browse files
committed
fix: update tree height
1 parent ef27d87 commit eec5823

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

beacon/beacon_state_top_level_roots.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ type BeaconStateTopLevelRootsElectra struct {
9999

100100
func ProveBeaconTopLevelRootAgainstBeaconState(beaconTopLevelRoots *VersionedBeaconStateTopLevelRoots, index uint64) (common.Proof, error) {
101101
var v reflect.Value
102+
var treeHeight uint64
102103
switch beaconTopLevelRoots.Version {
103104
case spec.DataVersionDeneb:
104105
v = reflect.ValueOf(*beaconTopLevelRoots.Deneb)
106+
treeHeight = BEACON_STATE_TREE_HEIGHT_DENEB
105107
case spec.DataVersionElectra:
106108
v = reflect.ValueOf(*beaconTopLevelRoots.Electra)
109+
treeHeight = BEACON_STATE_TREE_HEIGHT_ELECTRA
107110
default:
108111
return nil, errors.New("unsupported beacon state version")
109112
}
@@ -120,5 +123,5 @@ func ProveBeaconTopLevelRootAgainstBeaconState(beaconTopLevelRoots *VersionedBea
120123
roots[i] = v.(phase0.Root)
121124
}
122125

123-
return common.GetProof(roots, index, BEACON_STATE_TREE_HEIGHT_DENEB)
126+
return common.GetProof(roots, index, treeHeight)
124127
}

beacon/constants.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package beacon
33
const (
44
BEACON_BLOCK_HEADER_NUM_FIELDS = uint64(5)
55

6-
BEACON_BLOCK_HEADER_TREE_HEIGHT = uint64(3)
7-
BEACON_STATE_TREE_HEIGHT_DENEB = uint64(5)
8-
BEACON_STATE_TREE_HEIGHT_PECTRA = uint64(6)
9-
BALANCE_TREE_HEIGHT = uint64(38)
10-
VALIDATOR_TREE_HEIGHT = uint64(40)
6+
BEACON_BLOCK_HEADER_TREE_HEIGHT = uint64(3)
7+
BEACON_STATE_TREE_HEIGHT_DENEB = uint64(5)
8+
BEACON_STATE_TREE_HEIGHT_ELECTRA = uint64(6)
9+
BALANCE_TREE_HEIGHT = uint64(38)
10+
VALIDATOR_TREE_HEIGHT = uint64(40)
1111

1212
STATE_ROOT_INDEX = uint64(3)
1313

0 commit comments

Comments
 (0)