mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 20:43:57 -05:00
ETH2 APIs: Update protos for new ethapis changes (#8920)
* Update protos for new changes * Fix * Fix deps * Fix build * Include newer changes to ethapis * Fix * Fix import * Do not return unconnected peers
This commit is contained in:
@@ -13,7 +13,7 @@ go_library(
|
||||
"@com_github_libp2p_go_libp2p_core//network:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
|
||||
"@com_github_multiformats_go_multiaddr//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/network"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
pbrpc "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1"
|
||||
)
|
||||
|
||||
@@ -56,7 +56,7 @@ func (bs *Server) GetBlockHeader(ctx context.Context, req *ethpb.BlockRequest) (
|
||||
Root: root[:],
|
||||
Canonical: canonical,
|
||||
Header: ðpb.BeaconBlockHeaderContainer{
|
||||
Message: v1BlockHdr.Header,
|
||||
Message: v1BlockHdr.Message,
|
||||
Signature: v1BlockHdr.Signature,
|
||||
},
|
||||
},
|
||||
@@ -104,7 +104,7 @@ func (bs *Server) ListBlockHeaders(ctx context.Context, req *ethpb.BlockHeadersR
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not determine if block root is canonical: %v", err)
|
||||
}
|
||||
root, err := blkHdr.Header.HashTreeRoot()
|
||||
root, err := blkHdr.Message.HashTreeRoot()
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not hash block header: %v", err)
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func (bs *Server) ListBlockHeaders(ctx context.Context, req *ethpb.BlockHeadersR
|
||||
Root: root[:],
|
||||
Canonical: canonical,
|
||||
Header: ðpb.BeaconBlockHeaderContainer{
|
||||
Message: blkHdr.Header,
|
||||
Message: blkHdr.Message,
|
||||
Signature: blkHdr.Signature,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ func TestServer_GetBlockHeader(t *testing.T) {
|
||||
blkHdr, err := migration.V1Alpha1BlockToV1BlockHeader(tt.want)
|
||||
require.NoError(t, err)
|
||||
|
||||
if !reflect.DeepEqual(header.Data.Header.Message, blkHdr.Header) {
|
||||
if !reflect.DeepEqual(header.Data.Header.Message, blkHdr.Message) {
|
||||
t.Error("Expected blocks to equal")
|
||||
}
|
||||
})
|
||||
@@ -230,7 +230,7 @@ func TestServer_ListBlockHeaders(t *testing.T) {
|
||||
signedHdr, err := migration.V1Alpha1BlockToV1BlockHeader(blk)
|
||||
require.NoError(t, err)
|
||||
|
||||
if !reflect.DeepEqual(headers.Data[i].Header.Message, signedHdr.Header) {
|
||||
if !reflect.DeepEqual(headers.Data[i].Header.Message, signedHdr.Message) {
|
||||
t.Error("Expected blocks to equal")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ func (bs *Server) SubmitVoluntaryExit(ctx context.Context, req *ethpb.SignedVolu
|
||||
return nil, status.Errorf(codes.Internal, "Could not get head state: %v", err)
|
||||
}
|
||||
|
||||
validator, err := headState.ValidatorAtIndexReadOnly(req.Exit.ValidatorIndex)
|
||||
validator, err := headState.ValidatorAtIndexReadOnly(req.Message.ValidatorIndex)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get exiting validator: %v", err)
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ func TestListPoolAttestations(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 4, len(resp.Data))
|
||||
for _, datum := range resp.Data {
|
||||
assert.DeepEqual(t, datum.Data.CommitteeIndex, index)
|
||||
assert.DeepEqual(t, datum.Data.Index, index)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -182,7 +182,7 @@ func TestListPoolAttestations(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 2, len(resp.Data))
|
||||
for _, datum := range resp.Data {
|
||||
assert.DeepEqual(t, datum.Data.CommitteeIndex, index)
|
||||
assert.DeepEqual(t, datum.Data.Index, index)
|
||||
assert.DeepEqual(t, datum.Data.Slot, slot)
|
||||
}
|
||||
})
|
||||
@@ -385,7 +385,7 @@ func TestSubmitAttesterSlashing_Ok(t *testing.T) {
|
||||
AttestingIndices: []uint64{0},
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
Index: 1,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("blockroot1"), 32),
|
||||
Source: ðpb.Checkpoint{
|
||||
Epoch: 1,
|
||||
@@ -402,7 +402,7 @@ func TestSubmitAttesterSlashing_Ok(t *testing.T) {
|
||||
AttestingIndices: []uint64{0},
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
Index: 1,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("blockroot2"), 32),
|
||||
Source: ðpb.Checkpoint{
|
||||
Epoch: 1,
|
||||
@@ -449,7 +449,7 @@ func TestSubmitAttesterSlashing_InvalidSlashing(t *testing.T) {
|
||||
AttestingIndices: []uint64{0},
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 1,
|
||||
CommitteeIndex: 1,
|
||||
Index: 1,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("blockroot1"), 32),
|
||||
Source: ðpb.Checkpoint{
|
||||
Epoch: 1,
|
||||
@@ -496,8 +496,8 @@ func TestSubmitProposerSlashing_Ok(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
slashing := ðpb.ProposerSlashing{
|
||||
Header_1: ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
SignedHeader_1: ðpb.SignedBeaconBlockHeader{
|
||||
Message: ðpb.BeaconBlockHeader{
|
||||
Slot: 1,
|
||||
ProposerIndex: 0,
|
||||
ParentRoot: bytesutil.PadTo([]byte("parentroot1"), 32),
|
||||
@@ -506,8 +506,8 @@ func TestSubmitProposerSlashing_Ok(t *testing.T) {
|
||||
},
|
||||
Signature: make([]byte, 96),
|
||||
},
|
||||
Header_2: ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
SignedHeader_2: ðpb.SignedBeaconBlockHeader{
|
||||
Message: ðpb.BeaconBlockHeader{
|
||||
Slot: 1,
|
||||
ProposerIndex: 0,
|
||||
ParentRoot: bytesutil.PadTo([]byte("parentroot2"), 32),
|
||||
@@ -518,11 +518,11 @@ func TestSubmitProposerSlashing_Ok(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
for _, h := range []*ethpb.SignedBeaconBlockHeader{slashing.Header_1, slashing.Header_2} {
|
||||
for _, h := range []*ethpb.SignedBeaconBlockHeader{slashing.SignedHeader_1, slashing.SignedHeader_2} {
|
||||
sb, err := helpers.ComputeDomainAndSign(
|
||||
state,
|
||||
helpers.SlotToEpoch(h.Header.Slot),
|
||||
h.Header,
|
||||
helpers.SlotToEpoch(h.Message.Slot),
|
||||
h.Message,
|
||||
params.BeaconConfig().DomainBeaconProposer,
|
||||
keys[0],
|
||||
)
|
||||
@@ -553,7 +553,7 @@ func TestSubmitProposerSlashing_InvalidSlashing(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
header := ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
Message: ðpb.BeaconBlockHeader{
|
||||
Slot: 1,
|
||||
ProposerIndex: 0,
|
||||
ParentRoot: bytesutil.PadTo([]byte("parentroot1"), 32),
|
||||
@@ -564,8 +564,8 @@ func TestSubmitProposerSlashing_InvalidSlashing(t *testing.T) {
|
||||
}
|
||||
|
||||
slashing := ðpb.ProposerSlashing{
|
||||
Header_1: header,
|
||||
Header_2: header,
|
||||
SignedHeader_1: header,
|
||||
SignedHeader_2: header,
|
||||
}
|
||||
|
||||
broadcaster := &p2pMock.MockBroadcaster{}
|
||||
@@ -598,14 +598,14 @@ func TestSubmitVoluntaryExit_Ok(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
exit := ðpb.SignedVoluntaryExit{
|
||||
Exit: ðpb.VoluntaryExit{
|
||||
Message: ðpb.VoluntaryExit{
|
||||
Epoch: 0,
|
||||
ValidatorIndex: 0,
|
||||
},
|
||||
Signature: make([]byte, 96),
|
||||
}
|
||||
|
||||
sb, err := helpers.ComputeDomainAndSign(state, exit.Exit.Epoch, exit.Exit, params.BeaconConfig().DomainVoluntaryExit, keys[0])
|
||||
sb, err := helpers.ComputeDomainAndSign(state, exit.Message.Epoch, exit.Message, params.BeaconConfig().DomainVoluntaryExit, keys[0])
|
||||
require.NoError(t, err)
|
||||
sig, err := bls.SignatureFromBytes(sb)
|
||||
require.NoError(t, err)
|
||||
@@ -642,7 +642,7 @@ func TestSubmitVoluntaryExit_InvalidValidatorIndex(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
exit := ðpb.SignedVoluntaryExit{
|
||||
Exit: ðpb.VoluntaryExit{
|
||||
Message: ðpb.VoluntaryExit{
|
||||
Epoch: 0,
|
||||
ValidatorIndex: 99,
|
||||
},
|
||||
@@ -677,7 +677,7 @@ func TestSubmitVoluntaryExit_InvalidExit(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
exit := ðpb.SignedVoluntaryExit{
|
||||
Exit: ðpb.VoluntaryExit{
|
||||
Message: ðpb.VoluntaryExit{
|
||||
Epoch: 0,
|
||||
ValidatorIndex: 0,
|
||||
},
|
||||
@@ -733,7 +733,7 @@ func TestServer_SubmitAttestations_Ok(t *testing.T) {
|
||||
AggregationBits: b,
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 0,
|
||||
CommitteeIndex: 0,
|
||||
Index: 0,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("beaconblockroot1"), 32),
|
||||
Source: sourceCheckpoint,
|
||||
Target: ðpb.Checkpoint{
|
||||
@@ -747,7 +747,7 @@ func TestServer_SubmitAttestations_Ok(t *testing.T) {
|
||||
AggregationBits: b,
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 0,
|
||||
CommitteeIndex: 0,
|
||||
Index: 0,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("beaconblockroot2"), 32),
|
||||
Source: sourceCheckpoint,
|
||||
Target: ðpb.Checkpoint{
|
||||
@@ -838,7 +838,7 @@ func TestServer_SubmitAttestations_ValidAttestationSubmitted(t *testing.T) {
|
||||
AggregationBits: b,
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 0,
|
||||
CommitteeIndex: 0,
|
||||
Index: 0,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("beaconblockroot1"), 32),
|
||||
Source: sourceCheckpoint,
|
||||
Target: ðpb.Checkpoint{
|
||||
@@ -852,7 +852,7 @@ func TestServer_SubmitAttestations_ValidAttestationSubmitted(t *testing.T) {
|
||||
AggregationBits: b,
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 0,
|
||||
CommitteeIndex: 0,
|
||||
Index: 0,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("beaconblockroot2"), 32),
|
||||
Source: ðpb.Checkpoint{
|
||||
Epoch: 0,
|
||||
@@ -869,7 +869,7 @@ func TestServer_SubmitAttestations_ValidAttestationSubmitted(t *testing.T) {
|
||||
AggregationBits: b,
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: 0,
|
||||
CommitteeIndex: 0,
|
||||
Index: 0,
|
||||
BeaconBlockRoot: bytesutil.PadTo([]byte("beaconblockroot2"), 32),
|
||||
Source: sourceCheckpoint,
|
||||
Target: ðpb.Checkpoint{
|
||||
|
||||
@@ -66,7 +66,7 @@ func (bs *Server) GetStateRoot(ctx context.Context, req *ethpb.StateRequest) (*e
|
||||
|
||||
return ðpb.StateRootResponse{
|
||||
Data: ðpb.StateRootResponse_StateRoot{
|
||||
StateRoot: root,
|
||||
Root: root,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func TestGetStateRoot(t *testing.T) {
|
||||
StateId: []byte("head"),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("head"), 32), resp.Data.StateRoot)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("head"), 32), resp.Data.Root)
|
||||
})
|
||||
|
||||
t.Run("Genesis", func(t *testing.T) {
|
||||
@@ -112,7 +112,7 @@ func TestGetStateRoot(t *testing.T) {
|
||||
StateId: []byte("genesis"),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("genesis"), 32), resp.Data.StateRoot)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("genesis"), 32), resp.Data.Root)
|
||||
})
|
||||
|
||||
t.Run("Finalized", func(t *testing.T) {
|
||||
@@ -137,7 +137,7 @@ func TestGetStateRoot(t *testing.T) {
|
||||
StateId: []byte("finalized"),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("finalized"), 32), resp.Data.StateRoot)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("finalized"), 32), resp.Data.Root)
|
||||
})
|
||||
|
||||
t.Run("Justified", func(t *testing.T) {
|
||||
@@ -162,7 +162,7 @@ func TestGetStateRoot(t *testing.T) {
|
||||
StateId: []byte("justified"),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("justified"), 32), resp.Data.StateRoot)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("justified"), 32), resp.Data.Root)
|
||||
})
|
||||
|
||||
t.Run("Hex root", func(t *testing.T) {
|
||||
@@ -180,7 +180,7 @@ func TestGetStateRoot(t *testing.T) {
|
||||
StateId: stateId,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, stateId, resp.Data.StateRoot)
|
||||
assert.DeepEqual(t, stateId, resp.Data.Root)
|
||||
})
|
||||
|
||||
t.Run("Hex root not found", func(t *testing.T) {
|
||||
@@ -214,7 +214,7 @@ func TestGetStateRoot(t *testing.T) {
|
||||
StateId: []byte("100"),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("slot"), 32), resp.Data.StateRoot)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("slot"), 32), resp.Data.Root)
|
||||
})
|
||||
|
||||
t.Run("Multiple slots", func(t *testing.T) {
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestGetValidator(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, types.ValidatorIndex(20), resp.Data.Index)
|
||||
assert.Equal(t, true, bytes.Equal(pubKey[:], resp.Data.Validator.PublicKey))
|
||||
assert.Equal(t, true, bytes.Equal(pubKey[:], resp.Data.Validator.Pubkey))
|
||||
})
|
||||
|
||||
t.Run("Hex root not found", func(t *testing.T) {
|
||||
@@ -152,7 +152,7 @@ func TestListValidators(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
for i, val := range resp.Data {
|
||||
assert.Equal(t, idNums[i], val.Index)
|
||||
assert.Equal(t, true, bytes.Equal(pubKeys[i], val.Validator.PublicKey))
|
||||
assert.Equal(t, true, bytes.Equal(pubKeys[i], val.Validator.Pubkey))
|
||||
}
|
||||
})
|
||||
|
||||
@@ -177,7 +177,7 @@ func TestListValidators(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
for i, val := range resp.Data {
|
||||
assert.Equal(t, idNums[i], val.Index)
|
||||
assert.Equal(t, true, bytes.Equal(pubkeys[i], val.Validator.PublicKey))
|
||||
assert.Equal(t, true, bytes.Equal(pubkeys[i], val.Validator.Pubkey))
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -16,10 +16,12 @@ go_library(
|
||||
"//beacon-chain/p2p/peers:go_default_library",
|
||||
"//beacon-chain/p2p/peers/peerdata:go_default_library",
|
||||
"//beacon-chain/sync:go_default_library",
|
||||
"//proto/migration:go_default_library",
|
||||
"//shared/version:go_default_library",
|
||||
"@com_github_libp2p_go_libp2p_core//peer:go_default_library",
|
||||
"@com_github_pkg_errors//:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@io_opencensus_go//trace:go_default_library",
|
||||
"@org_golang_google_grpc//:go_default_library",
|
||||
"@org_golang_google_grpc//codes:go_default_library",
|
||||
|
||||
@@ -9,9 +9,11 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
ethpb_alpha "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/peerdata"
|
||||
"github.com/prysmaticlabs/prysm/proto/migration"
|
||||
"github.com/prysmaticlabs/prysm/shared/version"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -105,14 +107,22 @@ func (ns *Server) GetPeer(ctx context.Context, req *ethpb.PeerRequest) (*ethpb.P
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not obtain direction: %v", err)
|
||||
}
|
||||
if ethpb_alpha.PeerDirection(direction) == ethpb_alpha.PeerDirection_UNKNOWN {
|
||||
return nil, status.Error(codes.NotFound, "Peer not found")
|
||||
}
|
||||
|
||||
v1ConnState := migration.V1Alpha1ConnectionStateToV1(ethpb_alpha.ConnectionState(state))
|
||||
v1PeerDirection, err := migration.V1Alpha1PeerDirectionToV1(ethpb_alpha.PeerDirection(direction))
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not handle peer direction: %v", err)
|
||||
}
|
||||
return ðpb.PeerResponse{
|
||||
Data: ðpb.Peer{
|
||||
PeerId: req.PeerId,
|
||||
Enr: "enr:" + serializedEnr,
|
||||
Address: p2pAddress.String(),
|
||||
State: ethpb.ConnectionState(state),
|
||||
Direction: ethpb.PeerDirection(direction),
|
||||
PeerId: req.PeerId,
|
||||
Enr: "enr:" + serializedEnr,
|
||||
LastSeenP2PAddress: p2pAddress.String(),
|
||||
State: v1ConnState,
|
||||
Direction: v1PeerDirection,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@@ -133,6 +143,9 @@ func (ns *Server) ListPeers(ctx context.Context, req *ethpb.PeersRequest) (*ethp
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get peer info: %v", err)
|
||||
}
|
||||
if p == nil {
|
||||
continue
|
||||
}
|
||||
allPeers = append(allPeers, p)
|
||||
}
|
||||
return ðpb.PeersResponse{Data: allPeers}, nil
|
||||
@@ -201,8 +214,14 @@ func (ns *Server) ListPeers(ctx context.Context, req *ethpb.PeersRequest) (*ethp
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not get peer info: %v", err)
|
||||
}
|
||||
if p == nil {
|
||||
continue
|
||||
}
|
||||
filteredPeers = append(filteredPeers, p)
|
||||
}
|
||||
if len(filteredPeers) == 0 {
|
||||
return nil, status.Error(codes.NotFound, "Peers not found")
|
||||
}
|
||||
return ðpb.PeersResponse{Data: filteredPeers}, nil
|
||||
}
|
||||
|
||||
@@ -319,13 +338,21 @@ func peerInfo(peerStatus *peers.Status, id peer.ID) (*ethpb.Peer, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not obtain direction")
|
||||
}
|
||||
if ethpb_alpha.PeerDirection(direction) == ethpb_alpha.PeerDirection_UNKNOWN {
|
||||
return nil, nil
|
||||
}
|
||||
v1ConnState := migration.V1Alpha1ConnectionStateToV1(ethpb_alpha.ConnectionState(connectionState))
|
||||
v1PeerDirection, err := migration.V1Alpha1PeerDirectionToV1(ethpb_alpha.PeerDirection(direction))
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "Could not handle peer direction: %v", err)
|
||||
}
|
||||
p := ethpb.Peer{
|
||||
PeerId: id.Pretty(),
|
||||
State: ethpb.ConnectionState(connectionState),
|
||||
Direction: ethpb.PeerDirection(direction),
|
||||
State: v1ConnState,
|
||||
Direction: v1PeerDirection,
|
||||
}
|
||||
if address != nil {
|
||||
p.Address = address.String()
|
||||
p.LastSeenP2PAddress = address.String()
|
||||
}
|
||||
if serializedEnr != "" {
|
||||
p.Enr = "enr:" + serializedEnr
|
||||
|
||||
@@ -193,7 +193,7 @@ func TestGetPeer(t *testing.T) {
|
||||
resp, err := s.GetPeer(ctx, ðpb.PeerRequest{PeerId: rawId})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, rawId, resp.Data.PeerId)
|
||||
assert.Equal(t, p2pAddr, resp.Data.Address)
|
||||
assert.Equal(t, p2pAddr, resp.Data.LastSeenP2PAddress)
|
||||
assert.Equal(t, "enr:yoABgmlwhAcHBwc=", resp.Data.Enr)
|
||||
assert.Equal(t, ethpb.ConnectionState_DISCONNECTED, resp.Data.State)
|
||||
assert.Equal(t, ethpb.PeerDirection_INBOUND, resp.Data.Direction)
|
||||
@@ -276,7 +276,7 @@ func TestListPeers(t *testing.T) {
|
||||
assert.Equal(t, "enr:"+serializedEnr, returnedPeer.Enr)
|
||||
expectedP2PAddr, err := peerStatus.Address(expectedId)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expectedP2PAddr.String(), returnedPeer.Address)
|
||||
assert.Equal(t, expectedP2PAddr.String(), returnedPeer.LastSeenP2PAddress)
|
||||
assert.Equal(t, ethpb.ConnectionState_CONNECTING, returnedPeer.State)
|
||||
assert.Equal(t, ethpb.PeerDirection_INBOUND, returnedPeer.Direction)
|
||||
})
|
||||
@@ -291,7 +291,7 @@ func TestListPeers(t *testing.T) {
|
||||
name: "No filters - return all peers",
|
||||
states: []string{},
|
||||
directions: []string{},
|
||||
wantIds: ids,
|
||||
wantIds: ids[:len(ids)-1], // Excluding last peer as it is not connected.
|
||||
},
|
||||
{
|
||||
name: "State filter empty - return peers for all states",
|
||||
@@ -327,7 +327,7 @@ func TestListPeers(t *testing.T) {
|
||||
name: "Only unknown filters - return all peers",
|
||||
states: []string{"foo"},
|
||||
directions: []string{"bar"},
|
||||
wantIds: ids,
|
||||
wantIds: ids[:len(ids)-1], // Excluding last peer as it is not connected.
|
||||
},
|
||||
{
|
||||
name: "Letter case does not matter",
|
||||
|
||||
@@ -255,7 +255,7 @@ func (b *BeaconState) ToProto() (*v1.BeaconState, error) {
|
||||
resultValidators := make([]*v1.Validator, len(sourceValidators))
|
||||
for i, validator := range sourceValidators {
|
||||
resultValidators[i] = &v1.Validator{
|
||||
PublicKey: validator.PublicKey,
|
||||
Pubkey: validator.PublicKey,
|
||||
WithdrawalCredentials: validator.WithdrawalCredentials,
|
||||
EffectiveBalance: validator.EffectiveBalance,
|
||||
Slashed: validator.Slashed,
|
||||
@@ -272,7 +272,7 @@ func (b *BeaconState) ToProto() (*v1.BeaconState, error) {
|
||||
AggregationBits: att.AggregationBits,
|
||||
Data: &v1.AttestationData{
|
||||
Slot: data.Slot,
|
||||
CommitteeIndex: data.CommitteeIndex,
|
||||
Index: data.CommitteeIndex,
|
||||
BeaconBlockRoot: data.BeaconBlockRoot,
|
||||
Source: &v1.Checkpoint{
|
||||
Epoch: data.Source.Epoch,
|
||||
@@ -294,7 +294,7 @@ func (b *BeaconState) ToProto() (*v1.BeaconState, error) {
|
||||
AggregationBits: att.AggregationBits,
|
||||
Data: &v1.AttestationData{
|
||||
Slot: data.Slot,
|
||||
CommitteeIndex: data.CommitteeIndex,
|
||||
Index: data.CommitteeIndex,
|
||||
BeaconBlockRoot: data.BeaconBlockRoot,
|
||||
Source: &v1.Checkpoint{
|
||||
Epoch: data.Source.Epoch,
|
||||
|
||||
@@ -388,7 +388,7 @@ func TestBeaconState_ToProto(t *testing.T) {
|
||||
require.Equal(t, 1, len(result.Validators))
|
||||
resultValidator := result.Validators[0]
|
||||
require.NotNil(t, resultValidator)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("publickey"), 48), resultValidator.PublicKey)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("publickey"), 48), resultValidator.Pubkey)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("withdrawalcredentials"), 32), resultValidator.WithdrawalCredentials)
|
||||
assert.Equal(t, uint64(9), resultValidator.EffectiveBalance)
|
||||
assert.Equal(t, true, resultValidator.Slashed)
|
||||
@@ -406,7 +406,7 @@ func TestBeaconState_ToProto(t *testing.T) {
|
||||
resultPrevEpochAttData := resultPrevEpochAtt.Data
|
||||
require.NotNil(t, resultPrevEpochAttData)
|
||||
assert.Equal(t, types.Slot(17), resultPrevEpochAttData.Slot)
|
||||
assert.Equal(t, types.CommitteeIndex(18), resultPrevEpochAttData.CommitteeIndex)
|
||||
assert.Equal(t, types.CommitteeIndex(18), resultPrevEpochAttData.Index)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("peabeaconblockroot"), 32), resultPrevEpochAttData.BeaconBlockRoot)
|
||||
resultPrevEpochAttSource := resultPrevEpochAttData.Source
|
||||
require.NotNil(t, resultPrevEpochAttSource)
|
||||
@@ -424,7 +424,7 @@ func TestBeaconState_ToProto(t *testing.T) {
|
||||
resultCurrEpochAttData := resultCurrEpochAtt.Data
|
||||
require.NotNil(t, resultCurrEpochAttData)
|
||||
assert.Equal(t, types.Slot(24), resultCurrEpochAttData.Slot)
|
||||
assert.Equal(t, types.CommitteeIndex(25), resultCurrEpochAttData.CommitteeIndex)
|
||||
assert.Equal(t, types.CommitteeIndex(25), resultCurrEpochAttData.Index)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("ceabeaconblockroot"), 32), resultCurrEpochAttData.BeaconBlockRoot)
|
||||
resultCurrEpochAttSource := resultCurrEpochAttData.Source
|
||||
require.NotNil(t, resultCurrEpochAttSource)
|
||||
|
||||
32
deps.bzl
32
deps.bzl
@@ -2745,14 +2745,14 @@ def prysm_deps():
|
||||
name = "com_github_prysmaticlabs_ethereumapis",
|
||||
build_file_generation = "off",
|
||||
importpath = "github.com/prysmaticlabs/ethereumapis",
|
||||
sum = "h1:U5zOAU9BMuY/i4OZ/82fbgDEUmSDoqTM6rwwiAnDPC4=",
|
||||
version = "v0.0.0-20210511185220-89fcd65925ac",
|
||||
sum = "h1:WawW3Bwrgj96kQ15Bfrhy8Yb3Frc54K8wpaoFDBh7fw=",
|
||||
version = "v0.0.0-20210523153729-7bb446ee5dbb",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_prysmaticlabs_go_bitfield",
|
||||
importpath = "github.com/prysmaticlabs/go-bitfield",
|
||||
sum = "h1:18+Qqobq3HAUY0hgIhPGSqmLFnaLLocemmU7+Sj2aYQ=",
|
||||
version = "v0.0.0-20210202205921-7fcea7c45dc8",
|
||||
sum = "h1:n1fCZPIMlcNQ3iCN5w4vxmFFNWhEdEz3ICTerxjUFvA=",
|
||||
version = "v0.0.0-20210515192923-def021850363",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
@@ -3302,8 +3302,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "com_github_yuin_goldmark",
|
||||
importpath = "github.com/yuin/goldmark",
|
||||
sum = "h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=",
|
||||
version = "v1.2.1",
|
||||
sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=",
|
||||
version = "v1.3.5",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
@@ -3744,15 +3744,15 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "org_golang_x_mod",
|
||||
importpath = "golang.org/x/mod",
|
||||
sum = "h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=",
|
||||
version = "v0.3.0",
|
||||
sum = "h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=",
|
||||
version = "v0.4.2",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
name = "org_golang_x_net",
|
||||
importpath = "golang.org/x/net",
|
||||
sum = "h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=",
|
||||
version = "v0.0.0-20210316092652-d523dce5a7f4",
|
||||
sum = "h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=",
|
||||
version = "v0.0.0-20210405180319-a5a99cb37ef4",
|
||||
)
|
||||
go_repository(
|
||||
name = "org_golang_x_oauth2",
|
||||
@@ -3764,14 +3764,14 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "org_golang_x_sync",
|
||||
importpath = "golang.org/x/sync",
|
||||
sum = "h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=",
|
||||
version = "v0.0.0-20201020160332-67f06af15bc9",
|
||||
sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=",
|
||||
version = "v0.0.0-20210220032951-036812b2e83c",
|
||||
)
|
||||
go_repository(
|
||||
name = "org_golang_x_sys",
|
||||
importpath = "golang.org/x/sys",
|
||||
sum = "h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=",
|
||||
version = "v0.0.0-20210320140829-1e4c9ba3b0c4",
|
||||
sum = "h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=",
|
||||
version = "v0.0.0-20210510120138-977fb7262007",
|
||||
)
|
||||
go_repository(
|
||||
name = "org_golang_x_term",
|
||||
@@ -3795,8 +3795,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "org_golang_x_tools",
|
||||
importpath = "golang.org/x/tools",
|
||||
sum = "h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=",
|
||||
version = "v0.1.0",
|
||||
sum = "h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs=",
|
||||
version = "v0.1.1",
|
||||
)
|
||||
|
||||
go_repository(
|
||||
|
||||
8
go.mod
8
go.mod
@@ -87,8 +87,8 @@ require (
|
||||
github.com/prometheus/prom2json v1.3.0
|
||||
github.com/prometheus/tsdb v0.10.0 // indirect
|
||||
github.com/prysmaticlabs/eth2-types v0.0.0-20210303084904-c9735a06829d
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20210511185220-89fcd65925ac
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210202205921-7fcea7c45dc8
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20210523153729-7bb446ee5dbb
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210515192923-def021850363
|
||||
github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c
|
||||
github.com/rs/cors v1.7.0
|
||||
github.com/schollz/progressbar/v3 v3.3.4
|
||||
@@ -109,8 +109,8 @@ require (
|
||||
go.uber.org/automaxprocs v1.3.0
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
|
||||
golang.org/x/exp v0.0.0-20200513190911-00229845015e
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
|
||||
golang.org/x/tools v0.1.0
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
golang.org/x/tools v0.1.1
|
||||
google.golang.org/api v0.34.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210426193834-eac7f76ac494
|
||||
|
||||
28
go.sum
28
go.sum
@@ -493,7 +493,6 @@ github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7
|
||||
github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88 h1:bcAj8KroPf552TScjFPIakjH2/tdIrIH8F+cc4v4SRo=
|
||||
github.com/huin/goupnp v1.0.1-0.20210310174557-0ca763054c88/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo=
|
||||
github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o=
|
||||
github.com/iancoleman/strcase v0.1.3/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
|
||||
github.com/ianlancetaylor/cgosymbolizer v0.0.0-20200424224625-be1b05b0b279 h1:IpTHAzWv1pKDDWeJDY5VOHvqc2T9d3C8cPKEf2VPqHE=
|
||||
github.com/ianlancetaylor/cgosymbolizer v0.0.0-20200424224625-be1b05b0b279/go.mod h1:a5aratAVTWyz+nJMmDsN8O4XTfaLfdAsB1ysCmZX5Bw=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
@@ -1083,16 +1082,14 @@ github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20210420143944-f4dfc9744288 h1
|
||||
github.com/prysmaticlabs/bazel-go-ethereum v0.0.0-20210420143944-f4dfc9744288/go.mod h1:YmSRTZNqAvVUg3BIG8uhT/BOkFk9+R2iCbxw5zOlnWY=
|
||||
github.com/prysmaticlabs/eth2-types v0.0.0-20210303084904-c9735a06829d h1:1dN7YAqMN3oAJ0LceWcyv/U4jHLh+5urnSnr4br6zg4=
|
||||
github.com/prysmaticlabs/eth2-types v0.0.0-20210303084904-c9735a06829d/go.mod h1:kOmQ/zdobQf7HUohDTifDNFEZfNaSCIY5fkONPL+dWU=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20210511185220-89fcd65925ac h1:U5zOAU9BMuY/i4OZ/82fbgDEUmSDoqTM6rwwiAnDPC4=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20210511185220-89fcd65925ac/go.mod h1:AMNMSxnHZ4dVrrDqy74hlDwZfQNFm36cfjUOPFRNx+Y=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210108222456-8e92c3709aa0/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210202205921-7fcea7c45dc8 h1:18+Qqobq3HAUY0hgIhPGSqmLFnaLLocemmU7+Sj2aYQ=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210202205921-7fcea7c45dc8/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20210523153729-7bb446ee5dbb h1:WawW3Bwrgj96kQ15Bfrhy8Yb3Frc54K8wpaoFDBh7fw=
|
||||
github.com/prysmaticlabs/ethereumapis v0.0.0-20210523153729-7bb446ee5dbb/go.mod h1:4sAgDKJxeCcCo9D5etidDeP9SXkOQqhWwroirwQ4ayI=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210515192923-def021850363 h1:n1fCZPIMlcNQ3iCN5w4vxmFFNWhEdEz3ICTerxjUFvA=
|
||||
github.com/prysmaticlabs/go-bitfield v0.0.0-20210515192923-def021850363/go.mod h1:hCwmef+4qXWjv0jLDbQdWnL0Ol7cS7/lCSS26WR+u6s=
|
||||
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20210524084005-787489c53c84 h1:0v/JSzw2zi7K/vPQ2MImHEeAVSJlHBgZWgZhqX8XNIg=
|
||||
github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20210524084005-787489c53c84/go.mod h1:IOyTYjcIO0rkmnGBfJTL0NJ11exy/Tc2QEuv7hCXp24=
|
||||
github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c h1:9PHRCuO/VN0s9k+RmLykho7AjDxblNYI5bYKed16NPU=
|
||||
github.com/prysmaticlabs/prombbolt v0.0.0-20210126082820-9b7adba6db7c/go.mod h1:ZRws458tYHS/Zs936OQ6oCrL+Ict5O4Xpwve1UQ6C9M=
|
||||
github.com/prysmaticlabs/protoc-gen-go-cast v0.0.0-20210504233148-1e141af6a0a1/go.mod h1:au9l1XcWNEKixIlSRzEe54fYGhyELWgJJIxKu8W75Mc=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc=
|
||||
@@ -1234,6 +1231,7 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
|
||||
@@ -1337,8 +1335,9 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -1387,8 +1386,9 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 h1:b0LrWgu8+q7z4J+0Y3Umo5q1dL7NXBkKBWkaVkAq17E=
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -1407,8 +1407,9 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -1481,8 +1482,10 @@ golang.org/x/sys v0.0.0-20210105210732-16f7687f5001/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
@@ -1563,8 +1566,9 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs=
|
||||
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
||||
@@ -3,7 +3,10 @@ load("@prysm//tools/go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["migration.go"],
|
||||
srcs = [
|
||||
"enums.go",
|
||||
"migration.go",
|
||||
],
|
||||
importpath = "github.com/prysmaticlabs/prysm/proto/migration",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
@@ -16,7 +19,10 @@ go_library(
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["migration_test.go"],
|
||||
srcs = [
|
||||
"enums_test.go",
|
||||
"migration_test.go",
|
||||
],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//shared/bytesutil:go_default_library",
|
||||
|
||||
22
proto/migration/enums.go
Normal file
22
proto/migration/enums.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
ethpb_alpha "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
)
|
||||
|
||||
func V1Alpha1ConnectionStateToV1(connState ethpb_alpha.ConnectionState) ethpb.ConnectionState {
|
||||
alphaString := connState.String()
|
||||
v1Value := ethpb.ConnectionState_value[alphaString]
|
||||
return ethpb.ConnectionState(v1Value)
|
||||
}
|
||||
|
||||
func V1Alpha1PeerDirectionToV1(peerDirection ethpb_alpha.PeerDirection) (ethpb.PeerDirection, error) {
|
||||
alphaString := peerDirection.String()
|
||||
if alphaString == ethpb_alpha.PeerDirection_UNKNOWN.String() {
|
||||
return 0, errors.New("peer direction unknown")
|
||||
}
|
||||
v1Value := ethpb.PeerDirection_value[alphaString]
|
||||
return ethpb.PeerDirection(v1Value), nil
|
||||
}
|
||||
82
proto/migration/enums_test.go
Normal file
82
proto/migration/enums_test.go
Normal file
@@ -0,0 +1,82 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
v1 "github.com/prysmaticlabs/ethereumapis/eth/v1"
|
||||
eth "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
)
|
||||
|
||||
func TestV1Alpha1ConnectionStateToV1(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
connState eth.ConnectionState
|
||||
want v1.ConnectionState
|
||||
}{
|
||||
{
|
||||
name: "DISCONNECTED",
|
||||
connState: eth.ConnectionState_DISCONNECTED,
|
||||
want: v1.ConnectionState_DISCONNECTED,
|
||||
},
|
||||
{
|
||||
name: "CONNECTED",
|
||||
connState: eth.ConnectionState_CONNECTED,
|
||||
want: v1.ConnectionState_CONNECTED,
|
||||
},
|
||||
{
|
||||
name: "CONNECTING",
|
||||
connState: eth.ConnectionState_CONNECTING,
|
||||
want: v1.ConnectionState_CONNECTING,
|
||||
},
|
||||
{
|
||||
name: "DISCONNECTING",
|
||||
connState: eth.ConnectionState_DISCONNECTING,
|
||||
want: v1.ConnectionState_DISCONNECTING,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := V1Alpha1ConnectionStateToV1(tt.connState); got != tt.want {
|
||||
t.Errorf("V1Alpha1ConnectionStateToV1() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestV1Alpha1PeerDirectionToV1(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
peerDirection eth.PeerDirection
|
||||
want v1.PeerDirection
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "UNKNOWN",
|
||||
peerDirection: eth.PeerDirection_UNKNOWN,
|
||||
want: 0,
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "INBOUND",
|
||||
peerDirection: eth.PeerDirection_INBOUND,
|
||||
want: v1.PeerDirection_INBOUND,
|
||||
},
|
||||
{
|
||||
name: "OUTBOUND",
|
||||
peerDirection: eth.PeerDirection_OUTBOUND,
|
||||
want: v1.PeerDirection_OUTBOUND,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := V1Alpha1PeerDirectionToV1(tt.peerDirection)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("V1Alpha1PeerDirectionToV1() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Errorf("V1Alpha1PeerDirectionToV1() got = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ func V1Alpha1BlockToV1BlockHeader(block *ethpb_alpha.SignedBeaconBlock) (*ethpb.
|
||||
return nil, errors.Wrap(err, "failed to get body root of block")
|
||||
}
|
||||
return ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
Message: ðpb.BeaconBlockHeader{
|
||||
Slot: block.Block.Slot,
|
||||
ProposerIndex: block.Block.ProposerIndex,
|
||||
ParentRoot: block.Block.ParentRoot,
|
||||
@@ -82,7 +82,7 @@ func V1Alpha1AttDataToV1(v1alpha1AttData *ethpb_alpha.AttestationData) *ethpb.At
|
||||
}
|
||||
return ðpb.AttestationData{
|
||||
Slot: v1alpha1AttData.Slot,
|
||||
CommitteeIndex: v1alpha1AttData.CommitteeIndex,
|
||||
Index: v1alpha1AttData.CommitteeIndex,
|
||||
BeaconBlockRoot: v1alpha1AttData.BeaconBlockRoot,
|
||||
Source: ðpb.Checkpoint{
|
||||
Root: v1alpha1AttData.Source.Root,
|
||||
@@ -112,7 +112,7 @@ func V1Alpha1SignedHeaderToV1(v1alpha1Hdr *ethpb_alpha.SignedBeaconBlockHeader)
|
||||
return ðpb.SignedBeaconBlockHeader{}
|
||||
}
|
||||
return ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
Message: ðpb.BeaconBlockHeader{
|
||||
Slot: v1alpha1Hdr.Header.Slot,
|
||||
ProposerIndex: v1alpha1Hdr.Header.ProposerIndex,
|
||||
ParentRoot: v1alpha1Hdr.Header.ParentRoot,
|
||||
@@ -125,16 +125,16 @@ func V1Alpha1SignedHeaderToV1(v1alpha1Hdr *ethpb_alpha.SignedBeaconBlockHeader)
|
||||
|
||||
// V1SignedHeaderToV1Alpha1 converts a v1 signed beacon block header to v1alpha1.
|
||||
func V1SignedHeaderToV1Alpha1(v1Header *ethpb.SignedBeaconBlockHeader) *ethpb_alpha.SignedBeaconBlockHeader {
|
||||
if v1Header == nil || v1Header.Header == nil {
|
||||
if v1Header == nil || v1Header.Message == nil {
|
||||
return ðpb_alpha.SignedBeaconBlockHeader{}
|
||||
}
|
||||
return ðpb_alpha.SignedBeaconBlockHeader{
|
||||
Header: ðpb_alpha.BeaconBlockHeader{
|
||||
Slot: v1Header.Header.Slot,
|
||||
ProposerIndex: v1Header.Header.ProposerIndex,
|
||||
ParentRoot: v1Header.Header.ParentRoot,
|
||||
StateRoot: v1Header.Header.StateRoot,
|
||||
BodyRoot: v1Header.Header.BodyRoot,
|
||||
Slot: v1Header.Message.Slot,
|
||||
ProposerIndex: v1Header.Message.ProposerIndex,
|
||||
ParentRoot: v1Header.Message.ParentRoot,
|
||||
StateRoot: v1Header.Message.StateRoot,
|
||||
BodyRoot: v1Header.Message.BodyRoot,
|
||||
},
|
||||
Signature: v1Header.Signature,
|
||||
}
|
||||
@@ -146,8 +146,8 @@ func V1Alpha1ProposerSlashingToV1(v1alpha1Slashing *ethpb_alpha.ProposerSlashing
|
||||
return ðpb.ProposerSlashing{}
|
||||
}
|
||||
return ðpb.ProposerSlashing{
|
||||
Header_1: V1Alpha1SignedHeaderToV1(v1alpha1Slashing.Header_1),
|
||||
Header_2: V1Alpha1SignedHeaderToV1(v1alpha1Slashing.Header_2),
|
||||
SignedHeader_1: V1Alpha1SignedHeaderToV1(v1alpha1Slashing.Header_1),
|
||||
SignedHeader_2: V1Alpha1SignedHeaderToV1(v1alpha1Slashing.Header_2),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ func V1Alpha1ExitToV1(v1alpha1Exit *ethpb_alpha.SignedVoluntaryExit) *ethpb.Sign
|
||||
return ðpb.SignedVoluntaryExit{}
|
||||
}
|
||||
return ðpb.SignedVoluntaryExit{
|
||||
Exit: ðpb.VoluntaryExit{
|
||||
Message: ðpb.VoluntaryExit{
|
||||
Epoch: v1alpha1Exit.Exit.Epoch,
|
||||
ValidatorIndex: v1alpha1Exit.Exit.ValidatorIndex,
|
||||
},
|
||||
@@ -167,13 +167,13 @@ func V1Alpha1ExitToV1(v1alpha1Exit *ethpb_alpha.SignedVoluntaryExit) *ethpb.Sign
|
||||
|
||||
// V1ExitToV1Alpha1 converts a v1 SignedVoluntaryExit to v1alpha1.
|
||||
func V1ExitToV1Alpha1(v1Exit *ethpb.SignedVoluntaryExit) *ethpb_alpha.SignedVoluntaryExit {
|
||||
if v1Exit == nil || v1Exit.Exit == nil {
|
||||
if v1Exit == nil || v1Exit.Message == nil {
|
||||
return ðpb_alpha.SignedVoluntaryExit{}
|
||||
}
|
||||
return ðpb_alpha.SignedVoluntaryExit{
|
||||
Exit: ðpb_alpha.VoluntaryExit{
|
||||
Epoch: v1Exit.Exit.Epoch,
|
||||
ValidatorIndex: v1Exit.Exit.ValidatorIndex,
|
||||
Epoch: v1Exit.Message.Epoch,
|
||||
ValidatorIndex: v1Exit.Message.ValidatorIndex,
|
||||
},
|
||||
Signature: v1Exit.Signature,
|
||||
}
|
||||
@@ -210,7 +210,7 @@ func V1AttDataToV1Alpha1(v1AttData *ethpb.AttestationData) *ethpb_alpha.Attestat
|
||||
}
|
||||
return ðpb_alpha.AttestationData{
|
||||
Slot: v1AttData.Slot,
|
||||
CommitteeIndex: v1AttData.CommitteeIndex,
|
||||
CommitteeIndex: v1AttData.Index,
|
||||
BeaconBlockRoot: v1AttData.BeaconBlockRoot,
|
||||
Source: ðpb_alpha.Checkpoint{
|
||||
Root: v1AttData.Source.Root,
|
||||
@@ -240,8 +240,8 @@ func V1ProposerSlashingToV1Alpha1(v1Slashing *ethpb.ProposerSlashing) *ethpb_alp
|
||||
return ðpb_alpha.ProposerSlashing{}
|
||||
}
|
||||
return ðpb_alpha.ProposerSlashing{
|
||||
Header_1: V1SignedHeaderToV1Alpha1(v1Slashing.Header_1),
|
||||
Header_2: V1SignedHeaderToV1Alpha1(v1Slashing.Header_2),
|
||||
Header_1: V1SignedHeaderToV1Alpha1(v1Slashing.SignedHeader_1),
|
||||
Header_2: V1SignedHeaderToV1Alpha1(v1Slashing.SignedHeader_2),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ func V1Alpha1ValidatorToV1(v1Validator *ethpb_alpha.Validator) *ethpb.Validator
|
||||
return ðpb.Validator{}
|
||||
}
|
||||
return ðpb.Validator{
|
||||
PublicKey: v1Validator.PublicKey,
|
||||
Pubkey: v1Validator.PublicKey,
|
||||
WithdrawalCredentials: v1Validator.WithdrawalCredentials,
|
||||
EffectiveBalance: v1Validator.EffectiveBalance,
|
||||
Slashed: v1Validator.Slashed,
|
||||
|
||||
@@ -45,11 +45,11 @@ func Test_V1Alpha1BlockToV1BlockHeader(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
bodyRoot, err := alphaBlock.Block.Body.HashTreeRoot()
|
||||
require.NoError(t, err)
|
||||
assert.DeepEqual(t, bodyRoot[:], v1Header.Header.BodyRoot)
|
||||
assert.Equal(t, slot, v1Header.Header.Slot)
|
||||
assert.Equal(t, validatorIndex, v1Header.Header.ProposerIndex)
|
||||
assert.DeepEqual(t, parentRoot, v1Header.Header.ParentRoot)
|
||||
assert.DeepEqual(t, stateRoot, v1Header.Header.StateRoot)
|
||||
assert.DeepEqual(t, bodyRoot[:], v1Header.Message.BodyRoot)
|
||||
assert.Equal(t, slot, v1Header.Message.Slot)
|
||||
assert.Equal(t, validatorIndex, v1Header.Message.ProposerIndex)
|
||||
assert.DeepEqual(t, parentRoot, v1Header.Message.ParentRoot)
|
||||
assert.DeepEqual(t, stateRoot, v1Header.Message.StateRoot)
|
||||
assert.DeepEqual(t, signature, v1Header.Signature)
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func Test_V1Alpha1ExitToV1(t *testing.T) {
|
||||
|
||||
func Test_V1ExitToV1Alpha1(t *testing.T) {
|
||||
v1Exit := ðpb.SignedVoluntaryExit{
|
||||
Exit: ðpb.VoluntaryExit{
|
||||
Message: ðpb.VoluntaryExit{
|
||||
Epoch: epoch,
|
||||
ValidatorIndex: validatorIndex,
|
||||
},
|
||||
@@ -190,7 +190,7 @@ func Test_V1AttSlashingToV1Alpha1(t *testing.T) {
|
||||
AttestingIndices: attestingIndices,
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: slot,
|
||||
CommitteeIndex: committeeIndex,
|
||||
Index: committeeIndex,
|
||||
BeaconBlockRoot: beaconBlockRoot,
|
||||
Source: ðpb.Checkpoint{
|
||||
Epoch: epoch,
|
||||
@@ -218,7 +218,7 @@ func Test_V1AttSlashingToV1Alpha1(t *testing.T) {
|
||||
|
||||
func Test_V1ProposerSlashingToV1Alpha1(t *testing.T) {
|
||||
v1Header := ðpb.SignedBeaconBlockHeader{
|
||||
Header: ðpb.BeaconBlockHeader{
|
||||
Message: ðpb.BeaconBlockHeader{
|
||||
Slot: slot,
|
||||
ProposerIndex: validatorIndex,
|
||||
ParentRoot: parentRoot,
|
||||
@@ -228,8 +228,8 @@ func Test_V1ProposerSlashingToV1Alpha1(t *testing.T) {
|
||||
Signature: signature,
|
||||
}
|
||||
v1Slashing := ðpb.ProposerSlashing{
|
||||
Header_1: v1Header,
|
||||
Header_2: v1Header,
|
||||
SignedHeader_1: v1Header,
|
||||
SignedHeader_2: v1Header,
|
||||
}
|
||||
|
||||
alphaSlashing := V1ProposerSlashingToV1Alpha1(v1Slashing)
|
||||
@@ -272,7 +272,7 @@ func Test_V1AttToV1Alpha1(t *testing.T) {
|
||||
AggregationBits: aggregationBits,
|
||||
Data: ðpb.AttestationData{
|
||||
Slot: slot,
|
||||
CommitteeIndex: committeeIndex,
|
||||
Index: committeeIndex,
|
||||
BeaconBlockRoot: beaconBlockRoot,
|
||||
Source: ðpb.Checkpoint{
|
||||
Epoch: epoch,
|
||||
|
||||
Reference in New Issue
Block a user