mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
b7175b3482
* Revert "Revert "Update fastssz" (#7100)"
This reverts commit b954db9704
.
* Preston's patch
* Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Update fssz, add regression test case
* more HTR with fssz
* fix some tests
* only one test left
* Make it so that HTR will work
* gofmt, imports
* gofmt, imports
* fix
* Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* fix
* Merge branch 'master' into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
* gaz
* Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
* fix test
* Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package blockchain
|
|
|
|
import (
|
|
"testing"
|
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
)
|
|
|
|
func TestHotStateCache_RoundTrip(t *testing.T) {
|
|
c := newCheckPointInfoCache()
|
|
cp := ðpb.Checkpoint{
|
|
Epoch: 1,
|
|
Root: bytesutil.PadTo([]byte{'a'}, 32),
|
|
}
|
|
info, err := c.get(cp)
|
|
require.NoError(t, err)
|
|
require.Equal(t, (*pb.CheckPtInfo)(nil), info)
|
|
|
|
i := &pb.CheckPtInfo{
|
|
Seed: bytesutil.PadTo([]byte{'c'}, 32),
|
|
GenesisRoot: bytesutil.PadTo([]byte{'d'}, 32),
|
|
ActiveIndices: []uint64{0, 1, 2, 3},
|
|
}
|
|
|
|
require.NoError(t, c.put(cp, i))
|
|
info, err = c.get(cp)
|
|
require.NoError(t, err)
|
|
require.DeepEqual(t, info, i)
|
|
}
|
|
|
|
func TestHotStateCache_CanPrune(t *testing.T) {
|
|
c := newCheckPointInfoCache()
|
|
for i := 0; i < maxInfoSize+1; i++ {
|
|
cp := ðpb.Checkpoint{Epoch: uint64(i), Root: make([]byte, 32)}
|
|
require.NoError(t, c.put(cp, &pb.CheckPtInfo{}))
|
|
}
|
|
require.Equal(t, len(c.cache.Keys()), maxInfoSize)
|
|
}
|