Skip to content

Commit

Permalink
Fixed inconsistencies (erigontech#6670)
Browse files Browse the repository at this point in the history
  • Loading branch information
Giulio2002 authored Jan 23, 2023
1 parent 2356b5a commit eda4471
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cl/cltypes/beacon_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func (b *BeaconBody) HashSSZ() ([32]byte, error) {
leaves = append(leaves, aggLeaf)
}
if b.Version >= clparams.BellatrixVersion {
payloadLeaf, err := b.ExecutionPayload.HashSSZ()
payloadLeaf, err := b.ExecutionPayload.HashSSZ(b.Version)
if err != nil {
return [32]byte{}, err
}
Expand Down
2 changes: 1 addition & 1 deletion cl/cltypes/beacon_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ var testBeaconBlockVariation = &cltypes.SignedBeaconBlock{

var (
// Hashes
capellaHash = common.HexToHash("9a5bc717ecaf6a8d6e879478003729b9ce4e71f5c4e9b4bd4dd166780894ee93")
capellaHash = common.HexToHash("0x00a1f1a46f4bcdd9030c11c1cf9a8062cd48478620e6fd3bd3a748263a49433f")
bellatrixHash = common.HexToHash("9a5bc717ecaf6a8d6e879478003729b9ce4e71f5c4e9b4bd4dd166780894ee93")
altairHash = common.HexToHash("36aa8fe956265d171b7ad740077ea9579e25ed3b2f7b2010016513e4ac4754cb")
phase0Hash = common.HexToHash("83dd9e30bf61720822be889abf73760a26fb42dc9fb27fa872f845d68af92bc4")
Expand Down
14 changes: 13 additions & 1 deletion cl/cltypes/eth1_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,19 @@ func (b *Eth1Block) EncodeSSZ(dst []byte, version clparams.StateVersion) ([]byte
return buf, nil
}

func (b *Eth1Block) HashSSZ() ([32]byte, error) {
func (b *Eth1Block) HashSSZ(version clparams.StateVersion) ([32]byte, error) {
var err error
if b.Header.TxHashSSZ, err = merkle_tree.TransactionsListRoot(b.Body.Transactions); err != nil {
return [32]byte{}, err
}
if version >= clparams.CapellaVersion {
b.Header.WithdrawalsHash = new(libcommon.Hash)
if *b.Header.WithdrawalsHash, err = types.Withdrawals(b.Body.Withdrawals).HashSSZ(16); err != nil {
return [32]byte{}, err
}
} else {
b.Header.WithdrawalsHash = nil
}
return b.Header.HashSSZ()
}

Expand Down
1 change: 1 addition & 0 deletions cmd/erigon-cl/core/transition/beacon_state_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var (
Bloom: types.Bloom{},
TxHashSSZ: txHashEmpty,
},
Body: &types.RawBody{},
}
)

Expand Down

0 comments on commit eda4471

Please sign in to comment.