2023-12-06 09:48:36 +00:00
|
|
|
package state_accessors
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/ledgerwatch/erigon/cl/clparams"
|
|
|
|
"github.com/ledgerwatch/erigon/cl/cltypes"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2023-12-30 19:51:28 +00:00
|
|
|
func TestSlotData(t *testing.T) {
|
|
|
|
m := &SlotData{
|
2023-12-06 09:48:36 +00:00
|
|
|
Version: clparams.CapellaVersion,
|
|
|
|
Eth1Data: &cltypes.Eth1Data{},
|
|
|
|
Eth1DepositIndex: 0,
|
|
|
|
NextWithdrawalIndex: 0,
|
|
|
|
NextWithdrawalValidatorIndex: 0,
|
|
|
|
}
|
|
|
|
var b bytes.Buffer
|
|
|
|
if err := m.WriteTo(&b); err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
2023-12-30 19:51:28 +00:00
|
|
|
m2 := &SlotData{}
|
2023-12-06 09:48:36 +00:00
|
|
|
if err := m2.ReadFrom(&b); err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
require.Equal(t, m, m2)
|
|
|
|
}
|