mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-28 14:17:17 +00:00
b7175b3482
* Revert "Revert "Update fastssz" (#7100)"
This reverts commit b954db9704
.
* Preston's patch
* Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Update fssz, add regression test case
* more HTR with fssz
* fix some tests
* only one test left
* Make it so that HTR will work
* gofmt, imports
* gofmt, imports
* fix
* Merge branch 'master' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* fix
* Merge branch 'master' into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
* gaz
* Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
* fix test
* Merge branch 'revert-7100-revert-6760-update-fssz' of github.com:prysmaticlabs/prysm into revert-7100-revert-6760-update-fssz
* Merge refs/heads/master into revert-7100-revert-6760-update-fssz
76 lines
2.4 KiB
Go
76 lines
2.4 KiB
Go
package sync
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
lru "github.com/hashicorp/golang-lru"
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/go-bitfield"
|
|
mock "github.com/prysmaticlabs/prysm/beacon-chain/blockchain/testing"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/operations/attestations"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
)
|
|
|
|
func TestBeaconAggregateProofSubscriber_CanSaveAggregatedAttestation(t *testing.T) {
|
|
c, err := lru.New(10)
|
|
require.NoError(t, err)
|
|
r := &Service{
|
|
attPool: attestations.NewPool(),
|
|
seenAttestationCache: c,
|
|
attestationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
|
}
|
|
|
|
a := ðpb.SignedAggregateAttestationAndProof{
|
|
Message: ðpb.AggregateAttestationAndProof{
|
|
Aggregate: ðpb.Attestation{
|
|
Data: ðpb.AttestationData{
|
|
Target: ðpb.Checkpoint{Root: make([]byte, 32)},
|
|
Source: ðpb.Checkpoint{Root: make([]byte, 32)},
|
|
BeaconBlockRoot: make([]byte, 32),
|
|
},
|
|
AggregationBits: bitfield.Bitlist{0x07},
|
|
},
|
|
AggregatorIndex: 100,
|
|
},
|
|
Signature: make([]byte, 96),
|
|
}
|
|
require.NoError(t, r.beaconAggregateProofSubscriber(context.Background(), a))
|
|
assert.DeepEqual(t, []*ethpb.Attestation{a.Message.Aggregate}, r.attPool.AggregatedAttestations(), "Did not save aggregated attestation")
|
|
}
|
|
|
|
func TestBeaconAggregateProofSubscriber_CanSaveUnaggregatedAttestation(t *testing.T) {
|
|
c, err := lru.New(10)
|
|
require.NoError(t, err)
|
|
r := &Service{
|
|
attPool: attestations.NewPool(),
|
|
seenAttestationCache: c,
|
|
attestationNotifier: (&mock.ChainService{}).OperationNotifier(),
|
|
}
|
|
|
|
a := ðpb.SignedAggregateAttestationAndProof{
|
|
Message: ðpb.AggregateAttestationAndProof{
|
|
Aggregate: ðpb.Attestation{
|
|
Data: ðpb.AttestationData{
|
|
Target: ðpb.Checkpoint{
|
|
Root: make([]byte, 32),
|
|
},
|
|
Source: ðpb.Checkpoint{
|
|
Root: make([]byte, 32),
|
|
},
|
|
BeaconBlockRoot: make([]byte, 32),
|
|
},
|
|
AggregationBits: bitfield.Bitlist{0x03},
|
|
Signature: make([]byte, 96),
|
|
},
|
|
AggregatorIndex: 100,
|
|
},
|
|
}
|
|
require.NoError(t, r.beaconAggregateProofSubscriber(context.Background(), a))
|
|
|
|
atts, err := r.attPool.UnaggregatedAttestations()
|
|
require.NoError(t, err)
|
|
assert.DeepEqual(t, []*ethpb.Attestation{a.Message.Aggregate}, atts, "Did not save unaggregated attestation")
|
|
}
|