fix: skip epoch test in 32 bit environment

in 32 environment, ssz.HashTreeRoot() is different with the hash in 64 bit
environment. so in 32 environment, some test will be skipped.
This commit is contained in:
fearlessfe 2024-01-22 22:12:45 +08:00 committed by Chen Kai
parent ee44050195
commit 2652c33d2d
6 changed files with 28 additions and 6 deletions

View file

@ -6,6 +6,7 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/portalnetwork/utils" "github.com/ethereum/go-ethereum/portalnetwork/utils"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
@ -24,8 +25,8 @@ var (
ErrPreMergeHeaderMustWithProof = errors.New("pre merge header must has accumulator proof") ErrPreMergeHeaderMustWithProof = errors.New("pre merge header must has accumulator proof")
) )
//go:embed assets/merge_macc.bin //go:embed assets/merge_macc.txt
var masterAccumulatorBytes []byte var masterAccumulatorHex string
var zeroRecordBytes = make([]byte, 64) var zeroRecordBytes = make([]byte, 64)
@ -240,6 +241,10 @@ func NewMasterAccumulator() (MasterAccumulator, error) {
var masterAcc = MasterAccumulator{ var masterAcc = MasterAccumulator{
HistoricalEpochs: make([][]byte, 0), HistoricalEpochs: make([][]byte, 0),
} }
err := masterAcc.UnmarshalSSZ(masterAccumulatorBytes) masterAccumulatorBytes, err := hexutil.Decode(masterAccumulatorHex)
if err != nil {
return masterAcc, err
}
err = masterAcc.UnmarshalSSZ(masterAccumulatorBytes)
return masterAcc, err return masterAcc, err
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long