mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
Add fulu spec tests for operation and epoch processing (#15284)
* Add fulu spec tets for operation and epoch processing * Fix operation test version * Fix RunDepositRequestsTest
This commit is contained in:
24
testing/spectest/mainnet/fulu/epoch_processing/BUILD.bazel
Normal file
24
testing/spectest/mainnet/fulu/epoch_processing/BUILD.bazel
Normal file
@@ -0,0 +1,24 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = [
|
||||
"effective_balance_updates_test.go",
|
||||
"eth1_data_reset_test.go",
|
||||
"historical_summaries_update_test.go",
|
||||
"inactivity_updates_test.go",
|
||||
"justification_and_finalization_test.go",
|
||||
"participation_flag_updates_test.go",
|
||||
"pending_consolidations_test.go",
|
||||
"pending_deposits_updates_test.go",
|
||||
"randao_mixes_reset_test.go",
|
||||
"registry_updates_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/fulu/epoch_processing:go_default_library"],
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_fulu_EpochProcessing_EffectiveBalanceUpdates(t *testing.T) {
|
||||
epoch_processing.RunEffectiveBalanceUpdatesTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_Eth1DataReset(t *testing.T) {
|
||||
epoch_processing.RunEth1DataResetTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_HistoricalSummariesUpdate(t *testing.T) {
|
||||
epoch_processing.RunHistoricalSummariesUpdateTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_InactivityUpdates(t *testing.T) {
|
||||
epoch_processing.RunInactivityUpdatesTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_JustificationAndFinalization(t *testing.T) {
|
||||
epoch_processing.RunJustificationAndFinalizationTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_ParticipationFlag(t *testing.T) {
|
||||
epoch_processing.RunParticipationFlagUpdatesTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_PendingConsolidations(t *testing.T) {
|
||||
epoch_processing.RunPendingConsolidationsTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_PendingDeposits(t *testing.T) {
|
||||
epoch_processing.RunPendingDepositsTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_RandaoMixesReset(t *testing.T) {
|
||||
epoch_processing.RunRandaoMixesResetTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_RegistryUpdates(t *testing.T) {
|
||||
epoch_processing.RunRegistryUpdatesTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_RewardsAndPenalties(t *testing.T) {
|
||||
epoch_processing.RunRewardsAndPenaltiesTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_SlashingsReset(t *testing.T) {
|
||||
epoch_processing.RunSlashingsResetTests(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_EpochProcessing_Slashings(t *testing.T) {
|
||||
epoch_processing.RunSlashingsTests(t, "mainnet")
|
||||
}
|
||||
24
testing/spectest/mainnet/fulu/operations/BUILD.bazel
Normal file
24
testing/spectest/mainnet/fulu/operations/BUILD.bazel
Normal file
@@ -0,0 +1,24 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = [
|
||||
"attestation_test.go",
|
||||
"attester_slashing_test.go",
|
||||
"block_header_test.go",
|
||||
"bls_to_execution_change_test.go",
|
||||
"consolidation_test.go",
|
||||
"deposit_requests_test.go",
|
||||
"deposit_test.go",
|
||||
"execution_layer_withdrawals_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/fulu/operations:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/mainnet/fulu/operations/attestation_test.go
Normal file
11
testing/spectest/mainnet/fulu/operations/attestation_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_Attestation(t *testing.T) {
|
||||
operations.RunAttestationTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_AttesterSlashing(t *testing.T) {
|
||||
operations.RunAttesterSlashingTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_BlockHeader(t *testing.T) {
|
||||
operations.RunBlockHeaderTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_BLSToExecutionChange(t *testing.T) {
|
||||
operations.RunBLSToExecutionChangeTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_Consolidation(t *testing.T) {
|
||||
operations.RunConsolidationTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_DepositRequests(t *testing.T) {
|
||||
operations.RunDepositRequestsTest(t, "mainnet")
|
||||
}
|
||||
11
testing/spectest/mainnet/fulu/operations/deposit_test.go
Normal file
11
testing/spectest/mainnet/fulu/operations/deposit_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_Deposit(t *testing.T) {
|
||||
operations.RunDepositTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_WithdrawalRequest(t *testing.T) {
|
||||
operations.RunWithdrawalRequestTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_PayloadExecution(t *testing.T) {
|
||||
operations.RunExecutionPayloadTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_ProposerSlashing(t *testing.T) {
|
||||
operations.RunProposerSlashingTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_SyncCommittee(t *testing.T) {
|
||||
operations.RunSyncCommitteeTest(t, "mainnet")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_VoluntaryExit(t *testing.T) {
|
||||
operations.RunVoluntaryExitTest(t, "mainnet")
|
||||
}
|
||||
11
testing/spectest/mainnet/fulu/operations/withdrawals_test.go
Normal file
11
testing/spectest/mainnet/fulu/operations/withdrawals_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_Withdrawals(t *testing.T) {
|
||||
operations.RunWithdrawalsTest(t, "mainnet")
|
||||
}
|
||||
26
testing/spectest/minimal/fulu/epoch_processing/BUILD.bazel
Normal file
26
testing/spectest/minimal/fulu/epoch_processing/BUILD.bazel
Normal file
@@ -0,0 +1,26 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = [
|
||||
"effective_balance_updates_test.go",
|
||||
"eth1_data_reset_test.go",
|
||||
"historical_summaries_update_test.go",
|
||||
"inactivity_updates_test.go",
|
||||
"justification_and_finalization_test.go",
|
||||
"participation_flag_updates_test.go",
|
||||
"pending_consolidations_test.go",
|
||||
"pending_deposits_updates_test.go",
|
||||
"randao_mixes_reset_test.go",
|
||||
"registry_updates_test.go",
|
||||
"rewards_and_penalties_test.go",
|
||||
"slashings_reset_test.go",
|
||||
"slashings_test.go",
|
||||
"sync_committee_updates_test.go",
|
||||
],
|
||||
data = glob(["*.yaml"]) + [
|
||||
"@consensus_spec_tests_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
deps = ["//testing/spectest/shared/fulu/epoch_processing:go_default_library"],
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_fulu_EpochProcessing_EffectiveBalanceUpdates(t *testing.T) {
|
||||
epoch_processing.RunEffectiveBalanceUpdatesTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_Eth1DataReset(t *testing.T) {
|
||||
epoch_processing.RunEth1DataResetTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_HistoricalSummariesUpdate(t *testing.T) {
|
||||
epoch_processing.RunHistoricalSummariesUpdateTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_InactivityUpdates(t *testing.T) {
|
||||
epoch_processing.RunInactivityUpdatesTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_JustificationAndFinalization(t *testing.T) {
|
||||
epoch_processing.RunJustificationAndFinalizationTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_ParticipationFlag(t *testing.T) {
|
||||
epoch_processing.RunParticipationFlagUpdatesTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_PendingConsolidations(t *testing.T) {
|
||||
epoch_processing.RunPendingConsolidationsTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_PendingDeposits(t *testing.T) {
|
||||
epoch_processing.RunPendingDepositsTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_RandaoMixesReset(t *testing.T) {
|
||||
epoch_processing.RunRandaoMixesResetTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_RegistryUpdates(t *testing.T) {
|
||||
epoch_processing.RunRegistryUpdatesTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_RewardsAndPenalties(t *testing.T) {
|
||||
epoch_processing.RunRewardsAndPenaltiesTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_SlashingsReset(t *testing.T) {
|
||||
epoch_processing.RunSlashingsResetTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_Slashings(t *testing.T) {
|
||||
epoch_processing.RunSlashingsTests(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_EpochProcessing_SyncCommitteeUpdates(t *testing.T) {
|
||||
epoch_processing.RunSyncCommitteeUpdatesTests(t, "minimal")
|
||||
}
|
||||
25
testing/spectest/minimal/fulu/operations/BUILD.bazel
Normal file
25
testing/spectest/minimal/fulu/operations/BUILD.bazel
Normal file
@@ -0,0 +1,25 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_test")
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = [
|
||||
"attestation_test.go",
|
||||
"attester_slashing_test.go",
|
||||
"block_header_test.go",
|
||||
"bls_to_execution_change_test.go",
|
||||
"consolidation_test.go",
|
||||
"deposit_requests_test.go",
|
||||
"deposit_test.go",
|
||||
"execution_layer_withdrawals_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_minimal//:test_data",
|
||||
],
|
||||
eth_network = "minimal",
|
||||
deps = ["//testing/spectest/shared/fulu/operations:go_default_library"],
|
||||
)
|
||||
11
testing/spectest/minimal/fulu/operations/attestation_test.go
Normal file
11
testing/spectest/minimal/fulu/operations/attestation_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_Attestation(t *testing.T) {
|
||||
operations.RunAttestationTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_AttesterSlashing(t *testing.T) {
|
||||
operations.RunAttesterSlashingTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_BlockHeader(t *testing.T) {
|
||||
operations.RunBlockHeaderTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_BLSToExecutionChange(t *testing.T) {
|
||||
operations.RunBLSToExecutionChangeTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_Consolidation(t *testing.T) {
|
||||
operations.RunConsolidationTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMainnet_Fulu_Operations_DepositRequests(t *testing.T) {
|
||||
operations.RunDepositRequestsTest(t, "minimal")
|
||||
}
|
||||
11
testing/spectest/minimal/fulu/operations/deposit_test.go
Normal file
11
testing/spectest/minimal/fulu/operations/deposit_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_Deposit(t *testing.T) {
|
||||
operations.RunDepositTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_WithdrawalRequest(t *testing.T) {
|
||||
operations.RunWithdrawalRequestTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_PayloadExecution(t *testing.T) {
|
||||
operations.RunExecutionPayloadTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_ProposerSlashing(t *testing.T) {
|
||||
operations.RunProposerSlashingTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_SyncCommittee(t *testing.T) {
|
||||
operations.RunSyncCommitteeTest(t, "minimal")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_VoluntaryExit(t *testing.T) {
|
||||
operations.RunVoluntaryExitTest(t, "minimal")
|
||||
}
|
||||
11
testing/spectest/minimal/fulu/operations/withdrawals_test.go
Normal file
11
testing/spectest/minimal/fulu/operations/withdrawals_test.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations"
|
||||
)
|
||||
|
||||
func TestMinimal_Fulu_Operations_Withdrawals(t *testing.T) {
|
||||
operations.RunWithdrawalsTest(t, "minimal")
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
func RunDepositRequestsTest(t *testing.T, config string, fork string, block blockWithSSZObject, sszToState SSZToState) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "electra", "operations/deposit_request/pyspec_tests")
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, fork, "operations/deposit_request/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
|
||||
42
testing/spectest/shared/fulu/epoch_processing/BUILD.bazel
Normal file
42
testing/spectest/shared/fulu/epoch_processing/BUILD.bazel
Normal file
@@ -0,0 +1,42 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"effective_balance_updates.go",
|
||||
"eth1_data_reset.go",
|
||||
"helpers.go",
|
||||
"historical_summaries_update.go",
|
||||
"inactivity_updates.go",
|
||||
"justification_and_finalization.go",
|
||||
"participation_flag_updates.go",
|
||||
"pending_consolidations.go",
|
||||
"pending_deposit_updates.go",
|
||||
"randao_mixes_reset.go",
|
||||
"registry_updates.go",
|
||||
"rewards_and_penalties.go",
|
||||
"slashings.go",
|
||||
"slashings_reset.go",
|
||||
"sync_committee_updates.go",
|
||||
],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//beacon-chain/core/electra:go_default_library",
|
||||
"//beacon-chain/core/epoch/precompute:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//consensus-types/primitives:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//testing/require:go_default_library",
|
||||
"//testing/spectest/utils:go_default_library",
|
||||
"//testing/util:go_default_library",
|
||||
"@com_github_golang_snappy//:go_default_library",
|
||||
"@com_github_google_go_cmp//cmp:go_default_library",
|
||||
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
|
||||
"@org_golang_google_protobuf//proto:go_default_library",
|
||||
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,30 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunEffectiveBalanceUpdatesTests executes "epoch_processing/effective_balance_updates" tests.
|
||||
func RunEffectiveBalanceUpdatesTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/effective_balance_updates/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processEffectiveBalanceUpdatesWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processEffectiveBalanceUpdatesWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
err := electra.ProcessEffectiveBalanceUpdates(st)
|
||||
require.NoError(t, err, "Could not process final updates")
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunEth1DataResetTests executes "epoch_processing/eth1_data_reset" tests.
|
||||
func RunEth1DataResetTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/eth1_data_reset/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processEth1DataResetWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processEth1DataResetWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
st, err := electra.ProcessEth1DataReset(st)
|
||||
require.NoError(t, err, "Could not process final updates")
|
||||
return st, nil
|
||||
}
|
||||
78
testing/spectest/shared/fulu/epoch_processing/helpers.go
Normal file
78
testing/spectest/shared/fulu/epoch_processing/helpers.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
state_native "github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
"github.com/bazelbuild/rules_go/go/tools/bazel"
|
||||
"github.com/golang/snappy"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
)
|
||||
|
||||
type epochOperation func(*testing.T, state.BeaconState) (state.BeaconState, error)
|
||||
|
||||
// RunEpochOperationTest takes in the prestate and processes it through the
|
||||
// passed in epoch operation function and checks the post state with the expected post state.
|
||||
func RunEpochOperationTest(
|
||||
t *testing.T,
|
||||
testFolderPath string,
|
||||
operationFn epochOperation,
|
||||
) {
|
||||
preBeaconStateFile, err := util.BazelFileBytes(path.Join(testFolderPath, "pre.ssz_snappy"))
|
||||
require.NoError(t, err)
|
||||
preBeaconStateSSZ, err := snappy.Decode(nil /* dst */, preBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
preBeaconStateBase := ðpb.BeaconStateElectra{}
|
||||
if err := preBeaconStateBase.UnmarshalSSZ(preBeaconStateSSZ); err != nil {
|
||||
t.Fatalf("Failed to unmarshal: %v", err)
|
||||
}
|
||||
preBeaconState, err := state_native.InitializeFromProtoElectra(preBeaconStateBase)
|
||||
require.NoError(t, err)
|
||||
|
||||
// If the post.ssz is not present, it means the test should fail on our end.
|
||||
postSSZFilepath, err := bazel.Runfile(path.Join(testFolderPath, "post.ssz_snappy"))
|
||||
postSSZExists := true
|
||||
if err != nil && strings.Contains(err.Error(), "could not locate file") {
|
||||
postSSZExists = false
|
||||
} else if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
beaconState, err := operationFn(t, preBeaconState)
|
||||
if postSSZExists {
|
||||
require.NoError(t, err)
|
||||
|
||||
postBeaconStateFile, err := os.ReadFile(postSSZFilepath) // #nosec G304
|
||||
require.NoError(t, err)
|
||||
postBeaconStateSSZ, err := snappy.Decode(nil /* dst */, postBeaconStateFile)
|
||||
require.NoError(t, err, "Failed to decompress")
|
||||
postBeaconState := ðpb.BeaconStateElectra{}
|
||||
if err := postBeaconState.UnmarshalSSZ(postBeaconStateSSZ); err != nil {
|
||||
t.Fatalf("Failed to unmarshal: %v", err)
|
||||
}
|
||||
|
||||
pbState, err := state_native.ProtobufBeaconStateElectra(beaconState.ToProtoUnsafe())
|
||||
require.NoError(t, err)
|
||||
if !proto.Equal(pbState, postBeaconState) {
|
||||
t.Log(cmp.Diff(postBeaconState, pbState, protocmp.Transform()))
|
||||
t.Fatal("Post state does not match expected")
|
||||
}
|
||||
} else {
|
||||
// Note: This doesn't test anything worthwhile. It essentially tests
|
||||
// that *any* error has occurred, not any specific error.
|
||||
if err == nil {
|
||||
t.Fatal("Did not fail when expected")
|
||||
}
|
||||
t.Logf("Expected failure; failure reason = %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunHistoricalSummariesUpdateTests executes "epoch_processing/historical_Summaries_update" tests.
|
||||
func RunHistoricalSummariesUpdateTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/historical_summaries_update/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processHistoricalSummariesUpdateWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processHistoricalSummariesUpdateWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
st, err := electra.ProcessHistoricalDataUpdate(st)
|
||||
require.NoError(t, err, "Could not process final updates")
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunInactivityUpdatesTest executes "epoch_processing/inactivity_updates" tests.
|
||||
func RunInactivityUpdatesTest(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testPath := "epoch_processing/inactivity_updates/pyspec_tests"
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", testPath)
|
||||
for _, folder := range testFolders {
|
||||
helpers.ClearCache()
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processInactivityUpdates)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processInactivityUpdates(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
ctx := context.Background()
|
||||
vp, bp, err := electra.InitializePrecomputeValidators(ctx, st)
|
||||
require.NoError(t, err)
|
||||
vp, _, err = electra.ProcessEpochParticipation(ctx, st, bp, vp)
|
||||
require.NoError(t, err)
|
||||
|
||||
st, _, err = electra.ProcessInactivityScores(ctx, st, vp)
|
||||
require.NoError(t, err, "Could not process reward")
|
||||
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/epoch/precompute"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunJustificationAndFinalizationTests executes "epoch_processing/justification_and_finalization" tests.
|
||||
func RunJustificationAndFinalizationTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testPath := "epoch_processing/justification_and_finalization/pyspec_tests"
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", testPath)
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processJustificationAndFinalizationPrecomputeWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processJustificationAndFinalizationPrecomputeWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
ctx := context.Background()
|
||||
vp, bp, err := electra.InitializePrecomputeValidators(ctx, st)
|
||||
require.NoError(t, err)
|
||||
_, bp, err = electra.ProcessEpochParticipation(ctx, st, bp, vp)
|
||||
require.NoError(t, err)
|
||||
activeBal, targetPrevious, targetCurrent, err := st.UnrealizedCheckpointBalances()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, bp.ActiveCurrentEpoch, activeBal)
|
||||
require.Equal(t, bp.CurrentEpochTargetAttested, targetCurrent)
|
||||
require.Equal(t, bp.PrevEpochTargetAttested, targetPrevious)
|
||||
st, err = precompute.ProcessJustificationAndFinalizationPreCompute(st, bp)
|
||||
require.NoError(t, err, "Could not process justification")
|
||||
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunParticipationFlagUpdatesTests executes "epoch_processing/participation_flag_updates" tests.
|
||||
func RunParticipationFlagUpdatesTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/participation_flag_updates/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processParticipationFlagUpdatesWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processParticipationFlagUpdatesWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
st, err := electra.ProcessParticipationFlagUpdates(st)
|
||||
require.NoError(t, err, "Could not process participation flag update")
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
func RunPendingConsolidationsTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/pending_consolidations/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processPendingConsolidations)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processPendingConsolidations(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
return st, electra.ProcessPendingConsolidations(context.TODO(), st)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
func RunPendingDepositsTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/pending_deposits/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processPendingDeposits)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processPendingDeposits(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
// The caller of this method would normally have the precompute balance values for total
|
||||
// active balance for this epoch. For ease of test setup, we will compute total active
|
||||
// balance from the given state.
|
||||
tab, err := helpers.TotalActiveBalance(st)
|
||||
require.NoError(t, err)
|
||||
return st, electra.ProcessPendingDeposits(context.TODO(), st, primitives.Gwei(tab))
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunRandaoMixesResetTests executes "epoch_processing/randao_mixes_reset" tests.
|
||||
func RunRandaoMixesResetTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/randao_mixes_reset/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processRandaoMixesResetWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processRandaoMixesResetWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
st, err := electra.ProcessRandaoMixesReset(st)
|
||||
require.NoError(t, err, "Could not process final updates")
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunRegistryUpdatesTests executes "epoch_processing/registry_updates" tests.
|
||||
func RunRegistryUpdatesTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/registry_updates/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
// Important to clear cache for every test or else the old value of active validator count gets reused.
|
||||
helpers.ClearCache()
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processRegistryUpdatesWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processRegistryUpdatesWrapper(_ *testing.T, state state.BeaconState) (state.BeaconState, error) {
|
||||
return state, electra.ProcessRegistryUpdates(context.Background(), state)
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunRewardsAndPenaltiesTests executes "epoch_processing/rewards_and_penalties" tests.
|
||||
func RunRewardsAndPenaltiesTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testPath := "epoch_processing/rewards_and_penalties/pyspec_tests"
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", testPath)
|
||||
for _, folder := range testFolders {
|
||||
helpers.ClearCache()
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processRewardsAndPenaltiesPrecomputeWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processRewardsAndPenaltiesPrecomputeWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
ctx := context.Background()
|
||||
vp, bp, err := electra.InitializePrecomputeValidators(ctx, st)
|
||||
require.NoError(t, err)
|
||||
vp, bp, err = electra.ProcessEpochParticipation(ctx, st, bp, vp)
|
||||
require.NoError(t, err)
|
||||
|
||||
st, err = electra.ProcessRewardsAndPenaltiesPrecompute(st, bp, vp)
|
||||
require.NoError(t, err, "Could not process reward")
|
||||
|
||||
return st, nil
|
||||
}
|
||||
31
testing/spectest/shared/fulu/epoch_processing/slashings.go
Normal file
31
testing/spectest/shared/fulu/epoch_processing/slashings.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunSlashingsTests executes "epoch_processing/slashings" tests.
|
||||
func RunSlashingsTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/slashings/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
helpers.ClearCache()
|
||||
RunEpochOperationTest(t, folderPath, processSlashingsWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processSlashingsWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
require.NoError(t, electra.ProcessSlashings(st), "Could not process slashings")
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
// RunSlashingsResetTests executes "epoch_processing/slashings_reset" tests.
|
||||
func RunSlashingsResetTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/slashings_reset/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processSlashingsResetWrapper)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processSlashingsResetWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
st, err := electra.ProcessSlashingsReset(st)
|
||||
require.NoError(t, err, "Could not process final updates")
|
||||
return st, nil
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package epoch_processing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/helpers"
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/spectest/utils"
|
||||
)
|
||||
|
||||
func RunSyncCommitteeUpdatesTests(t *testing.T, config string) {
|
||||
require.NoError(t, utils.SetConfig(t, config))
|
||||
|
||||
testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/sync_committee_updates/pyspec_tests")
|
||||
for _, folder := range testFolders {
|
||||
t.Run(folder.Name(), func(t *testing.T) {
|
||||
helpers.ClearCache()
|
||||
folderPath := path.Join(testsFolderPath, folder.Name())
|
||||
RunEpochOperationTest(t, folderPath, processSyncCommitteeUpdates)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func processSyncCommitteeUpdates(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
||||
return electra.ProcessSyncCommitteeUpdates(context.Background(), st)
|
||||
}
|
||||
36
testing/spectest/shared/fulu/operations/BUILD.bazel
Normal file
36
testing/spectest/shared/fulu/operations/BUILD.bazel
Normal file
@@ -0,0 +1,36 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"attestation.go",
|
||||
"attester_slashing.go",
|
||||
"block_header.go",
|
||||
"bls_to_execution_changes.go",
|
||||
"consolidations.go",
|
||||
"deposit.go",
|
||||
"deposit_request.go",
|
||||
"execution_payload.go",
|
||||
"helpers.go",
|
||||
"proposer_slashing.go",
|
||||
"sync_committee.go",
|
||||
"voluntary_exit.go",
|
||||
"withdrawal_request.go",
|
||||
"withdrawals.go",
|
||||
],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/operations",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//beacon-chain/core/electra:go_default_library",
|
||||
"//beacon-chain/state:go_default_library",
|
||||
"//beacon-chain/state/state-native:go_default_library",
|
||||
"//consensus-types/blocks:go_default_library",
|
||||
"//consensus-types/interfaces:go_default_library",
|
||||
"//proto/engine/v1:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//runtime/version:go_default_library",
|
||||
"//testing/spectest/shared/common/operations:go_default_library",
|
||||
"//testing/util:go_default_library",
|
||||
],
|
||||
)
|
||||
27
testing/spectest/shared/fulu/operations/attestation.go
Normal file
27
testing/spectest/shared/fulu/operations/attestation.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithAttestation(attestationSSZ []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
att := ðpb.AttestationElectra{}
|
||||
if err := att.UnmarshalSSZ(attestationSSZ); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{Attestations: []*ethpb.AttestationElectra{att}}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunAttestationTest(t *testing.T, config string) {
|
||||
common.RunAttestationTest(t, config, version.String(version.Fulu), blockWithAttestation, electra.ProcessAttestationsNoVerifySignature, sszToState)
|
||||
}
|
||||
26
testing/spectest/shared/fulu/operations/attester_slashing.go
Normal file
26
testing/spectest/shared/fulu/operations/attester_slashing.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithAttesterSlashing(asSSZ []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
as := ðpb.AttesterSlashingElectra{}
|
||||
if err := as.UnmarshalSSZ(asSSZ); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{AttesterSlashings: []*ethpb.AttesterSlashingElectra{as}}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunAttesterSlashingTest(t *testing.T, config string) {
|
||||
common.RunAttesterSlashingTest(t, config, version.String(version.Fulu), blockWithAttesterSlashing, sszToState)
|
||||
}
|
||||
12
testing/spectest/shared/fulu/operations/block_header.go
Normal file
12
testing/spectest/shared/fulu/operations/block_header.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
)
|
||||
|
||||
func RunBlockHeaderTest(t *testing.T, config string) {
|
||||
common.RunBlockHeaderTest(t, config, version.String(version.Fulu), sszToBlock, sszToState)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithBlsChange(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
c := ðpb.SignedBLSToExecutionChange{}
|
||||
if err := c.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{BlsToExecutionChanges: []*ethpb.SignedBLSToExecutionChange{c}}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunBLSToExecutionChangeTest(t *testing.T, config string) {
|
||||
common.RunBLSToExecutionChangeTest(t, config, version.String(version.Fulu), blockWithBlsChange, sszToState)
|
||||
}
|
||||
30
testing/spectest/shared/fulu/operations/consolidations.go
Normal file
30
testing/spectest/shared/fulu/operations/consolidations.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
enginev1 "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithConsolidation(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
cr := &enginev1.ConsolidationRequest{}
|
||||
if err := cr.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
er := &enginev1.ExecutionRequests{
|
||||
Consolidations: []*enginev1.ConsolidationRequest{cr},
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{ExecutionRequests: er}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunConsolidationTest(t *testing.T, config string) {
|
||||
common.RunConsolidationTest(t, config, version.String(version.Fulu), blockWithConsolidation, sszToState)
|
||||
}
|
||||
27
testing/spectest/shared/fulu/operations/deposit.go
Normal file
27
testing/spectest/shared/fulu/operations/deposit.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/core/electra"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithDeposit(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
d := ðpb.Deposit{}
|
||||
if err := d.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{Deposits: []*ethpb.Deposit{d}}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunDepositTest(t *testing.T, config string) {
|
||||
common.RunDepositTest(t, config, version.String(version.Fulu), blockWithDeposit, electra.ProcessDeposits, sszToState)
|
||||
}
|
||||
30
testing/spectest/shared/fulu/operations/deposit_request.go
Normal file
30
testing/spectest/shared/fulu/operations/deposit_request.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
enginev1 "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithDepositRequest(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
dr := &enginev1.DepositRequest{}
|
||||
if err := dr.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
er := &enginev1.ExecutionRequests{
|
||||
Deposits: []*enginev1.DepositRequest{dr},
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{ExecutionRequests: er}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunDepositRequestsTest(t *testing.T, config string) {
|
||||
common.RunDepositRequestsTest(t, config, version.String(version.Fulu), blockWithDepositRequest, sszToState)
|
||||
}
|
||||
12
testing/spectest/shared/fulu/operations/execution_payload.go
Normal file
12
testing/spectest/shared/fulu/operations/execution_payload.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
)
|
||||
|
||||
func RunExecutionPayloadTest(t *testing.T, config string) {
|
||||
common.RunExecutionPayloadTest(t, config, version.String(version.Fulu), sszToBlockBody, sszToState)
|
||||
}
|
||||
33
testing/spectest/shared/fulu/operations/helpers.go
Normal file
33
testing/spectest/shared/fulu/operations/helpers.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/state"
|
||||
state_native "github.com/OffchainLabs/prysm/v6/beacon-chain/state/state-native"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
)
|
||||
|
||||
func sszToState(b []byte) (state.BeaconState, error) {
|
||||
base := ðpb.BeaconStateElectra{}
|
||||
if err := base.UnmarshalSSZ(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return state_native.InitializeFromProtoElectra(base)
|
||||
}
|
||||
|
||||
func sszToBlock(b []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
base := ðpb.BeaconBlockElectra{}
|
||||
if err := base.UnmarshalSSZ(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return blocks.NewSignedBeaconBlock(ðpb.SignedBeaconBlockElectra{Block: base})
|
||||
}
|
||||
|
||||
func sszToBlockBody(b []byte) (interfaces.ReadOnlyBeaconBlockBody, error) {
|
||||
base := ðpb.BeaconBlockBodyElectra{}
|
||||
if err := base.UnmarshalSSZ(b); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return blocks.NewBeaconBlockBody(base)
|
||||
}
|
||||
26
testing/spectest/shared/fulu/operations/proposer_slashing.go
Normal file
26
testing/spectest/shared/fulu/operations/proposer_slashing.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithProposerSlashing(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
ps := ðpb.ProposerSlashing{}
|
||||
if err := ps.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{ProposerSlashings: []*ethpb.ProposerSlashing{ps}}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunProposerSlashingTest(t *testing.T, config string) {
|
||||
common.RunProposerSlashingTest(t, config, version.String(version.Fulu), blockWithProposerSlashing, sszToState)
|
||||
}
|
||||
26
testing/spectest/shared/fulu/operations/sync_committee.go
Normal file
26
testing/spectest/shared/fulu/operations/sync_committee.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithSyncAggregate(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
sa := ðpb.SyncAggregate{}
|
||||
if err := sa.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{SyncAggregate: sa}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunSyncCommitteeTest(t *testing.T, config string) {
|
||||
common.RunSyncCommitteeTest(t, config, version.String(version.Fulu), blockWithSyncAggregate, sszToState)
|
||||
}
|
||||
26
testing/spectest/shared/fulu/operations/voluntary_exit.go
Normal file
26
testing/spectest/shared/fulu/operations/voluntary_exit.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithVoluntaryExit(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
e := ðpb.SignedVoluntaryExit{}
|
||||
if err := e.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlock()
|
||||
b.Block.Body = ðpb.BeaconBlockBody{VoluntaryExits: []*ethpb.SignedVoluntaryExit{e}}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunVoluntaryExitTest(t *testing.T, config string) {
|
||||
common.RunVoluntaryExitTest(t, config, version.String(version.Fulu), blockWithVoluntaryExit, sszToState)
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
enginev1 "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithWithdrawalRequest(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
wr := &enginev1.WithdrawalRequest{}
|
||||
if err := wr.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
er := &enginev1.ExecutionRequests{
|
||||
Withdrawals: []*enginev1.WithdrawalRequest{wr},
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{ExecutionRequests: er}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunWithdrawalRequestTest(t *testing.T, config string) {
|
||||
common.RunWithdrawalRequestTest(t, config, version.String(version.Fulu), blockWithWithdrawalRequest, sszToState)
|
||||
}
|
||||
27
testing/spectest/shared/fulu/operations/withdrawals.go
Normal file
27
testing/spectest/shared/fulu/operations/withdrawals.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package operations
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/blocks"
|
||||
"github.com/OffchainLabs/prysm/v6/consensus-types/interfaces"
|
||||
enginev1 "github.com/OffchainLabs/prysm/v6/proto/engine/v1"
|
||||
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
|
||||
"github.com/OffchainLabs/prysm/v6/runtime/version"
|
||||
common "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/common/operations"
|
||||
"github.com/OffchainLabs/prysm/v6/testing/util"
|
||||
)
|
||||
|
||||
func blockWithWithdrawals(ssz []byte) (interfaces.SignedBeaconBlock, error) {
|
||||
e := &enginev1.ExecutionPayloadDeneb{}
|
||||
if err := e.UnmarshalSSZ(ssz); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := util.NewBeaconBlockElectra()
|
||||
b.Block.Body = ðpb.BeaconBlockBodyElectra{ExecutionPayload: e}
|
||||
return blocks.NewSignedBeaconBlock(b)
|
||||
}
|
||||
|
||||
func RunWithdrawalsTest(t *testing.T, config string) {
|
||||
common.RunWithdrawalsTest(t, config, version.String(version.Fulu), blockWithWithdrawals, sszToState)
|
||||
}
|
||||
Reference in New Issue
Block a user