Implement multisigner for wallet

This commit is contained in:
Jim McDonald 2020-11-18 10:01:57 +00:00
parent 2e05b68684
commit 08ea6e8f2c
No known key found for this signature in database
GPG Key ID: 89CEB61B2AD2A5E7
3 changed files with 37 additions and 0 deletions

View File

@ -1,3 +1,6 @@
Development:
- upgrade wallet account manager to be able to accept multiple attestations to sign in a single request
0.9.0
- use go-eth2-client for all beacon node communications
- beacon block proposal strategy now scales per-node scores based on the distance between the slot and its parent

View File

@ -68,6 +68,9 @@ func New(ctx context.Context, params ...Parameter) (*Service, error) {
log = log.Level(parameters.logLevel)
}
// Warn about lack of slashing protection
log.Warn().Msg("The wallet account manager does not provide built-in slashing protection. Please use the dirk account manager for production systems.")
stores := make([]e2wtypes.Store, 0, len(parameters.locations))
if len(parameters.locations) == 0 {
// Use default location.

View File

@ -20,6 +20,7 @@ import (
eth2client "github.com/attestantio/go-eth2-client"
api "github.com/attestantio/go-eth2-client/api/v1"
spec "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/attestantio/vouch/services/accountmanager"
"github.com/pkg/errors"
e2types "github.com/wealdtech/go-eth2-types/v2"
e2wtypes "github.com/wealdtech/go-eth2-wallet-types/v2"
@ -124,6 +125,36 @@ func (d *ValidatingAccount) SignBeaconBlockProposal(ctx context.Context,
return d.sign(ctx, messageRoot, domain)
}
// SignBeaconAttestations signs multiple beacon attestations.
func (d *ValidatingAccount) SignBeaconAttestations(ctx context.Context,
slot spec.Slot,
accounts []accountmanager.ValidatingAccount,
committeeIndices []spec.CommitteeIndex,
blockRoot spec.Root,
sourceEpoch spec.Epoch,
sourceRoot spec.Root,
targetEpoch spec.Epoch,
targetRoot spec.Root) ([]spec.BLSSignature, error) {
signatures := make([]spec.BLSSignature, len(accounts))
var err error
for i, account := range accounts {
signatures[i], err = account.(*ValidatingAccount).SignBeaconAttestation(ctx,
slot,
committeeIndices[i],
blockRoot,
sourceEpoch,
sourceRoot,
targetEpoch,
targetRoot)
if err != nil {
return nil, err
}
}
return signatures, nil
}
// SignBeaconAttestation signs a beacon attestation item.
func (d *ValidatingAccount) SignBeaconAttestation(ctx context.Context,
slot spec.Slot,