prysm-pulse/beacon-chain/state/state-native/setters_validator_test.go
terence 5a66807989
Update to V5 (#13622)
* First take at updating everything to v5

* Patch gRPC gateway to use prysm v5

Fix patch

* Update go ssz

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
2024-02-15 05:46:47 +00:00

46 lines
1.0 KiB
Go

package state_native_test
import (
"testing"
state_native "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/testing/require"
)
func BenchmarkAppendBalance(b *testing.B) {
st, err := state_native.InitializeFromProtoPhase0(&ethpb.BeaconState{})
require.NoError(b, err)
max := uint64(16777216)
for i := uint64(0); i < max-2; i++ {
require.NoError(b, st.AppendBalance(i))
}
ref := st.Copy()
b.ResetTimer()
for i := 0; i < b.N; i++ {
require.NoError(b, ref.AppendBalance(uint64(i)))
ref = st.Copy()
}
}
func BenchmarkAppendInactivityScore(b *testing.B) {
st, err := state_native.InitializeFromProtoCapella(&ethpb.BeaconStateCapella{})
require.NoError(b, err)
max := uint64(16777216)
for i := uint64(0); i < max-2; i++ {
require.NoError(b, st.AppendInactivityScore(i))
}
ref := st.Copy()
b.ResetTimer()
for i := 0; i < b.N; i++ {
require.NoError(b, ref.AppendInactivityScore(uint64(i)))
ref = st.Copy()
}
}