2023-06-11 21:50:02 +00:00
|
|
|
package eth2_test
|
2023-05-23 18:58:34 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
_ "embed"
|
|
|
|
"testing"
|
|
|
|
|
2023-06-14 03:01:00 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
2023-05-23 18:58:34 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/clparams"
|
|
|
|
"github.com/ledgerwatch/erigon/cl/cltypes"
|
|
|
|
"github.com/ledgerwatch/erigon/cl/phase1/core/state"
|
2023-06-14 03:01:00 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/transition"
|
2023-05-23 18:58:34 +00:00
|
|
|
"github.com/ledgerwatch/erigon/cl/utils"
|
|
|
|
)
|
|
|
|
|
2023-06-11 21:50:02 +00:00
|
|
|
//go:embed statechange/test_data/block_processing/capella_block.ssz_snappy
|
2023-06-03 22:36:16 +00:00
|
|
|
var capellaBlock []byte
|
2023-05-23 18:58:34 +00:00
|
|
|
|
2023-06-11 21:50:02 +00:00
|
|
|
//go:embed statechange/test_data/block_processing/capella_state.ssz_snappy
|
2023-06-03 22:36:16 +00:00
|
|
|
var capellaState []byte
|
2023-05-23 18:58:34 +00:00
|
|
|
|
2023-06-03 22:36:16 +00:00
|
|
|
func TestBlockProcessing(t *testing.T) {
|
2023-06-11 21:50:02 +00:00
|
|
|
s := state.New(&clparams.MainnetBeaconConfig)
|
|
|
|
require.NoError(t, utils.DecodeSSZSnappy(s, capellaState, int(clparams.CapellaVersion)))
|
2023-05-23 18:58:34 +00:00
|
|
|
block := &cltypes.SignedBeaconBlock{}
|
2023-06-03 22:36:16 +00:00
|
|
|
require.NoError(t, utils.DecodeSSZSnappy(block, capellaBlock, int(clparams.CapellaVersion)))
|
2023-06-11 21:50:02 +00:00
|
|
|
require.NoError(t, transition.TransitionState(s, block, true)) // All checks already made in transition state
|
2023-05-23 18:58:34 +00:00
|
|
|
}
|