mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 08:37:37 +00:00
Update to Spectest 1.1.3 (#9786)
* Update transition spec test setup * Update WORKSPACE Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
parent
975f0ea1af
commit
cf956c718d
10
WORKSPACE
10
WORKSPACE
@ -225,7 +225,7 @@ filegroup(
|
||||
url = "https://github.com/eth2-clients/slashing-protection-interchange-tests/archive/b8413ca42dc92308019d0d4db52c87e9e125c4e9.tar.gz",
|
||||
)
|
||||
|
||||
consensus_spec_version = "v1.1.2"
|
||||
consensus_spec_version = "v1.1.3"
|
||||
|
||||
bls_test_version = "v0.1.1"
|
||||
|
||||
@ -241,7 +241,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
sha256 = "45f6bd1688a57fd40ab1272dac75de33d9777c84f9ea545815bfd9dc0e841a82",
|
||||
sha256 = "e572f8c57e2dbbaeee056a600dc9d08396010dd5134a3a95e43c540470acf6f5",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@ -257,7 +257,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
sha256 = "e203d4378a59d9b82b1a4e948bef7281be8bb5b59264c7d1a6a394b669cf800b",
|
||||
sha256 = "7e2f62eaae9fd541690cc61d252556d0c5deb585ca1873aacbeb5b02d06f1362",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@ -273,7 +273,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
sha256 = "dd9e01bb871673af49a6b4efad291505e0bdb607df3dd29d1b0b319c1fba2d60",
|
||||
sha256 = "05cbb89810c8acd6c57c4773ddfd167305cd4539960e9b4d7b69e1a988b35ad2",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@ -288,7 +288,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
sha256 = "55fa6fa9823781195cb5362b734b4b6e2a6940a7411530b9bcdab02d845106ca",
|
||||
sha256 = "0cef67b08448f7eb43bf66c464451c9e7a4852df8ef90555cca6d440e3436882",
|
||||
strip_prefix = "consensus-specs-" + consensus_spec_version[1:],
|
||||
url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
@ -19,12 +19,17 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/testing/require"
|
||||
"github.com/prysmaticlabs/prysm/testing/spectest/utils"
|
||||
"github.com/prysmaticlabs/prysm/testing/util"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func init() {
|
||||
transition.SkipSlotCache.Disable()
|
||||
}
|
||||
|
||||
type ForkConfig struct {
|
||||
PostFork string `json:"post_fork"`
|
||||
ForkEpoch int `json:"fork_epoch"`
|
||||
ForkBlock int `json:"fork_block"`
|
||||
ForkBlock *int `json:"fork_block"`
|
||||
BlocksCount int `json:"blocks_count"`
|
||||
}
|
||||
|
||||
@ -44,7 +49,8 @@ func RunForkTransitionTest(t *testing.T, config string) {
|
||||
preforkBlocks := make([]*ethpb.SignedBeaconBlock, 0)
|
||||
postforkBlocks := make([]*ethpb.SignedBeaconBlockAltair, 0)
|
||||
// Fork happens without any pre-fork blocks.
|
||||
if config.ForkBlock == 0 {
|
||||
|
||||
if config.ForkBlock == nil {
|
||||
for i := 0; i < config.BlocksCount; i++ {
|
||||
fileName := fmt.Sprint("blocks_", i, ".ssz_snappy")
|
||||
blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), fileName)
|
||||
@ -57,7 +63,7 @@ func RunForkTransitionTest(t *testing.T, config string) {
|
||||
}
|
||||
// Fork happens with pre-fork blocks.
|
||||
} else {
|
||||
for i := 0; i <= config.ForkBlock; i++ {
|
||||
for i := 0; i <= *config.ForkBlock; i++ {
|
||||
fileName := fmt.Sprint("blocks_", i, ".ssz_snappy")
|
||||
blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), fileName)
|
||||
require.NoError(t, err)
|
||||
@ -67,7 +73,7 @@ func RunForkTransitionTest(t *testing.T, config string) {
|
||||
require.NoError(t, block.UnmarshalSSZ(blockSSZ), "Failed to unmarshal")
|
||||
preforkBlocks = append(preforkBlocks, block)
|
||||
}
|
||||
for i := config.ForkBlock + 1; i < config.BlocksCount; i++ {
|
||||
for i := *config.ForkBlock + 1; i < config.BlocksCount; i++ {
|
||||
fileName := fmt.Sprint("blocks_", i, ".ssz_snappy")
|
||||
blockFile, err := util.BazelFileBytes(testsFolderPath, folder.Name(), fileName)
|
||||
require.NoError(t, err)
|
||||
@ -119,7 +125,9 @@ func RunForkTransitionTest(t *testing.T, config string) {
|
||||
|
||||
pbState, err := stateAltair.ProtobufBeaconState(altairState.CloneInnerState())
|
||||
require.NoError(t, err)
|
||||
require.DeepSSZEqual(t, pbState, postBeaconState)
|
||||
if !proto.Equal(pbState, postBeaconState) {
|
||||
t.Fatal("Post state does not match expected")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user