Skip to content

Commit

Permalink
Substantial VC cleanup (#13593)
Browse files Browse the repository at this point in the history
* Cleanup part 1

* Cleanup part 2

* Cleanup part 3

* remove lock field init

* doc for SignerConfig

* remove vars

* use full Keymanager word in function

* revert interface rename

* linter

* fix build issues

* review
  • Loading branch information
rkapka authored May 21, 2024
1 parent 9befb6b commit 30cc23c
Show file tree
Hide file tree
Showing 49 changed files with 670 additions and 799 deletions.
4 changes: 2 additions & 2 deletions testing/validator-mock/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package(default_testonly = True)
go_library(
name = "go_default_library",
srcs = [
"beacon_chain_client_mock.go",
"chain_client_mock.go",
"node_client_mock.go",
"prysm_beacon_chain_client_mock.go",
"prysm_chain_client_mock.go",
"validator_client_mock.go",
],
importpath = "github.com/prysmaticlabs/prysm/v5/testing/validator-mock",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 0 additions & 57 deletions testing/validator-mock/prysm_beacon_chain_client_mock.go

This file was deleted.

52 changes: 52 additions & 0 deletions testing/validator-mock/prysm_chain_client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions validator/client/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot primitives
}

// Avoid sending beacon node duplicated aggregation requests.
k := validatorSubscribeKey(slot, duty.CommitteeIndex)
k := validatorSubnetSubscriptionKey(slot, duty.CommitteeIndex)
v.aggregatedSlotCommitteeIDCacheLock.Lock()
if v.aggregatedSlotCommitteeIDCache.Contains(k) {
v.aggregatedSlotCommitteeIDCacheLock.Unlock()
Expand Down Expand Up @@ -149,7 +149,7 @@ func (v *validator) signSlotWithSelectionProof(ctx context.Context, pubKey [fiel
if err != nil {
return nil, err
}
sig, err = v.keyManager.Sign(ctx, &validatorpb.SignRequest{
sig, err = v.km.Sign(ctx, &validatorpb.SignRequest{
PublicKey: pubKey[:],
SigningRoot: root[:],
SignatureDomain: domain.SignatureDomain,
Expand Down Expand Up @@ -203,7 +203,7 @@ func (v *validator) aggregateAndProofSig(ctx context.Context, pubKey [fieldparam
if err != nil {
return nil, err
}
sig, err = v.keyManager.Sign(ctx, &validatorpb.SignRequest{
sig, err = v.km.Sign(ctx, &validatorpb.SignRequest{
PublicKey: pubKey[:],
SigningRoot: root[:],
SignatureDomain: d.SignatureDomain,
Expand Down
2 changes: 1 addition & 1 deletion validator/client/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (v *validator) signAtt(ctx context.Context, pubKey [fieldparams.BLSPubkeyLe
if err != nil {
return nil, [32]byte{}, err
}
sig, err := v.keyManager.Sign(ctx, &validatorpb.SignRequest{
sig, err := v.km.Sign(ctx, &validatorpb.SignRequest{
PublicKey: pubKey[:],
SigningRoot: root[:],
SignatureDomain: domain.SignatureDomain,
Expand Down
4 changes: 2 additions & 2 deletions validator/client/attest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func TestAttestToBlockHead_AttestsCorrectly(t *testing.T) {
root, err := signing.ComputeSigningRoot(expectedAttestation.Data, make([]byte, 32))
require.NoError(t, err)

sig, err := validator.keyManager.Sign(context.Background(), &validatorpb.SignRequest{
sig, err := validator.km.Sign(context.Background(), &validatorpb.SignRequest{
PublicKey: validatorKey.PublicKey().Marshal(),
SigningRoot: root[:],
})
Expand Down Expand Up @@ -504,7 +504,7 @@ func TestSignAttestation(t *testing.T) {
att.Data.BeaconBlockRoot = bytesutil.PadTo([]byte("blockRoot"), 32)

pk := testKeyFromBytes(t, []byte{1})
validator.keyManager = newMockKeymanager(t, pk)
validator.km = newMockKeymanager(t, pk)
sig, sr, err := validator.signAtt(ctx, pk.pub, att.Data, att.Data.Slot)
require.NoError(t, err, "%x,%x,%v", sig, sr, err)
require.Equal(t, "b6a60f8497bd328908be83634d045"+
Expand Down
Loading

0 comments on commit 30cc23c

Please sign in to comment.