mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
Use deep ssz (#8557)
This commit is contained in:
parent
e36c3dd668
commit
c1d4ff6239
@ -55,7 +55,7 @@ func TestSaveHead_Different(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.DeepEqual(t, cachedRoot, newRoot[:], "Head did not change")
|
assert.DeepEqual(t, cachedRoot, newRoot[:], "Head did not change")
|
||||||
assert.DeepEqual(t, newHeadSignedBlock, service.headBlock(), "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) {
|
func TestSaveHead_Different_Reorg(t *testing.T) {
|
||||||
@ -91,7 +91,7 @@ func TestSaveHead_Different_Reorg(t *testing.T) {
|
|||||||
t.Error("Head did not change")
|
t.Error("Head did not change")
|
||||||
}
|
}
|
||||||
assert.DeepEqual(t, newHeadSignedBlock, service.headBlock(), "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")
|
require.LogsContain(t, hook, "Chain reorg occurred")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
|
||||||
types "github.com/prysmaticlabs/eth2-types"
|
types "github.com/prysmaticlabs/eth2-types"
|
||||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||||
@ -260,9 +259,7 @@ func TestStore_UpdateCheckpointState(t *testing.T) {
|
|||||||
|
|
||||||
cached, err = service.checkpointStateCache.StateByCheckpoint(newCheckpoint)
|
cached, err = service.checkpointStateCache.StateByCheckpoint(newCheckpoint)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
if !proto.Equal(returned.InnerStateUnsafe(), cached.InnerStateUnsafe()) {
|
require.DeepSSZEqual(t, returned.InnerStateUnsafe(), cached.InnerStateUnsafe())
|
||||||
t.Error("Incorrectly cached base state")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAttEpoch_MatchPrevEpoch(t *testing.T) {
|
func TestAttEpoch_MatchPrevEpoch(t *testing.T) {
|
||||||
|
@ -281,7 +281,7 @@ func TestChainService_InitializeChainInfo(t *testing.T) {
|
|||||||
assert.DeepEqual(t, headBlock, headBlk, "Head block incorrect")
|
assert.DeepEqual(t, headBlock, headBlk, "Head block incorrect")
|
||||||
s, err := c.HeadState(ctx)
|
s, err := c.HeadState(ctx)
|
||||||
require.NoError(t, err)
|
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")
|
assert.Equal(t, c.HeadSlot(), headBlock.Block.Slot, "Head slot incorrect")
|
||||||
r, err := c.HeadRoot(context.Background())
|
r, err := c.HeadRoot(context.Background())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -318,7 +318,7 @@ func TestChainService_InitializeChainInfo_SetHeadAtGenesis(t *testing.T) {
|
|||||||
require.NoError(t, c.initializeChainInfo(ctx))
|
require.NoError(t, c.initializeChainInfo(ctx))
|
||||||
s, err := c.HeadState(ctx)
|
s, err := c.HeadState(ctx)
|
||||||
require.NoError(t, err)
|
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.Equal(t, genesisRoot, c.genesisRoot, "Genesis block root incorrect")
|
||||||
assert.DeepEqual(t, genesis, c.head.block)
|
assert.DeepEqual(t, genesis, c.head.block)
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ func TestChainService_InitializeChainInfo_HeadSync(t *testing.T) {
|
|||||||
require.NoError(t, c.initializeChainInfo(ctx))
|
require.NoError(t, c.initializeChainInfo(ctx))
|
||||||
s, err := c.HeadState(ctx)
|
s, err := c.HeadState(ctx)
|
||||||
require.NoError(t, err)
|
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.Equal(t, genesisRoot, c.genesisRoot, "Genesis block root incorrect")
|
||||||
// Since head sync is not triggered, chain is initialized to the last finalization checkpoint.
|
// Since head sync is not triggered, chain is initialized to the last finalization checkpoint.
|
||||||
assert.DeepEqual(t, finalizedBlock, c.head.block)
|
assert.DeepEqual(t, finalizedBlock, c.head.block)
|
||||||
@ -397,7 +397,7 @@ func TestChainService_InitializeChainInfo_HeadSync(t *testing.T) {
|
|||||||
require.NoError(t, c.initializeChainInfo(ctx))
|
require.NoError(t, c.initializeChainInfo(ctx))
|
||||||
s, err = c.HeadState(ctx)
|
s, err = c.HeadState(ctx)
|
||||||
require.NoError(t, err)
|
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.Equal(t, genesisRoot, c.genesisRoot, "Genesis block root incorrect")
|
||||||
// Head slot is far beyond the latest finalized checkpoint, head sync is triggered.
|
// Head slot is far beyond the latest finalized checkpoint, head sync is triggered.
|
||||||
assert.DeepEqual(t, headBlock, c.head.block)
|
assert.DeepEqual(t, headBlock, c.head.block)
|
||||||
|
Loading…
Reference in New Issue
Block a user