diff --git a/beacon-chain/blockchain/head_test.go b/beacon-chain/blockchain/head_test.go index 27e136967..a37c860bc 100644 --- a/beacon-chain/blockchain/head_test.go +++ b/beacon-chain/blockchain/head_test.go @@ -55,7 +55,7 @@ func TestSaveHead_Different(t *testing.T) { require.NoError(t, err) assert.DeepEqual(t, cachedRoot, newRoot[:], "Head did not change") assert.DeepEqual(t, newHeadSignedBlock, service.headBlock(), "Head did not change") - assert.DeepEqual(t, headState.CloneInnerState(), service.headState(ctx).CloneInnerState(), "Head did not change") + assert.DeepSSZEqual(t, headState.CloneInnerState(), service.headState(ctx).CloneInnerState(), "Head did not change") } func TestSaveHead_Different_Reorg(t *testing.T) { @@ -91,7 +91,7 @@ func TestSaveHead_Different_Reorg(t *testing.T) { t.Error("Head did not change") } assert.DeepEqual(t, newHeadSignedBlock, service.headBlock(), "Head did not change") - assert.DeepEqual(t, headState.CloneInnerState(), service.headState(ctx).CloneInnerState(), "Head did not change") + assert.DeepSSZEqual(t, headState.CloneInnerState(), service.headState(ctx).CloneInnerState(), "Head did not change") require.LogsContain(t, hook, "Chain reorg occurred") } diff --git a/beacon-chain/blockchain/process_attestation_test.go b/beacon-chain/blockchain/process_attestation_test.go index c55e88fce..3c5976aaa 100644 --- a/beacon-chain/blockchain/process_attestation_test.go +++ b/beacon-chain/blockchain/process_attestation_test.go @@ -4,7 +4,6 @@ import ( "context" "testing" - "github.com/gogo/protobuf/proto" types "github.com/prysmaticlabs/eth2-types" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" @@ -260,9 +259,7 @@ func TestStore_UpdateCheckpointState(t *testing.T) { cached, err = service.checkpointStateCache.StateByCheckpoint(newCheckpoint) require.NoError(t, err) - if !proto.Equal(returned.InnerStateUnsafe(), cached.InnerStateUnsafe()) { - t.Error("Incorrectly cached base state") - } + require.DeepSSZEqual(t, returned.InnerStateUnsafe(), cached.InnerStateUnsafe()) } func TestAttEpoch_MatchPrevEpoch(t *testing.T) { diff --git a/beacon-chain/blockchain/service_test.go b/beacon-chain/blockchain/service_test.go index 33920fac6..af7c18f77 100644 --- a/beacon-chain/blockchain/service_test.go +++ b/beacon-chain/blockchain/service_test.go @@ -281,7 +281,7 @@ func TestChainService_InitializeChainInfo(t *testing.T) { assert.DeepEqual(t, headBlock, headBlk, "Head block incorrect") s, err := c.HeadState(ctx) require.NoError(t, err) - assert.DeepEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") + assert.DeepSSZEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") assert.Equal(t, c.HeadSlot(), headBlock.Block.Slot, "Head slot incorrect") r, err := c.HeadRoot(context.Background()) require.NoError(t, err) @@ -318,7 +318,7 @@ func TestChainService_InitializeChainInfo_SetHeadAtGenesis(t *testing.T) { require.NoError(t, c.initializeChainInfo(ctx)) s, err := c.HeadState(ctx) require.NoError(t, err) - assert.DeepEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") + assert.DeepSSZEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") assert.Equal(t, genesisRoot, c.genesisRoot, "Genesis block root incorrect") assert.DeepEqual(t, genesis, c.head.block) } @@ -376,7 +376,7 @@ func TestChainService_InitializeChainInfo_HeadSync(t *testing.T) { require.NoError(t, c.initializeChainInfo(ctx)) s, err := c.HeadState(ctx) require.NoError(t, err) - assert.DeepEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") + assert.DeepSSZEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") assert.Equal(t, genesisRoot, c.genesisRoot, "Genesis block root incorrect") // Since head sync is not triggered, chain is initialized to the last finalization checkpoint. assert.DeepEqual(t, finalizedBlock, c.head.block) @@ -397,7 +397,7 @@ func TestChainService_InitializeChainInfo_HeadSync(t *testing.T) { require.NoError(t, c.initializeChainInfo(ctx)) s, err = c.HeadState(ctx) require.NoError(t, err) - assert.DeepEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") + assert.DeepSSZEqual(t, headState.InnerStateUnsafe(), s.InnerStateUnsafe(), "Head state incorrect") assert.Equal(t, genesisRoot, c.genesisRoot, "Genesis block root incorrect") // Head slot is far beyond the latest finalized checkpoint, head sync is triggered. assert.DeepEqual(t, headBlock, c.head.block)