Skip to content

Commit

Permalink
Electra: (partial) spectests (#13977)
Browse files Browse the repository at this point in the history
* Electra epoch transition, re-exports only

* Buildable electra spectests

Fix minimal tests that are passing on mainnet

* Skip failing tests
  • Loading branch information
prestonvanloon authored and nisdas committed Jun 19, 2024
1 parent 7cbb3c2 commit a226fc8
Show file tree
Hide file tree
Showing 106 changed files with 2,525 additions and 3 deletions.
7 changes: 6 additions & 1 deletion beacon-chain/core/electra/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ load("@prysm//tools/go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
srcs = ["upgrade.go"],
srcs = [
"transition.go",
"upgrade.go",
],
importpath = "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/electra",
visibility = ["//visibility:public"],
deps = [
"//beacon-chain/core/altair:go_default_library",
"//beacon-chain/core/epoch:go_default_library",
"//beacon-chain/core/helpers:go_default_library",
"//beacon-chain/core/time:go_default_library",
"//beacon-chain/state:go_default_library",
Expand Down
23 changes: 23 additions & 0 deletions beacon-chain/core/electra/transition.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package electra

import (
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/altair"
e "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/epoch"
)

// Re-exports for methods that haven't changed in Electra.
var (
InitializePrecomputeValidators = altair.InitializePrecomputeValidators
ProcessEpochParticipation = altair.ProcessEpochParticipation
ProcessInactivityScores = altair.ProcessInactivityScores
ProcessRewardsAndPenaltiesPrecompute = altair.ProcessRewardsAndPenaltiesPrecompute
ProcessSlashings = e.ProcessSlashings
ProcessEth1DataReset = e.ProcessEth1DataReset
ProcessSlashingsReset = e.ProcessSlashingsReset
ProcessRandaoMixesReset = e.ProcessRandaoMixesReset
ProcessHistoricalDataUpdate = e.ProcessHistoricalDataUpdate
ProcessParticipationFlagUpdates = altair.ProcessParticipationFlagUpdates
ProcessSyncCommitteeUpdates = altair.ProcessSyncCommitteeUpdates
AttestationsDelta = altair.AttestationsDelta
ProcessSyncAggregate = altair.ProcessSyncAggregate
)
20 changes: 20 additions & 0 deletions testing/spectest/mainnet/electra/epoch_processing/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
load("@prysm//tools/go:def.bzl", "go_test")

go_test(
name = "go_default_test",
srcs = [
"eth1_data_reset_test.go",
"historical_summaries_update_test.go",
"inactivity_updates_test.go",
"justification_and_finalization_test.go",
"participation_flag_updates_test.go",
"randao_mixes_reset_test.go",
"rewards_and_penalties_test.go",
"slashings_reset_test.go",
"slashings_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
deps = ["//testing/spectest/shared/electra/epoch_processing:go_default_library"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_Eth1DataReset(t *testing.T) {
epoch_processing.RunEth1DataResetTests(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_HistoricalSummariesUpdate(t *testing.T) {
epoch_processing.RunHistoricalSummariesUpdateTests(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_InactivityUpdates(t *testing.T) {
epoch_processing.RunInactivityUpdatesTest(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_JustificationAndFinalization(t *testing.T) {
epoch_processing.RunJustificationAndFinalizationTests(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_ParticipationFlag(t *testing.T) {
epoch_processing.RunParticipationFlagUpdatesTests(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_RandaoMixesReset(t *testing.T) {
epoch_processing.RunRandaoMixesResetTests(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_RewardsAndPenalties(t *testing.T) {
epoch_processing.RunRewardsAndPenaltiesTests(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_SlashingsReset(t *testing.T) {
epoch_processing.RunSlashingsResetTests(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package epoch_processing

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/epoch_processing"
)

func TestMainnet_Electra_EpochProcessing_Slashings(t *testing.T) {
epoch_processing.RunSlashingsTests(t, "mainnet")
}
14 changes: 14 additions & 0 deletions testing/spectest/mainnet/electra/finality/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@prysm//tools/go:def.bzl", "go_test")

go_test(
name = "go_default_test",
size = "medium",
timeout = "short",
srcs = ["finality_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
shard_count = 4,
tags = ["spectest"],
deps = ["//testing/spectest/shared/electra/finality:go_default_library"],
)
12 changes: 12 additions & 0 deletions testing/spectest/mainnet/electra/finality/finality_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package finality

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/finality"
)

func TestMainnet_Electra_Finality(t *testing.T) {
t.Skip("TODO: Electra")
finality.RunFinalityTest(t, "mainnet")
}
12 changes: 12 additions & 0 deletions testing/spectest/mainnet/electra/fork_transition/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@prysm//tools/go:def.bzl", "go_test")

go_test(
name = "go_default_test",
size = "small",
srcs = ["transition_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/electra/fork:go_default_library"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package fork_transition

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/fork"
)

func TestMainnet_Electra_Transition(t *testing.T) {
t.Skip("TODO: Electra")
fork.RunForkTransitionTest(t, "mainnet")
}
16 changes: 16 additions & 0 deletions testing/spectest/mainnet/electra/forkchoice/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
load("@prysm//tools/go:def.bzl", "go_test")

go_test(
name = "go_default_test",
size = "enormous",
timeout = "short",
srcs = ["forkchoice_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = [
"//runtime/version:go_default_library",
"//testing/spectest/shared/common/forkchoice:go_default_library",
],
)
13 changes: 13 additions & 0 deletions testing/spectest/mainnet/electra/forkchoice/forkchoice_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package forkchoice

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/runtime/version"
"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/common/forkchoice"
)

func TestMainnet_Electra_Forkchoice(t *testing.T) {
t.Skip("TODO: Electra")
forkchoice.Run(t, "mainnet", version.Electra)
}
11 changes: 11 additions & 0 deletions testing/spectest/mainnet/electra/merkle_proof/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@prysm//tools/go:def.bzl", "go_test")

go_test(
name = "go_default_test",
srcs = ["merkle_proof_test.go"],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
tags = ["spectest"],
deps = ["//testing/spectest/shared/electra/merkle_proof:go_default_library"],
)
12 changes: 12 additions & 0 deletions testing/spectest/mainnet/electra/merkle_proof/merkle_proof_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package merkle_proof

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/merkle_proof"
)

func TestMainnet_Electra_MerkleProof(t *testing.T) {
t.Skip("TODO: Electra") // These spectests are missing?
merkle_proof.RunMerkleProofTests(t, "mainnet")
}
19 changes: 19 additions & 0 deletions testing/spectest/mainnet/electra/operations/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@prysm//tools/go:def.bzl", "go_test")

go_test(
name = "go_default_test",
srcs = [
"attester_slashing_test.go",
"block_header_test.go",
"bls_to_execution_change_test.go",
"execution_payload_test.go",
"proposer_slashing_test.go",
"sync_committee_test.go",
"voluntary_exit_test.go",
"withdrawals_test.go",
],
data = glob(["*.yaml"]) + [
"@consensus_spec_tests_mainnet//:test_data",
],
deps = ["//testing/spectest/shared/electra/operations:go_default_library"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_AttesterSlashing(t *testing.T) {
operations.RunAttesterSlashingTest(t, "mainnet")
}
11 changes: 11 additions & 0 deletions testing/spectest/mainnet/electra/operations/block_header_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_BlockHeader(t *testing.T) {
operations.RunBlockHeaderTest(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_BLSToExecutionChange(t *testing.T) {
operations.RunBLSToExecutionChangeTest(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_PayloadExecution(t *testing.T) {
operations.RunExecutionPayloadTest(t, "mainnet")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_ProposerSlashing(t *testing.T) {
operations.RunProposerSlashingTest(t, "mainnet")
}
11 changes: 11 additions & 0 deletions testing/spectest/mainnet/electra/operations/sync_committee_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_SyncCommittee(t *testing.T) {
operations.RunSyncCommitteeTest(t, "mainnet")
}
12 changes: 12 additions & 0 deletions testing/spectest/mainnet/electra/operations/voluntary_exit_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_VoluntaryExit(t *testing.T) {
t.Skip("TODO: Electra")
operations.RunVoluntaryExitTest(t, "mainnet")
}
11 changes: 11 additions & 0 deletions testing/spectest/mainnet/electra/operations/withdrawals_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package operations

import (
"testing"

"github.com/prysmaticlabs/prysm/v5/testing/spectest/shared/electra/operations"
)

func TestMainnet_Electra_Operations_Withdrawals(t *testing.T) {
operations.RunWithdrawalsTest(t, "mainnet")
}
Loading

0 comments on commit a226fc8

Please sign in to comment.