mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Add /eth/v2/validator/aggregate_attestation (#14481)
* add endpoint * changelog * fix tests * fix endpoint * remove useless broken code * review + fix endpoint * gaz * fix aggregate selection proof test * fixes * new way of aggregating * nit * fix part of the tests * fix tests * cleanup * fix AggSelectionProof test * tests * v1 tests * v2 tests * commiittee bits --------- Co-authored-by: rkapka <radoslaw.kapka@gmail.com> Co-authored-by: Radosław Kapka <rkapka@wp.pl>
This commit is contained in:
@@ -2,6 +2,7 @@ package beacon_api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
@@ -52,7 +53,12 @@ func (c *beaconApiValidatorClient) submitAggregateSelectionProof(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
aggregatedAttestation, err := convertAttestationToProto(aggregateAttestationResponse.Data)
|
||||
var attData *structs.Attestation
|
||||
if err := json.Unmarshal(aggregateAttestationResponse.Data, &attData); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to unmarshal aggregate attestation data")
|
||||
}
|
||||
|
||||
aggregatedAttestation, err := convertAttestationToProto(attData)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to convert aggregate attestation json to proto")
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package beacon_api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
@@ -124,6 +125,9 @@ func TestSubmitAggregateSelectionProof(t *testing.T) {
|
||||
test.attestationDataErr,
|
||||
).Times(test.attestationDataCalled)
|
||||
|
||||
attestationJSON, err := json.Marshal(jsonifyAttestation(aggregateAttestation))
|
||||
require.NoError(t, err)
|
||||
|
||||
// Call attestation data to get attestation data root to query aggregate attestation.
|
||||
jsonRestHandler.EXPECT().Get(
|
||||
gomock.Any(),
|
||||
@@ -132,7 +136,7 @@ func TestSubmitAggregateSelectionProof(t *testing.T) {
|
||||
).SetArg(
|
||||
2,
|
||||
structs.AggregateAttestationResponse{
|
||||
Data: jsonifyAttestation(aggregateAttestation),
|
||||
Data: attestationJSON,
|
||||
},
|
||||
).Return(
|
||||
test.aggregateAttestationErr,
|
||||
|
||||
Reference in New Issue
Block a user