mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
* Migrate Prysm repo to Offchain Labs organization ahead of Pectra upgrade v6 * Replace prysmaticlabs with OffchainLabs on general markdowns * Update mock * Gazelle and add mock.go to excluded generated mock file
35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package migration
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
|
|
ethpbv1 "github.com/OffchainLabs/prysm/v6/proto/eth/v1"
|
|
"github.com/OffchainLabs/prysm/v6/testing/assert"
|
|
"github.com/OffchainLabs/prysm/v6/testing/require"
|
|
)
|
|
|
|
func Test_V1ValidatorToV1Alpha1(t *testing.T) {
|
|
v1Validator := ðpbv1.Validator{
|
|
Pubkey: []byte("pubkey"),
|
|
WithdrawalCredentials: []byte("withdraw"),
|
|
EffectiveBalance: 99,
|
|
Slashed: true,
|
|
ActivationEligibilityEpoch: 1,
|
|
ActivationEpoch: 11,
|
|
ExitEpoch: 111,
|
|
WithdrawableEpoch: 1111,
|
|
}
|
|
|
|
v1Alpha1Validator := V1ValidatorToV1Alpha1(v1Validator)
|
|
require.NotNil(t, v1Alpha1Validator)
|
|
assert.DeepEqual(t, []byte("pubkey"), v1Alpha1Validator.PublicKey)
|
|
assert.DeepEqual(t, []byte("withdraw"), v1Alpha1Validator.WithdrawalCredentials)
|
|
assert.Equal(t, uint64(99), v1Alpha1Validator.EffectiveBalance)
|
|
assert.Equal(t, true, v1Alpha1Validator.Slashed)
|
|
assert.Equal(t, primitives.Epoch(1), v1Alpha1Validator.ActivationEligibilityEpoch)
|
|
assert.Equal(t, primitives.Epoch(11), v1Alpha1Validator.ActivationEpoch)
|
|
assert.Equal(t, primitives.Epoch(111), v1Alpha1Validator.ExitEpoch)
|
|
assert.Equal(t, primitives.Epoch(1111), v1Alpha1Validator.WithdrawableEpoch)
|
|
}
|