Spectest 1.1.8 (#10041)

* Update spec test to v1.1.8

* Update names

* Update network repo

* Update WORKSPACE

* Better names

* Update beacon-chain/core/time/slot_epoch.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
terence tsao
2021-12-26 15:18:28 -08:00
committed by GitHub
parent 09690590f0
commit 9f27af43cb
12 changed files with 35 additions and 35 deletions

View File

@@ -225,7 +225,7 @@ filegroup(
url = "https://github.com/eth2-clients/slashing-protection-interchange-tests/archive/b8413ca42dc92308019d0d4db52c87e9e125c4e9.tar.gz",
)
consensus_spec_version = "v1.1.7"
consensus_spec_version = "v1.1.8"
bls_test_version = "v0.1.1"
@@ -241,7 +241,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "408096e2de3743ad170497c7598fe1c4b81ae69d2b0f2b5e1339f89149027d13",
sha256 = "e4d2b7830e85734442d7172887dcd4edc0985d6256bafedb3353ab477a1433c0",
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 = "3c844af107693c7c3eb6837f7cfb638b1e8f8842385d2bb93b35574726e35bdc",
sha256 = "4a88d01ad12260220ab5c8efdeec6534bac48a47f29ba4f7977ea14c9d07b0fe",
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 = "6065a073d5d5d6f160be06c745be42a27127669e5408035cf997a12bc860bd20",
sha256 = "0033fe107d9d2adb8d4fcb60dfb1c43fc5a54f0af970525c962124221757c266",
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 = "f121c5faa9d926a8dd4c46c7fcd4943604b49ae631bb2bf7cb5b01d644cb2ddb",
sha256 = "3fc3b8809d140a1ab61350fbd410f33add2851a63829d874dcb620babba603de",
strip_prefix = "consensus-specs-" + consensus_spec_version[1:],
url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version,
)
@@ -319,9 +319,9 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "9dc47bf6b14aed7fac8833e35ab83a69131b43fa5789b3256bf1ac3d4861aeb8",
strip_prefix = "eth2-networks-7fa1b868985ee24aad65567f9250cf7fa86f97b1",
url = "https://github.com/eth2-clients/eth2-networks/archive/7fa1b868985ee24aad65567f9250cf7fa86f97b1.tar.gz",
sha256 = "4e8a18b21d056c4032605621b1a6632198eabab57cb90c61e273f344c287f1b2",
strip_prefix = "eth2-networks-791a5369c5981e829698b17fbcdcdacbdaba97c8",
url = "https://github.com/eth2-clients/eth2-networks/archive/791a5369c5981e829698b17fbcdcdacbdaba97c8.tar.gz",
)
http_archive(

View File

@@ -42,7 +42,7 @@ func UpgradeToMerge(ctx context.Context, state state.BeaconState) (state.BeaconS
Slot: state.Slot(),
Fork: &ethpb.Fork{
PreviousVersion: state.Fork().CurrentVersion,
CurrentVersion: params.BeaconConfig().MergeForkVersion,
CurrentVersion: params.BeaconConfig().BellatrixForkVersion,
Epoch: epoch,
},
LatestBlockHeader: state.LatestBlockHeader(),

View File

@@ -49,7 +49,7 @@ func TestUpgradeToMerge(t *testing.T) {
f := mSt.Fork()
require.DeepSSZEqual(t, &ethpb.Fork{
PreviousVersion: st.Fork().CurrentVersion,
CurrentVersion: params.BeaconConfig().MergeForkVersion,
CurrentVersion: params.BeaconConfig().BellatrixForkVersion,
Epoch: time.CurrentEpoch(st),
}, f)
csc, err := mSt.CurrentSyncCommittee()

View File

@@ -60,13 +60,13 @@ func CanUpgradeToAltair(slot types.Slot) bool {
return epochStart && altairEpoch
}
// CanUpgradeToMerge returns true if the input `slot` can upgrade to Merge fork.
// CanUpgradeToMerge returns true if the input `slot` can upgrade to Bellatrix fork.
//
// Spec code:
// If state.slot % SLOTS_PER_EPOCH == 0 and compute_epoch_at_slot(state.slot) == MERGE_FORK_EPOCH
// If state.slot % SLOTS_PER_EPOCH == 0 and compute_epoch_at_slot(state.slot) == BELLATRIX_FORK_EPOCH
func CanUpgradeToMerge(slot types.Slot) bool {
epochStart := slots.IsEpochStart(slot)
mergeEpoch := slots.ToEpoch(slot) == params.BeaconConfig().MergeForkEpoch
mergeEpoch := slots.ToEpoch(slot) == params.BeaconConfig().BellatrixForkEpoch
return epochStart && mergeEpoch
}

View File

@@ -118,7 +118,7 @@ func TestCanUpgradeToAltair(t *testing.T) {
func TestCanUpgradeToMerge(t *testing.T) {
params.SetupTestConfigCleanup(t)
bc := params.BeaconConfig()
bc.MergeForkEpoch = 5
bc.BellatrixForkEpoch = 5
params.OverrideBeaconConfig(bc)
tests := []struct {
name string
@@ -137,7 +137,7 @@ func TestCanUpgradeToMerge(t *testing.T) {
},
{
name: "merge epoch",
slot: types.Slot(params.BeaconConfig().MergeForkEpoch) * params.BeaconConfig().SlotsPerEpoch,
slot: types.Slot(params.BeaconConfig().BellatrixForkEpoch) * params.BeaconConfig().SlotsPerEpoch,
want: true,
},
}

View File

@@ -554,7 +554,7 @@ func TestProcessSlots_OnlyAltairEpoch(t *testing.T) {
func TestProcessSlots_OnlyMergeEpoch(t *testing.T) {
transition.SkipSlotCache.Disable()
conf := params.BeaconConfig()
conf.MergeForkEpoch = 5
conf.BellatrixForkEpoch = 5
params.OverrideBeaconConfig(conf)
defer params.UseMainnetConfig()

View File

@@ -47,8 +47,8 @@ func TestGetSpec(t *testing.T) {
config.GenesisForkVersion = []byte("GenesisForkVersion")
config.AltairForkVersion = []byte("AltairForkVersion")
config.AltairForkEpoch = 100
config.MergeForkVersion = []byte("MergeForkVersion")
config.MergeForkEpoch = 101
config.BellatrixForkVersion = []byte("BellatrixForkVersion")
config.BellatrixForkEpoch = 101
config.ShardingForkVersion = []byte("ShardingForkVersion")
config.ShardingForkEpoch = 102
config.MinAnchorPowBlockDifficulty = 1000
@@ -191,9 +191,9 @@ func TestGetSpec(t *testing.T) {
assert.Equal(t, "0x"+hex.EncodeToString([]byte("AltairForkVersion")), v)
case "ALTAIR_FORK_EPOCH":
assert.Equal(t, "100", v)
case "MERGE_FORK_VERSION":
assert.Equal(t, "0x"+hex.EncodeToString([]byte("MergeForkVersion")), v)
case "MERGE_FORK_EPOCH":
case "BELLATRIX_FORK_VERSION":
assert.Equal(t, "0x"+hex.EncodeToString([]byte("BellatrixForkVersion")), v)
case "BELLATRIX_FORK_EPOCH":
assert.Equal(t, "101", v)
case "SHARDING_FORK_VERSION":
assert.Equal(t, "0x"+hex.EncodeToString([]byte("ShardingForkVersion")), v)

View File

@@ -130,13 +130,13 @@ type BeaconChainConfig struct {
SlashingProtectionPruningEpochs types.Epoch // SlashingProtectionPruningEpochs defines a period after which all prior epochs are pruned in the validator database.
// Fork-related values.
GenesisForkVersion []byte `yaml:"GENESIS_FORK_VERSION" spec:"true"` // GenesisForkVersion is used to track fork version between state transitions.
AltairForkVersion []byte `yaml:"ALTAIR_FORK_VERSION" spec:"true"` // AltairForkVersion is used to represent the fork version for altair.
AltairForkEpoch types.Epoch `yaml:"ALTAIR_FORK_EPOCH" spec:"true"` // AltairForkEpoch is used to represent the assigned fork epoch for altair.
MergeForkVersion []byte `yaml:"MERGE_FORK_VERSION" spec:"true"` // MergeForkVersion is used to represent the fork version for the merge.
MergeForkEpoch types.Epoch `yaml:"MERGE_FORK_EPOCH" spec:"true"` // MergeForkEpoch is used to represent the assigned fork epoch for the merge.
ShardingForkVersion []byte `yaml:"SHARDING_FORK_VERSION" spec:"true"` // ShardingForkVersion is used to represent the fork version for sharding.
ShardingForkEpoch types.Epoch `yaml:"SHARDING_FORK_EPOCH" spec:"true"` // ShardingForkEpoch is used to represent the assigned fork epoch for sharding.
GenesisForkVersion []byte `yaml:"GENESIS_FORK_VERSION" spec:"true"` // GenesisForkVersion is used to track fork version between state transitions.
AltairForkVersion []byte `yaml:"ALTAIR_FORK_VERSION" spec:"true"` // AltairForkVersion is used to represent the fork version for altair.
AltairForkEpoch types.Epoch `yaml:"ALTAIR_FORK_EPOCH" spec:"true"` // AltairForkEpoch is used to represent the assigned fork epoch for altair.
BellatrixForkVersion []byte `yaml:"BELLATRIX_FORK_VERSION" spec:"true"` // BellatrixForkVersion is used to represent the fork version for the merge.
BellatrixForkEpoch types.Epoch `yaml:"BELLATRIX_FORK_EPOCH" spec:"true"` // BellatrixForkEpoch is used to represent the assigned fork epoch for the merge.
ShardingForkVersion []byte `yaml:"SHARDING_FORK_VERSION" spec:"true"` // ShardingForkVersion is used to represent the fork version for sharding.
ShardingForkEpoch types.Epoch `yaml:"SHARDING_FORK_EPOCH" spec:"true"` // ShardingForkEpoch is used to represent the assigned fork epoch for sharding.
ForkVersionSchedule map[[4]byte]types.Epoch // Schedule of fork epochs by version.
MinAnchorPowBlockDifficulty uint64 `yaml:"MIN_ANCHOR_POW_BLOCK_DIFFICULTY" spec:"true"` // MinAnchorPowBlockDifficulty specifies the target chain difficulty at the time of the merge.
TransitionTotalDifficulty uint64 `yaml:"TRANSITION_TOTAL_DIFFICULTY" spec:"true"` // TransitionTotalDifficulty is part of the experimental merge spec. This value is not used (yet) and is expected to be a uint256.

View File

@@ -191,8 +191,8 @@ var mainnetBeaconConfig = &BeaconChainConfig{
GenesisForkVersion: []byte{0, 0, 0, 0},
AltairForkVersion: []byte{1, 0, 0, 0},
AltairForkEpoch: mainnetAltairForkEpoch,
MergeForkVersion: []byte{2, 0, 0, 0},
MergeForkEpoch: math.MaxUint64,
BellatrixForkVersion: []byte{2, 0, 0, 0},
BellatrixForkEpoch: math.MaxUint64,
ShardingForkVersion: []byte{3, 0, 0, 0},
ShardingForkEpoch: math.MaxUint64,
MinAnchorPowBlockDifficulty: 4294967296,

View File

@@ -88,8 +88,8 @@ func MinimalSpecConfig() *BeaconChainConfig {
// New Altair params
minimalConfig.AltairForkVersion = []byte{1, 0, 0, 1} // Highest byte set to 0x01 to avoid collisions with mainnet versioning
minimalConfig.AltairForkEpoch = math.MaxUint64
minimalConfig.MergeForkVersion = []byte{2, 0, 0, 1}
minimalConfig.MergeForkEpoch = math.MaxUint64
minimalConfig.BellatrixForkVersion = []byte{2, 0, 0, 1}
minimalConfig.BellatrixForkEpoch = math.MaxUint64
minimalConfig.ShardingForkVersion = []byte{3, 0, 0, 1}
minimalConfig.ShardingForkEpoch = math.MaxUint64
// Manually set fork version schedule here.

View File

@@ -42,7 +42,7 @@ func PraterConfig() *BeaconChainConfig {
cfg.AltairForkEpoch = 36660
cfg.AltairForkVersion = []byte{0x1, 0x0, 0x10, 0x20}
cfg.ShardingForkVersion = []byte{0x3, 0x0, 0x10, 0x20}
cfg.MergeForkVersion = []byte{0x2, 0x0, 0x10, 0x20}
cfg.BellatrixForkVersion = []byte{0x2, 0x0, 0x10, 0x20}
cfg.TransitionTotalDifficulty = 4294967296
cfg.DepositContractAddress = "0xff50ed3d0ec03aC01D4C79aAd74928BFF48a7b2b"
return cfg

View File

@@ -30,8 +30,8 @@ func PyrmontConfig() *BeaconChainConfig {
cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x20, 0x09}
cfg.AltairForkVersion = []byte{0x01, 0x00, 0x20, 0x09}
cfg.AltairForkEpoch = 61650
cfg.MergeForkVersion = []byte{0x02, 0x00, 0x20, 0x09}
cfg.MergeForkEpoch = math.MaxUint64
cfg.BellatrixForkVersion = []byte{0x02, 0x00, 0x20, 0x09}
cfg.BellatrixForkEpoch = math.MaxUint64
cfg.ShardingForkVersion = []byte{0x03, 0x00, 0x20, 0x09}
cfg.ShardingForkEpoch = math.MaxUint64
cfg.SecondsPerETH1Block = 14