prysm-pulse/testing/spectest/shared/bellatrix/epoch_processing/inactivity_updates.go
Raul Jordan d077483577
Add V3 Suffix to All Prysm Packages (#11083)
* v3 import renamings

* tidy

* fmt

* rev

* Update beacon-chain/core/epoch/precompute/reward_penalty_test.go

* Update beacon-chain/core/helpers/validators_test.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/alias.go

* Update beacon-chain/db/iface/BUILD.bazel

* Update beacon-chain/db/kv/kv.go

* Update beacon-chain/db/kv/state.go

* Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go

* Update beacon-chain/rpc/prysm/v1alpha1/validator/attester_test.go

* Update beacon-chain/sync/initial-sync/service.go

* fix deps

* fix bad replacements

* fix bad replacements

* change back

* gohashtree version

* fix deps

Co-authored-by: Nishant Das <nishdas93@gmail.com>
Co-authored-by: Potuz <potuz@prysmaticlabs.com>
2022-08-16 12:20:13 +00:00

42 lines
1.3 KiB
Go

package epoch_processing
import (
"context"
"path"
"testing"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/core/altair"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/core/helpers"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/state"
"github.com/prysmaticlabs/prysm/v3/testing/require"
"github.com/prysmaticlabs/prysm/v3/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, "bellatrix", 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 := altair.InitializePrecomputeValidators(ctx, st)
require.NoError(t, err)
vp, _, err = altair.ProcessEpochParticipation(ctx, st, bp, vp)
require.NoError(t, err)
st, _, err = altair.ProcessInactivityScores(ctx, st, vp)
require.NoError(t, err, "Could not process reward")
return st, nil
}