Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions beacon-chain/rpc/prysm/v1alpha1/validator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/OffchainLabs/prysm/v6/config/params"
"github.com/OffchainLabs/prysm/v6/crypto/bls"
"github.com/OffchainLabs/prysm/v6/encoding/bytesutil"
"github.com/OffchainLabs/prysm/v6/encoding/ssz/equality"
ethpb "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1"
"github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1/attestation"
attaggregation "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1/attestation/aggregation/attestations"
Expand Down Expand Up @@ -169,15 +170,15 @@ func TestSubmitAggregateAndProof_AggregateOk(t *testing.T) {

require.NoError(t, aggregatorServer.AttPool.SaveAggregatedAttestation(att0))
require.NoError(t, aggregatorServer.AttPool.SaveAggregatedAttestation(att1))
_, err = aggregatorServer.SubmitAggregateSelectionProof(ctx, req)
res, err := aggregatorServer.SubmitAggregateSelectionProof(ctx, req)
require.NoError(t, err)

aggregatedAtts := aggregatorServer.AttPool.AggregatedAttestations()
wanted, err := attaggregation.AggregatePair(att0, att1)
require.NoError(t, err)
if reflect.DeepEqual(aggregatedAtts, wanted) {
// Validate the server returned one of the pre-existing aggregated attestations (no pool mutation expected).
if !equality.DeepEqual(res.AggregateAndProof.Aggregate, att0) && !equality.DeepEqual(res.AggregateAndProof.Aggregate, att1) {
t.Error("Did not receive wanted attestation")
}
// Optionally confirm the pool was not mutated by the call.
assert.Equal(t, 2, len(aggregatorServer.AttPool.AggregatedAttestations()))
}

func TestSubmitAggregateAndProof_AggregateNotOk(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions changelog/GarmashAlex_fix-validator-aggregator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- fix TestSubmitAggregateAndProof_AggregateOk to assert RPC result and not mutate pool (#15861).