mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
190bc9dfd8
Implement https://github.com/ethereum/EIPs/pull/7062 and https://github.com/ethereum/EIPs/pull/7095. Pick up https://github.com/ledgerwatch/erigon-lib/pull/1006.
29 lines
871 B
Go
29 lines
871 B
Go
package ssz2_test
|
|
|
|
import (
|
|
_ "embed"
|
|
"testing"
|
|
|
|
"github.com/ledgerwatch/erigon-lib/common"
|
|
"github.com/ledgerwatch/erigon/cl/clparams"
|
|
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
|
|
"github.com/ledgerwatch/erigon/cl/utils"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
//go:embed testdata/serialized.ssz_snappy
|
|
var beaconState []byte
|
|
|
|
func TestEncodeDecode(t *testing.T) {
|
|
t.Skip("Need to update due to data_gas_used")
|
|
bs := state.New(&clparams.MainnetBeaconConfig)
|
|
require.NoError(t, utils.DecodeSSZSnappy(bs, beaconState, int(clparams.DenebVersion)))
|
|
root, err := bs.HashSSZ()
|
|
require.NoError(t, err)
|
|
require.Equal(t, common.Hash(root), common.HexToHash("0x7d085d9f2cce04eefb4c0aafad744fd2ce4ff962b2c3589fda53aab084171406"))
|
|
d, err := bs.EncodeSSZ(nil)
|
|
require.NoError(t, err)
|
|
dec, _ := utils.DecompressSnappy(beaconState)
|
|
require.Equal(t, dec, d)
|
|
}
|