diff --git a/WORKSPACE b/WORKSPACE index a4b6e7c93f..e38fb7f14f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1263,6 +1263,6 @@ go_repository( go_repository( name = "com_github_prysmaticlabs_ethereumapis", - commit = "e7364856f1008f08bee3461b6fc2bf6021bd654b", + commit = "11bc5ee7ad5de4bf1380f3103eebdd40db99a666", importpath = "github.com/prysmaticlabs/ethereumapis", ) diff --git a/beacon-chain/operations/service.go b/beacon-chain/operations/service.go index 4b2c23c819..7e4e6a8b2f 100644 --- a/beacon-chain/operations/service.go +++ b/beacon-chain/operations/service.go @@ -25,6 +25,13 @@ import ( var log = logrus.WithField("prefix", "operation") +// Pool defines an interface for fetching the list of attestations +// which have been observed by the beacon node but not yet included in +// a beacon block by a proposer. +type Pool interface { + AttestationPool(ctx context.Context) ([]*ethpb.Attestation, error) +} + // OperationFeeds inteface defines the informational feeds from the operations // service. type OperationFeeds interface { @@ -114,10 +121,10 @@ func (s *Service) IncomingProcessedBlockFeed() *event.Feed { return s.incomingProcessedBlockFeed } -// PendingAttestations returns the attestations that have not seen on the beacon chain, the attestations are -// returns in slot ascending order and up to MaxAttestations capacity. The attestations get -// deleted in DB after they have been retrieved. -func (s *Service) PendingAttestations(ctx context.Context) ([]*ethpb.Attestation, error) { +// AttestationPool returns the attestations that have not seen on the beacon chain, +// the attestations are returned in slot ascending order and up to MaxAttestations +// capacity. The attestations get deleted in DB after they have been retrieved. +func (s *Service) AttestationPool(ctx context.Context) ([]*ethpb.Attestation, error) { var attestations []*ethpb.Attestation attestationsFromDB, err := s.beaconDB.Attestations() if err != nil { @@ -261,35 +268,30 @@ func (s *Service) removeOperations() { // Listen for processed block from the block chain service. case block := <-s.incomingProcessedBlock: handler.SafelyHandleMessage(s.ctx, s.handleProcessedBlock, block) - // Removes the pending attestations received from processed block body in DB. - if err := s.removePendingAttestations(block.Body.Attestations); err != nil { - log.Errorf("Could not remove processed attestations from DB: %v", err) - continue - } - state, err := s.beaconDB.HeadState(s.ctx) - if err != nil { - log.Errorf("could not retrieve attestations from DB") - continue - } - if err := s.removeEpochOldAttestations(state); err != nil { - log.Errorf("Could not remove old attestations from DB at slot %d: %v", block.Slot, err) - continue - } } } } func (s *Service) handleProcessedBlock(_ context.Context, message proto.Message) error { block := message.(*ethpb.BeaconBlock) - // Removes the pending attestations received from processed block body in DB. - if err := s.removePendingAttestations(block.Body.Attestations); err != nil { + // Removes the attestations from the pool that have been included + // in the received block. + if err := s.removeAttestationsFromPool(block.Body.Attestations); err != nil { return fmt.Errorf("could not remove processed attestations from DB: %v", err) } + state, err := s.beaconDB.HeadState(s.ctx) + if err != nil { + return fmt.Errorf("could not retrieve attestations from DB") + } + if err := s.removeEpochOldAttestations(state); err != nil { + return fmt.Errorf("could not remove old attestations from DB at slot %d: %v", block.Slot, err) + } return nil } -// removePendingAttestations removes a list of attestations from DB. -func (s *Service) removePendingAttestations(attestations []*ethpb.Attestation) error { +// removeAttestationsFromPool removes a list of attestations from the DB +// after they have been included in a beacon block. +func (s *Service) removeAttestationsFromPool(attestations []*ethpb.Attestation) error { for _, attestation := range attestations { hash, err := hashutil.HashProto(attestation) if err != nil { diff --git a/beacon-chain/operations/service_test.go b/beacon-chain/operations/service_test.go index 5898b1d894..6a2c452791 100644 --- a/beacon-chain/operations/service_test.go +++ b/beacon-chain/operations/service_test.go @@ -22,6 +22,7 @@ import ( // Ensure operations service implements intefaces. var _ = OperationFeeds(&Service{}) +var _ = Pool(&Service{}) type mockBroadcaster struct { } @@ -130,7 +131,7 @@ func TestRetrieveAttestations_OK(t *testing.T) { t.Fatal(err) } // Test we can retrieve attestations from slot1 - slot61. - attestations, err := service.PendingAttestations(context.Background()) + attestations, err := service.AttestationPool(context.Background()) if err != nil { t.Fatalf("Could not retrieve attestations: %v", err) } @@ -176,7 +177,7 @@ func TestRetrieveAttestations_PruneInvalidAtts(t *testing.T) { DataRoot: params.BeaconConfig().ZeroHash[:]}}}); err != nil { t.Fatal(err) } - attestations, err := service.PendingAttestations(context.Background()) + attestations, err := service.AttestationPool(context.Background()) if err != nil { t.Fatalf("Could not retrieve attestations: %v", err) } @@ -223,7 +224,7 @@ func TestRemoveProcessedAttestations_Ok(t *testing.T) { t.Fatal(err) } - retrievedAtts, err := s.PendingAttestations(context.Background()) + retrievedAtts, err := s.AttestationPool(context.Background()) if err != nil { t.Fatalf("Could not retrieve attestations: %v", err) } @@ -231,11 +232,11 @@ func TestRemoveProcessedAttestations_Ok(t *testing.T) { t.Error("Retrieved attestations did not match prev generated attestations") } - if err := s.removePendingAttestations(attestations); err != nil { - t.Fatalf("Could not remove pending attestations: %v", err) + if err := s.removeAttestationsFromPool(attestations); err != nil { + t.Fatalf("Could not remove attestations: %v", err) } - retrievedAtts, _ = s.PendingAttestations(context.Background()) + retrievedAtts, _ = s.AttestationPool(context.Background()) if len(retrievedAtts) != 0 { t.Errorf("Attestation pool should be empty but got a length of %d", len(retrievedAtts)) } @@ -270,7 +271,7 @@ func TestReceiveBlkRemoveOps_Ok(t *testing.T) { t.Fatal(err) } - atts, _ := s.PendingAttestations(context.Background()) + atts, _ := s.AttestationPool(context.Background()) if len(atts) != len(attestations) { t.Errorf("Attestation pool should be %d but got a length of %d", len(attestations), len(atts)) @@ -287,7 +288,7 @@ func TestReceiveBlkRemoveOps_Ok(t *testing.T) { t.Error(err) } - atts, _ = s.PendingAttestations(context.Background()) + atts, _ = s.AttestationPool(context.Background()) if len(atts) != 0 { t.Errorf("Attestation pool should be empty but got a length of %d", len(atts)) } diff --git a/beacon-chain/rpc/BUILD.bazel b/beacon-chain/rpc/BUILD.bazel index d305ac7bd1..82dabdc841 100644 --- a/beacon-chain/rpc/BUILD.bazel +++ b/beacon-chain/rpc/BUILD.bazel @@ -22,6 +22,7 @@ go_library( "//beacon-chain/core/state:go_default_library", "//beacon-chain/core/state/stateutils:go_default_library", "//beacon-chain/db:go_default_library", + "//beacon-chain/operations:go_default_library", "//beacon-chain/sync:go_default_library", "//proto/beacon/p2p/v1:go_default_library", "//proto/beacon/rpc/v1:go_default_library", diff --git a/beacon-chain/rpc/beacon_chain_server.go b/beacon-chain/rpc/beacon_chain_server.go index 004b12e0e8..eab353ce9e 100644 --- a/beacon-chain/rpc/beacon_chain_server.go +++ b/beacon-chain/rpc/beacon_chain_server.go @@ -2,11 +2,13 @@ package rpc import ( "context" + "sort" ptypes "github.com/gogo/protobuf/types" "github.com/prysmaticlabs/prysm/beacon-chain/core/epoch" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/db" + "github.com/prysmaticlabs/prysm/beacon-chain/operations" ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1" "github.com/prysmaticlabs/prysm/shared/pagination" "github.com/prysmaticlabs/prysm/shared/params" @@ -19,32 +21,82 @@ import ( // beacon chain. type BeaconChainServer struct { beaconDB *db.BeaconDB + pool operations.Pool +} + +// sortableAttestations implements the Sort interface to sort attestations +// by shard as the canonical sorting attribute. +type sortableAttestations []*ethpb.Attestation + +func (s sortableAttestations) Len() int { return len(s) } +func (s sortableAttestations) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s sortableAttestations) Less(i, j int) bool { + return s[i].Data.Crosslink.Shard < s[j].Data.Crosslink.Shard } // ListAttestations retrieves attestations by block root, slot, or epoch. +// Attestations are sorted by crosslink shard by default. // // The server may return an empty list when no attestations match the given // filter criteria. This RPC should not return NOT_FOUND. Only one filter // criteria should be used. +// +// TODO(#3064): Filtering blocked by DB refactor for easier access to +// fetching data by attributes efficiently. func (bs *BeaconChainServer) ListAttestations( ctx context.Context, req *ethpb.ListAttestationsRequest, ) (*ethpb.ListAttestationsResponse, error) { - return nil, status.Error(codes.Unimplemented, "not implemented") + if int(req.PageSize) > params.BeaconConfig().MaxPageSize { + return nil, status.Errorf(codes.InvalidArgument, "requested page size %d can not be greater than max size %d", + req.PageSize, params.BeaconConfig().MaxPageSize) + } + + switch req.QueryFilter.(type) { + case *ethpb.ListAttestationsRequest_BlockRoot: + return nil, status.Error(codes.Unimplemented, "not implemented") + case *ethpb.ListAttestationsRequest_Slot: + return nil, status.Error(codes.Unimplemented, "not implemented") + case *ethpb.ListAttestationsRequest_Epoch: + return nil, status.Error(codes.Unimplemented, "not implemented") + } + atts, err := bs.beaconDB.Attestations() + if err != nil { + return nil, status.Errorf(codes.Internal, "could not fetch attestations: %v", err) + } + // We sort attestations according to the Sortable interface. + sort.Sort(sortableAttestations(atts)) + numAttestations := len(atts) + + start, end, nextPageToken, err := pagination.StartAndEndPage(req.PageToken, int(req.PageSize), numAttestations) + if err != nil { + return nil, status.Errorf(codes.Internal, "could not paginate attestations: %v", err) + } + return ðpb.ListAttestationsResponse{ + Attestations: atts[start:end], + TotalSize: int32(numAttestations), + NextPageToken: nextPageToken, + }, nil } // AttestationPool retrieves pending attestations. // // The server returns a list of attestations that have been seen but not -// yet processed. Pending attestations eventually expire as the slot +// yet processed. Pool attestations eventually expire as the slot // advances, so an attestation missing from this request does not imply // that it was included in a block. The attestation may have expired. // Refer to the ethereum 2.0 specification for more details on how // attestations are processed and when they are no longer valid. -// https://github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_beacon-chain.md#attestation +// https://github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_beacon-chain.md#attestations func (bs *BeaconChainServer) AttestationPool( ctx context.Context, _ *ptypes.Empty, ) (*ethpb.AttestationPoolResponse, error) { - return nil, status.Error(codes.Unimplemented, "not implemented") + atts, err := bs.pool.AttestationPool(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "could not fetch attestations: %v", err) + } + return ðpb.AttestationPoolResponse{ + Attestations: atts, + }, nil } // ListBlocks retrieves blocks by root, slot, or epoch. diff --git a/beacon-chain/rpc/beacon_chain_server_test.go b/beacon-chain/rpc/beacon_chain_server_test.go index 7902c99031..10c6eec806 100644 --- a/beacon-chain/rpc/beacon_chain_server_test.go +++ b/beacon-chain/rpc/beacon_chain_server_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/gogo/protobuf/proto" + ptypes "github.com/gogo/protobuf/types" "github.com/prysmaticlabs/go-bitfield" "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/internal" @@ -17,6 +18,253 @@ import ( "github.com/prysmaticlabs/prysm/shared/params" ) +type mockPool struct{} + +func (m *mockPool) AttestationPool(ctx context.Context) ([]*ethpb.Attestation, error) { + return []*ethpb.Attestation{ + { + Data: ðpb.AttestationData{ + BeaconBlockRoot: []byte("1"), + }, + }, + { + Data: ðpb.AttestationData{ + BeaconBlockRoot: []byte("2"), + }, + }, + }, nil +} + +func TestBeaconChainServer_ListAttestationsNoPagination(t *testing.T) { + db := internal.SetupDB(t) + defer internal.TeardownDB(t, db) + ctx := context.Background() + + count := uint64(10) + atts := make([]*ethpb.Attestation, 0, count) + for i := uint64(0); i < count; i++ { + attExample := ðpb.Attestation{ + Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{ + Shard: i, + }, + }, + } + if err := db.SaveAttestation(ctx, attExample); err != nil { + t.Fatal(err) + } + atts = append(atts, attExample) + } + + bs := &BeaconChainServer{ + beaconDB: db, + } + + received, err := bs.ListAttestations(ctx, ðpb.ListAttestationsRequest{}) + if err != nil { + t.Fatal(err) + } + + if !reflect.DeepEqual(atts, received.Attestations) { + t.Fatalf("incorrect attestations response: wanted %v, received %v", atts, received.Attestations) + } +} + +func TestBeaconChainServer_ListAttestationsPagination(t *testing.T) { + db := internal.SetupDB(t) + defer internal.TeardownDB(t, db) + ctx := context.Background() + + count := uint64(100) + atts := make([]*ethpb.Attestation, 0, count) + for i := uint64(0); i < count; i++ { + attExample := ðpb.Attestation{ + Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{ + Shard: i, + }, + }, + } + if err := db.SaveAttestation(ctx, attExample); err != nil { + t.Fatal(err) + } + atts = append(atts, attExample) + } + + bs := &BeaconChainServer{ + beaconDB: db, + } + + tests := []struct { + req *ethpb.ListAttestationsRequest + res *ethpb.ListAttestationsResponse + }{ + {req: ðpb.ListAttestationsRequest{PageToken: strconv.Itoa(1), PageSize: 3}, + res: ðpb.ListAttestationsResponse{ + Attestations: []*ethpb.Attestation{ + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 3}, + }}, + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 4}, + }}, + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 5}, + }}, + }, + NextPageToken: strconv.Itoa(2), + TotalSize: int32(count)}}, + {req: ðpb.ListAttestationsRequest{PageToken: strconv.Itoa(10), PageSize: 5}, + res: ðpb.ListAttestationsResponse{ + Attestations: []*ethpb.Attestation{ + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 50}, + }}, + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 51}, + }}, + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 52}, + }}, + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 53}, + }}, + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 54}, + }}, + }, + NextPageToken: strconv.Itoa(11), + TotalSize: int32(count)}}, + {req: ðpb.ListAttestationsRequest{PageToken: strconv.Itoa(33), PageSize: 3}, + res: ðpb.ListAttestationsResponse{ + Attestations: []*ethpb.Attestation{ + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 99}, + }}, + }, + NextPageToken: strconv.Itoa(34), + TotalSize: int32(count)}}, + {req: ðpb.ListAttestationsRequest{PageSize: 2}, + res: ðpb.ListAttestationsResponse{ + Attestations: []*ethpb.Attestation{ + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 0}, + }}, + {Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{Shard: 1}, + }}, + }, + NextPageToken: strconv.Itoa(1), + TotalSize: int32(count)}}, + } + for _, test := range tests { + res, err := bs.ListAttestations(ctx, test.req) + if err != nil { + t.Fatal(err) + } + if !proto.Equal(res, test.res) { + t.Error("Incorrect attestations response") + } + } +} + +func TestBeaconChainServer_ListAttestationsPaginationOutOfRange(t *testing.T) { + db := internal.SetupDB(t) + defer internal.TeardownDB(t, db) + ctx := context.Background() + + count := uint64(1) + atts := make([]*ethpb.Attestation, 0, count) + for i := uint64(0); i < count; i++ { + attExample := ðpb.Attestation{ + Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{ + Shard: i, + }, + }, + } + if err := db.SaveAttestation(ctx, attExample); err != nil { + t.Fatal(err) + } + atts = append(atts, attExample) + } + + bs := &BeaconChainServer{ + beaconDB: db, + } + + req := ðpb.ListAttestationsRequest{PageToken: strconv.Itoa(1), PageSize: 100} + wanted := fmt.Sprintf("page start %d >= list %d", req.PageSize, len(atts)) + if _, err := bs.ListAttestations(ctx, req); !strings.Contains(err.Error(), wanted) { + t.Errorf("Expected error %v, received %v", wanted, err) + } +} + +func TestBeaconChainServer_ListAttestationsExceedsMaxPageSize(t *testing.T) { + ctx := context.Background() + bs := &BeaconChainServer{} + exceedsMax := int32(params.BeaconConfig().MaxPageSize + 1) + + wanted := fmt.Sprintf("requested page size %d can not be greater than max size %d", exceedsMax, params.BeaconConfig().MaxPageSize) + req := ðpb.ListAttestationsRequest{PageToken: strconv.Itoa(0), PageSize: exceedsMax} + if _, err := bs.ListAttestations(ctx, req); !strings.Contains(err.Error(), wanted) { + t.Errorf("Expected error %v, received %v", wanted, err) + } +} + +func TestBeaconChainServer_ListAttestationsDefaultPageSize(t *testing.T) { + db := internal.SetupDB(t) + defer internal.TeardownDB(t, db) + ctx := context.Background() + + count := uint64(params.BeaconConfig().DefaultPageSize) + atts := make([]*ethpb.Attestation, 0, count) + for i := uint64(0); i < count; i++ { + attExample := ðpb.Attestation{ + Data: ðpb.AttestationData{ + Crosslink: ðpb.Crosslink{ + Shard: i, + }, + }, + } + if err := db.SaveAttestation(ctx, attExample); err != nil { + t.Fatal(err) + } + atts = append(atts, attExample) + } + + bs := &BeaconChainServer{ + beaconDB: db, + } + + req := ðpb.ListAttestationsRequest{} + res, err := bs.ListAttestations(ctx, req) + if err != nil { + t.Fatal(err) + } + + i := 0 + j := params.BeaconConfig().DefaultPageSize + if !reflect.DeepEqual(res.Attestations, atts[i:j]) { + t.Error("Incorrect attestations response") + } +} + +func TestBeaconChainServer_AttestationPool(t *testing.T) { + ctx := context.Background() + bs := &BeaconChainServer{ + pool: &mockPool{}, + } + res, err := bs.AttestationPool(ctx, &ptypes.Empty{}) + if err != nil { + t.Fatal(err) + } + want, _ := bs.pool.AttestationPool(ctx) + if !reflect.DeepEqual(res.Attestations, want) { + t.Errorf("Wanted AttestationPool() = %v, received %v", want, res.Attestations) + } +} + func TestBeaconChainServer_ListValidatorBalances(t *testing.T) { db := internal.SetupDB(t) defer internal.TeardownDB(t, db) @@ -142,7 +390,6 @@ func TestBeaconChainServer_GetValidatorsNoPagination(t *testing.T) { } if !reflect.DeepEqual(validators, received.Validators) { - fmt.Println(received.Validators) t.Fatal("Incorrect respond of validators") } } @@ -243,7 +490,7 @@ func TestBeaconChainServer_GetValidatorsPaginationOutOfRange(t *testing.T) { } req := ðpb.GetValidatorsRequest{PageToken: strconv.Itoa(1), PageSize: 100} - wanted := fmt.Sprintf("page start %d >= validator list %d", req.PageSize, len(validators)) + wanted := fmt.Sprintf("page start %d >= list %d", req.PageSize, len(validators)) if _, err := bs.GetValidators(context.Background(), req); !strings.Contains(err.Error(), wanted) { t.Errorf("Expected error %v, received %v", wanted, err) } @@ -317,7 +564,7 @@ func TestBeaconChainServer_ListAssignmentsInputOutOfRange(t *testing.T) { bs := &BeaconChainServer{beaconDB: db} - wanted := fmt.Sprintf("page start %d >= validator list %d", 0, 0) + wanted := fmt.Sprintf("page start %d >= list %d", 0, 0) if _, err := bs.ListValidatorAssignments(context.Background(), ðpb.ListValidatorAssignmentsRequest{Epoch: 0}); !strings.Contains(err.Error(), wanted) { t.Errorf("Expected error %v, received %v", wanted, err) } diff --git a/beacon-chain/rpc/proposer_server.go b/beacon-chain/rpc/proposer_server.go index ca7dde3dac..d25fc1c7f2 100644 --- a/beacon-chain/rpc/proposer_server.go +++ b/beacon-chain/rpc/proposer_server.go @@ -138,9 +138,9 @@ func (ps *ProposerServer) attestations(ctx context.Context, expectedSlot uint64) if err != nil { return nil, fmt.Errorf("could not retrieve beacon state: %v", err) } - atts, err := ps.operationService.PendingAttestations(ctx) + atts, err := ps.operationService.AttestationPool(ctx) if err != nil { - return nil, fmt.Errorf("could not retrieve pending attest ations from operations service: %v", err) + return nil, fmt.Errorf("could not retrieve pending attestations from operations service: %v", err) } // advance slot, if it is behind if beaconState.Slot < expectedSlot { diff --git a/beacon-chain/rpc/service.go b/beacon-chain/rpc/service.go index 1117f4b50f..e1c8496812 100644 --- a/beacon-chain/rpc/service.go +++ b/beacon-chain/rpc/service.go @@ -16,6 +16,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/blockchain" "github.com/prysmaticlabs/prysm/beacon-chain/cache" "github.com/prysmaticlabs/prysm/beacon-chain/db" + "github.com/prysmaticlabs/prysm/beacon-chain/operations" "github.com/prysmaticlabs/prysm/beacon-chain/sync" pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" pb "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1" @@ -45,7 +46,7 @@ type chainService interface { } type operationService interface { - PendingAttestations(ctx context.Context) ([]*ethpb.Attestation, error) + operations.Pool IsAttCanonical(ctx context.Context, att *ethpb.Attestation) (bool, error) HandleAttestations(context.Context, proto.Message) error IncomingAttFeed() *event.Feed @@ -199,6 +200,7 @@ func (s *Service) Start() { } beaconChainServer := &BeaconChainServer{ beaconDB: s.beaconDB, + pool: s.operationService, } pb.RegisterBeaconServiceServer(s.grpcServer, beaconServer) pb.RegisterProposerServiceServer(s.grpcServer, proposerServer) diff --git a/beacon-chain/rpc/service_test.go b/beacon-chain/rpc/service_test.go index a7d1ca8d75..c4e18296b8 100644 --- a/beacon-chain/rpc/service_test.go +++ b/beacon-chain/rpc/service_test.go @@ -43,7 +43,7 @@ func (ms *mockOperationService) IsAttCanonical(_ context.Context, att *ethpb.Att return true, nil } -func (ms *mockOperationService) PendingAttestations(_ context.Context) ([]*ethpb.Attestation, error) { +func (ms *mockOperationService) AttestationPool(_ context.Context) ([]*ethpb.Attestation, error) { if ms.pendingAttestations != nil { return ms.pendingAttestations, nil } diff --git a/proto/eth/v1alpha1/beacon_chain.pb.go b/proto/eth/v1alpha1/beacon_chain.pb.go index 78289d9acd..f3744ac1d1 100755 --- a/proto/eth/v1alpha1/beacon_chain.pb.go +++ b/proto/eth/v1alpha1/beacon_chain.pb.go @@ -34,6 +34,8 @@ type ListAttestationsRequest struct { // *ListAttestationsRequest_Slot // *ListAttestationsRequest_Epoch QueryFilter isListAttestationsRequest_QueryFilter `protobuf_oneof:"query_filter"` + PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -120,6 +122,20 @@ func (m *ListAttestationsRequest) GetEpoch() uint64 { return 0 } +func (m *ListAttestationsRequest) GetPageSize() int32 { + if m != nil { + return m.PageSize + } + return 0 +} + +func (m *ListAttestationsRequest) GetPageToken() string { + if m != nil { + return m.PageToken + } + return "" +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*ListAttestationsRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _ListAttestationsRequest_OneofMarshaler, _ListAttestationsRequest_OneofUnmarshaler, _ListAttestationsRequest_OneofSizer, []interface{}{ @@ -201,6 +217,8 @@ func _ListAttestationsRequest_OneofSizer(msg proto.Message) (n int) { type ListAttestationsResponse struct { Attestations []*Attestation `protobuf:"bytes,1,rep,name=attestations,proto3" json:"attestations,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -246,12 +264,28 @@ func (m *ListAttestationsResponse) GetAttestations() []*Attestation { return nil } +func (m *ListAttestationsResponse) GetNextPageToken() string { + if m != nil { + return m.NextPageToken + } + return "" +} + +func (m *ListAttestationsResponse) GetTotalSize() int32 { + if m != nil { + return m.TotalSize + } + return 0 +} + type ListBlocksRequest struct { // Types that are valid to be assigned to QueryFilter: // *ListBlocksRequest_Root // *ListBlocksRequest_Slot // *ListBlocksRequest_Epoch QueryFilter isListBlocksRequest_QueryFilter `protobuf_oneof:"query_filter"` + PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,5,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -338,6 +372,20 @@ func (m *ListBlocksRequest) GetEpoch() uint64 { return 0 } +func (m *ListBlocksRequest) GetPageSize() int32 { + if m != nil { + return m.PageSize + } + return 0 +} + +func (m *ListBlocksRequest) GetPageToken() string { + if m != nil { + return m.PageToken + } + return "" +} + // XXX_OneofFuncs is for the internal use of the proto package. func (*ListBlocksRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { return _ListBlocksRequest_OneofMarshaler, _ListBlocksRequest_OneofUnmarshaler, _ListBlocksRequest_OneofSizer, []interface{}{ @@ -419,6 +467,8 @@ func _ListBlocksRequest_OneofSizer(msg proto.Message) (n int) { type ListBlocksResponse struct { Blocks []*BeaconBlock `protobuf:"bytes,1,rep,name=blocks,proto3" json:"blocks,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + TotalSize int32 `protobuf:"varint,3,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -464,6 +514,20 @@ func (m *ListBlocksResponse) GetBlocks() []*BeaconBlock { return nil } +func (m *ListBlocksResponse) GetNextPageToken() string { + if m != nil { + return m.NextPageToken + } + return "" +} + +func (m *ListBlocksResponse) GetTotalSize() int32 { + if m != nil { + return m.TotalSize + } + return 0 +} + type ChainHead struct { BlockRoot []byte `protobuf:"bytes,1,opt,name=block_root,json=blockRoot,proto3" json:"block_root,omitempty" ssz-size:"32"` BlockSlot uint64 `protobuf:"varint,2,opt,name=block_slot,json=blockSlot,proto3" json:"block_slot,omitempty"` @@ -1587,101 +1651,103 @@ func init() { } var fileDescriptor_678c88b69c3c78d4 = []byte{ - // 1503 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xef, 0xc6, 0x4e, 0x13, 0x3f, 0x27, 0x69, 0x33, 0x71, 0x12, 0x77, 0xd3, 0x26, 0xee, 0xb6, - 0xc9, 0xd7, 0x55, 0xdb, 0x75, 0x93, 0xf6, 0x5b, 0xaa, 0x54, 0xa8, 0xd4, 0x51, 0x69, 0x80, 0x1e, - 0xc2, 0xb6, 0xe2, 0xc0, 0xc5, 0x1a, 0xaf, 0x27, 0xf6, 0x34, 0xeb, 0x9d, 0xed, 0xce, 0x38, 0x4a, - 0x72, 0x03, 0x24, 0x24, 0xce, 0x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, 0xbd, 0x7b, 0xf4, 0xb5, 0x4d, 0x89, 0xf3, 0x2a, 0xba, 0x92, 0x5a, 0x34, 0x49, - 0x16, 0x08, 0x27, 0xc2, 0x0c, 0x70, 0x9d, 0xc0, 0x7c, 0x12, 0x82, 0xcf, 0x54, 0xd2, 0xda, 0x6a, - 0x7d, 0x54, 0xa9, 0xa4, 0x79, 0x5a, 0x6f, 0x25, 0x60, 0x3c, 0x93, 0x61, 0xbe, 0x55, 0xfc, 0xf7, - 0xfd, 0xc0, 0x3b, 0xfa, 0xf6, 0x90, 0xa3, 0x33, 0x84, 0x96, 0xa8, 0x57, 0xff, 0xc1, 0x85, 0xad, - 0x5d, 0x93, 0x48, 0x37, 0xd0, 0xe5, 0xf4, 0x82, 0x25, 0x20, 0x7d, 0xa7, 0xc0, 0xb9, 0xd4, 0x4b, - 0x0b, 0xbd, 0x31, 0xc6, 0x0e, 0x0f, 0xba, 0xe6, 0xd4, 0xeb, 0xa3, 0x10, 0x77, 0x59, 0xa5, 0x0d, - 0xaf, 0x04, 0xe6, 0xae, 0x8b, 0xac, 0xba, 0xf3, 0xcb, 0xcb, 0x55, 0xe5, 0xf9, 0xcb, 0x55, 0xe5, - 0xf7, 0x97, 0xab, 0xca, 0x87, 0xff, 0x4f, 0xfc, 0x4f, 0xe5, 0xb8, 0xc7, 0xbc, 0x8d, 0x05, 0x35, - 0x2d, 0x5c, 0xe7, 0xfe, 0xaa, 0xd2, 0xff, 0x7f, 0xd0, 0x5d, 0x22, 0x5a, 0xf5, 0xd3, 0x52, 0x7e, - 0xf3, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x05, 0xb2, 0xa9, 0x6f, 0x25, 0x13, 0x00, 0x00, + // 1528 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 0x1b, 0xef, 0xc4, 0x4e, 0x93, 0x3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 0x0f, 0xda, 0x74, 0xe5, + 0xa1, 0xde, 0xbc, 0xd0, 0x05, 0x27, 0x91, 0x92, 0x8a, 0xc0, 0x87, 0xd6, 0xea, 0x91, 0x4d, 0xcd, + 0xe6, 0xd6, 0xbe, 0x56, 0x33, 0xba, 0xa8, 0x1d, 0x10, 0x9b, 0xed, 0x12, 0xc9, 0xbd, 0x40, 0xc7, + 0xf8, 0x06, 0xc1, 0xc2, 0x7d, 0x26, 0xe4, 0x9d, 0x38, 0x88, 0x30, 0xe9, 0xe3, 0x16, 0x15, 0x12, + 0xaf, 0x00, 0x28, 0x77, 0x55, 0x8f, 0x73, 0x99, 0x43, 0x05, 0x54, 0x9c, 0xd8, 0x3e, 0x61, 0x8e, + 0x29, 0x99, 0xc9, 0xb9, 0xc4, 0xb3, 0x90, 0x15, 0x36, 0x97, 0xb9, 0xa1, 0x02, 0x2a, 0x66, 0xb7, + 0x4f, 0x98, 0x6a, 0x85, 0xe7, 0x61, 0x98, 0xba, 0xdc, 0x6a, 0xe4, 0x32, 0x5a, 0x1c, 0x2c, 0xf1, + 0x22, 0x8c, 0xb9, 0xa4, 0x4e, 0xab, 0x82, 0x1d, 0xd1, 0x5c, 0xb6, 0x80, 0x8a, 0xc3, 0xe6, 0xa8, + 0x2f, 0x78, 0xc0, 0x8e, 0x28, 0x5e, 0x02, 0x50, 0x9b, 0x92, 0xef, 0x53, 0x27, 0x37, 0x5c, 0x40, + 0xc5, 0x31, 0x53, 0xa9, 0x3f, 0xf4, 0x05, 0x95, 0x29, 0x98, 0x78, 0xdc, 0xa2, 0xde, 0x61, 0x75, + 0x8f, 0xd9, 0x92, 0x7a, 0xc6, 0x17, 0x08, 0x72, 0xc7, 0x61, 0x0b, 0x97, 0x3b, 0x82, 0xe2, 0x57, + 0x61, 0x22, 0xc1, 0x99, 0xc8, 0xa1, 0x42, 0xa6, 0x38, 0xbe, 0x61, 0x94, 0xba, 0x7e, 0xdc, 0x52, + 0xc2, 0x85, 0xd9, 0x66,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07, 0x8c, 0xb7, 0x44, 0xb5, + 0x23, 0xe8, 0x88, 0x0a, 0x3a, 0x17, 0x6e, 0xbf, 0xde, 0x16, 0xfc, 0x21, 0x2c, 0x75, 0xb1, 0x4b, + 0xa0, 0x18, 0x4d, 0x43, 0x91, 0x3f, 0xe6, 0x30, 0x42, 0x63, 0xbc, 0x87, 0x60, 0xf1, 0x1e, 0x95, + 0x6f, 0x85, 0xed, 0xa7, 0x42, 0x6c, 0xe2, 0x58, 0x34, 0x71, 0x1c, 0x74, 0x89, 0x23, 0x85, 0x4d, + 0x17, 0xf8, 0x75, 0x18, 0x77, 0x5b, 0x35, 0x9b, 0x59, 0xd5, 0x7d, 0x7a, 0x28, 0x72, 0x43, 0x85, + 0x4c, 0x71, 0xa2, 0x32, 0xf3, 0xe2, 0xd9, 0xca, 0xa9, 0x38, 0xf2, 0xed, 0xcb, 0xd7, 0x6f, 0x1a, + 0x26, 0x04, 0x7a, 0x6f, 0xd0, 0x43, 0x81, 0x73, 0x30, 0xc2, 0x9c, 0x5d, 0x66, 0x51, 0x91, 0xcb, + 0x14, 0x32, 0xc5, 0xac, 0x19, 0x2e, 0x8d, 0x9f, 0x11, 0x4c, 0x1f, 0x83, 0x80, 0xef, 0xc3, 0x68, + 0x4d, 0xff, 0xd6, 0x55, 0x7e, 0x35, 0xa5, 0xca, 0x8f, 0xd9, 0x96, 0xf4, 0x0f, 0x33, 0xf2, 0x90, + 0xdf, 0x87, 0x11, 0x2d, 0xf4, 0x6b, 0x35, 0x86, 0xdf, 0xbd, 0x56, 0x7d, 0xec, 0x63, 0x11, 0x76, + 0x9f, 0x06, 0xe6, 0xec, 0xd2, 0x27, 0xba, 0x4c, 0x83, 0x85, 0x9f, 0x90, 0x76, 0xaf, 0x6b, 0x33, + 0x5c, 0x1a, 0x1f, 0x21, 0x98, 0x4d, 0xd2, 0x1a, 0xf1, 0x39, 0xdf, 0xc6, 0x67, 0xdc, 0x32, 0xf2, + 0x30, 0x52, 0xa7, 0x0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x7d, 0xbe, 0x8c, 0xde, 0xfe, 0x6f, + 0xe2, 0x1f, 0x3b, 0xd7, 0x3b, 0x14, 0x4d, 0x22, 0x99, 0x65, 0x93, 0x9a, 0x08, 0x56, 0xe5, 0xe3, + 0xff, 0x8c, 0xdd, 0xa2, 0xb2, 0x51, 0x3b, 0xa9, 0xe4, 0xd7, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, + 0x48, 0x72, 0x96, 0xde, 0x2f, 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2075,6 +2141,17 @@ func (m *ListAttestationsRequest) MarshalTo(dAtA []byte) (int, error) { } i += nn1 } + if m.PageSize != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(m.PageSize)) + } + if len(m.PageToken) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(len(m.PageToken))) + i += copy(dAtA[i:], m.PageToken) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -2132,6 +2209,17 @@ func (m *ListAttestationsResponse) MarshalTo(dAtA []byte) (int, error) { i += n } } + if len(m.NextPageToken) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(len(m.NextPageToken))) + i += copy(dAtA[i:], m.NextPageToken) + } + if m.TotalSize != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(m.TotalSize)) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -2160,6 +2248,17 @@ func (m *ListBlocksRequest) MarshalTo(dAtA []byte) (int, error) { } i += nn2 } + if m.PageSize != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(m.PageSize)) + } + if len(m.PageToken) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(len(m.PageToken))) + i += copy(dAtA[i:], m.PageToken) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -2217,6 +2316,17 @@ func (m *ListBlocksResponse) MarshalTo(dAtA []byte) (int, error) { i += n } } + if len(m.NextPageToken) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(len(m.NextPageToken))) + i += copy(dAtA[i:], m.NextPageToken) + } + if m.TotalSize != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintBeaconChain(dAtA, i, uint64(m.TotalSize)) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -2938,6 +3048,13 @@ func (m *ListAttestationsRequest) Size() (n int) { if m.QueryFilter != nil { n += m.QueryFilter.Size() } + if m.PageSize != 0 { + n += 1 + sovBeaconChain(uint64(m.PageSize)) + } + l = len(m.PageToken) + if l > 0 { + n += 1 + l + sovBeaconChain(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2986,6 +3103,13 @@ func (m *ListAttestationsResponse) Size() (n int) { n += 1 + l + sovBeaconChain(uint64(l)) } } + l = len(m.NextPageToken) + if l > 0 { + n += 1 + l + sovBeaconChain(uint64(l)) + } + if m.TotalSize != 0 { + n += 1 + sovBeaconChain(uint64(m.TotalSize)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3001,6 +3125,13 @@ func (m *ListBlocksRequest) Size() (n int) { if m.QueryFilter != nil { n += m.QueryFilter.Size() } + if m.PageSize != 0 { + n += 1 + sovBeaconChain(uint64(m.PageSize)) + } + l = len(m.PageToken) + if l > 0 { + n += 1 + l + sovBeaconChain(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3049,6 +3180,13 @@ func (m *ListBlocksResponse) Size() (n int) { n += 1 + l + sovBeaconChain(uint64(l)) } } + l = len(m.NextPageToken) + if l > 0 { + n += 1 + l + sovBeaconChain(uint64(l)) + } + if m.TotalSize != 0 { + n += 1 + sovBeaconChain(uint64(m.TotalSize)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3576,6 +3714,57 @@ func (m *ListAttestationsRequest) Unmarshal(dAtA []byte) error { } } m.QueryFilter = &ListAttestationsRequest_Epoch{v} + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PageSize", wireType) + } + m.PageSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PageSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PageToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBeaconChain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBeaconChain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PageToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipBeaconChain(dAtA[iNdEx:]) @@ -3664,6 +3853,57 @@ func (m *ListAttestationsResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextPageToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBeaconChain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBeaconChain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextPageToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalSize", wireType) + } + m.TotalSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipBeaconChain(dAtA[iNdEx:]) @@ -3791,6 +4031,57 @@ func (m *ListBlocksRequest) Unmarshal(dAtA []byte) error { } } m.QueryFilter = &ListBlocksRequest_Epoch{v} + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PageSize", wireType) + } + m.PageSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PageSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PageToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBeaconChain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBeaconChain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PageToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipBeaconChain(dAtA[iNdEx:]) @@ -3879,6 +4170,57 @@ func (m *ListBlocksResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NextPageToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBeaconChain + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBeaconChain + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NextPageToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalSize", wireType) + } + m.TotalSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBeaconChain + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipBeaconChain(dAtA[iNdEx:]) diff --git a/proto/eth/v1alpha1/beacon_chain.proto b/proto/eth/v1alpha1/beacon_chain.proto index 72077526d1..419fd42d34 100644 --- a/proto/eth/v1alpha1/beacon_chain.proto +++ b/proto/eth/v1alpha1/beacon_chain.proto @@ -20,6 +20,7 @@ service BeaconChain { // TODO(preston): Batch requests? // Retrieve attestations by block root, slot, or epoch. + // Attestations are sorted by crosslink shard by default. // // The server may return an empty list when no attestations match the given // filter criteria. This RPC should not return NOT_FOUND. Only one filter @@ -138,10 +139,27 @@ message ListAttestationsRequest { // Filter attestations by epoch number. uint64 epoch = 3; } + + // The maximum number of Attestations to return in the response. + // This field is optional. + int32 page_size = 4; + + // A pagination token returned from a previous call to `ListAttestations` + // that indicates where this listing should continue from. + // This field is optional. + string page_token = 5; } message ListAttestationsResponse { repeated Attestation attestations = 1; + + // A pagination token returned from a previous call to `ListAttestations` + // that indicates from where listing should continue. + // This field is optional. + string next_page_token = 2; + + // Total count of Attestations matching the request filter. + int32 total_size = 3; } message ListBlocksRequest { @@ -159,10 +177,27 @@ message ListBlocksRequest { // from another fork. uint64 epoch = 3; } + + // The maximum number of Blocks to return in the response. + // This field is optional. + int32 page_size = 4; + + // A pagination token returned from a previous call to `ListBlocks` + // that indicates where this listing should continue from. + // This field is optional. + string page_token = 5; } message ListBlocksResponse { repeated BeaconBlock blocks = 1; + + // A pagination token returned from a previous call to `ListBlocks` + // that indicates from where listing should continue. + // This field is optional. + string next_page_token = 2; + + // Total count of Blocks matching the request filter. + int32 total_size = 3; } // Information about the head of the beacon chain. diff --git a/shared/pagination/pagination.go b/shared/pagination/pagination.go index ddff00471b..1f94e58bf7 100644 --- a/shared/pagination/pagination.go +++ b/shared/pagination/pagination.go @@ -25,7 +25,7 @@ func StartAndEndPage(pageToken string, pageSize int, totalSize int) (int, int, s // Start page can not be greater than validator size. start := token * pageSize if start >= totalSize { - return 0, 0, "", fmt.Errorf("page start %d >= validator list %d", start, totalSize) + return 0, 0, "", fmt.Errorf("page start %d >= list %d", start, totalSize) } // End page can not go out of bound. diff --git a/shared/pagination/pagination_test.go b/shared/pagination/pagination_test.go index 1b763da18e..4d482038b6 100644 --- a/shared/pagination/pagination_test.go +++ b/shared/pagination/pagination_test.go @@ -73,7 +73,7 @@ func TestStartAndEndPage_CannotConvertPage(t *testing.T) { } func TestStartAndEndPage_ExceedsMaxPage(t *testing.T) { - wanted := "page start 0 >= validator list 0" + wanted := "page start 0 >= list 0" if _, _, _, err := StartAndEndPage("", 0, 0); !strings.Contains(err.Error(), wanted) { t.Fatalf("wanted error: %v, got error: %v", wanted, err.Error()) }