mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-27 05:38:55 +00:00
d9799e6b6c
* Rename BeaconBlockBodyMerge to BeaconBlockBodyBellatrix * Rename SignedBeaconBlockMerge to SignedBeaconBlockBellatrix * Rename CopyBeaconBlockMerge to CopyBeaconBlockMerge * Rename NewBeaconBlockMerge to NewBeaconBlockBellatrix * Rename BeaconBlockMerge to BeaconBlockBellatrix * Rename some comments and strings in pkg proto: Merge -> Bellatrix * Rename PbMergeBlock to PbBellatrixBlock * Many renames of merge -> bellatrix in proto package * Rename some Merge -> Bellatrix in beacon chain package * More names * Fix formating in config/params/config.go * Rename Merge -> Bellatrix in proto/prysm/storage * Several renames and corrections Merge -> Bellatrix Co-authored-by: Potuz <potuz@potuz.net> Co-authored-by: terence tsao <terence@prysmaticlabs.com> Co-authored-by: Potuz <potuz@potuz.net> Co-authored-by: Nishant Das <nishdas93@gmail.com>
76 lines
2.8 KiB
Go
76 lines
2.8 KiB
Go
package altair_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
|
|
"github.com/prysmaticlabs/prysm/config/params"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
"github.com/prysmaticlabs/prysm/testing/util"
|
|
)
|
|
|
|
func TestProcessEpoch_CanProcess(t *testing.T) {
|
|
st, _ := util.DeterministicGenesisStateAltair(t, params.BeaconConfig().MaxValidatorsPerCommittee)
|
|
require.NoError(t, st.SetSlot(10*params.BeaconConfig().SlotsPerEpoch))
|
|
newState, err := altair.ProcessEpoch(context.Background(), st)
|
|
require.NoError(t, err)
|
|
require.Equal(t, uint64(0), newState.Slashings()[2], "Unexpected slashed balance")
|
|
|
|
b := st.Balances()
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(b)))
|
|
require.Equal(t, uint64(31999841265), b[0])
|
|
|
|
s, err := st.InactivityScores()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(s)))
|
|
|
|
p, err := st.PreviousEpochParticipation()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(p)))
|
|
|
|
p, err = st.CurrentEpochParticipation()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(p)))
|
|
|
|
sc, err := st.CurrentSyncCommittee()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().SyncCommitteeSize, uint64(len(sc.Pubkeys)))
|
|
|
|
sc, err = st.NextSyncCommittee()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().SyncCommitteeSize, uint64(len(sc.Pubkeys)))
|
|
}
|
|
|
|
func TestProcessEpoch_CanProcessBellatrix(t *testing.T) {
|
|
st, _ := util.DeterministicGenesisStateBellatrix(t, params.BeaconConfig().MaxValidatorsPerCommittee)
|
|
require.NoError(t, st.SetSlot(10*params.BeaconConfig().SlotsPerEpoch))
|
|
newState, err := altair.ProcessEpoch(context.Background(), st)
|
|
require.NoError(t, err)
|
|
require.Equal(t, uint64(0), newState.Slashings()[2], "Unexpected slashed balance")
|
|
|
|
b := st.Balances()
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(b)))
|
|
require.Equal(t, uint64(31999839993), b[0])
|
|
|
|
s, err := st.InactivityScores()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(s)))
|
|
|
|
p, err := st.PreviousEpochParticipation()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(p)))
|
|
|
|
p, err = st.CurrentEpochParticipation()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().MaxValidatorsPerCommittee, uint64(len(p)))
|
|
|
|
sc, err := st.CurrentSyncCommittee()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().SyncCommitteeSize, uint64(len(sc.Pubkeys)))
|
|
|
|
sc, err = st.NextSyncCommittee()
|
|
require.NoError(t, err)
|
|
require.Equal(t, params.BeaconConfig().SyncCommitteeSize, uint64(len(sc.Pubkeys)))
|
|
}
|