mirror of
https://github.com/wealdtech/ethdo.git
synced 2026-01-07 21:24:01 -05:00
Linting.
This commit is contained in:
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(accountCmd)
|
||||
}
|
||||
|
||||
func accountFlags(cmd *cobra.Command) {
|
||||
func accountFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type dataOut struct {
|
||||
account e2wtypes.Account
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type dataIn struct {
|
||||
showWithdrawalCredentials bool
|
||||
}
|
||||
|
||||
func input(ctx context.Context) (*dataIn, error) {
|
||||
func input(_ context.Context) (*dataIn, error) {
|
||||
data := &dataIn{}
|
||||
|
||||
// Quiet.
|
||||
|
||||
@@ -29,7 +29,7 @@ type dataOut struct {
|
||||
key *e2types.BLSPrivateKey
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type dataOut struct {
|
||||
account e2wtypes.Account
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type dataOut struct {
|
||||
key []byte
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(attesterCmd)
|
||||
}
|
||||
|
||||
func attesterFlags(cmd *cobra.Command) {
|
||||
func attesterFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ type dataOut struct {
|
||||
duty *api.AttesterDuty
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
verbose: data.verbose,
|
||||
}
|
||||
|
||||
duty, err := duty(ctx, data.eth2Client, validator, data.epoch, data.slotsPerEpoch)
|
||||
duty, err := duty(ctx, data.eth2Client, validator, data.epoch)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to obtain duty for validator")
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch spec.Epoch, slotsPerEpoch uint64) (*api.AttesterDuty, error) {
|
||||
func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch spec.Epoch) (*api.AttesterDuty, error) {
|
||||
// Find the attesting slot for the given epoch.
|
||||
duties, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, epoch, []spec.ValidatorIndex{validator.Index})
|
||||
if err != nil {
|
||||
|
||||
@@ -38,7 +38,7 @@ type dataOut struct {
|
||||
targetTimely bool
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
buf := strings.Builder{}
|
||||
if data == nil {
|
||||
return buf.String(), errors.New("no data")
|
||||
|
||||
@@ -64,7 +64,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
verbose: data.verbose,
|
||||
}
|
||||
|
||||
duty, err := duty(ctx, data.eth2Client, validator, data.epoch, data.slotsPerEpoch)
|
||||
duty, err := duty(ctx, data.eth2Client, validator, data.epoch)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to obtain duty for validator")
|
||||
}
|
||||
@@ -175,7 +175,7 @@ func calcTargetCorrect(ctx context.Context, data *dataIn, attestation *phase0.At
|
||||
}
|
||||
}
|
||||
|
||||
func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch phase0.Epoch, slotsPerEpoch uint64) (*api.AttesterDuty, error) {
|
||||
func duty(ctx context.Context, eth2Client eth2client.Service, validator *api.Validator, epoch phase0.Epoch) (*api.AttesterDuty, error) {
|
||||
// Find the attesting slot for the given epoch.
|
||||
duties, err := eth2Client.(eth2client.AttesterDutiesProvider).AttesterDuties(ctx, epoch, []phase0.ValidatorIndex{validator.Index})
|
||||
if err != nil {
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(blockCmd)
|
||||
}
|
||||
|
||||
func blockFlags(cmd *cobra.Command) {
|
||||
func blockFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ type attestationData struct {
|
||||
Index int `json:"index"`
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -106,9 +106,8 @@ func (c *command) outputTxt(_ context.Context) (string, error) {
|
||||
if attestation.NewVotes == 0 {
|
||||
builder.WriteString("\n")
|
||||
continue
|
||||
} else {
|
||||
builder.WriteString(", ")
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
switch {
|
||||
case !attestation.HeadCorrect:
|
||||
builder.WriteString("head vote incorrect, ")
|
||||
|
||||
@@ -77,11 +77,7 @@ func (c *command) analyze(ctx context.Context, block *spec.VersionedSignedBeacon
|
||||
return err
|
||||
}
|
||||
|
||||
if err := c.analyzeSyncCommittees(ctx, block); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.analyzeSyncCommittees(ctx, block)
|
||||
}
|
||||
|
||||
func (c *command) analyzeAttestations(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error {
|
||||
@@ -213,7 +209,7 @@ func (c *command) fetchParents(ctx context.Context, block *spec.VersionedSignedB
|
||||
return c.fetchParents(ctx, parentBlock, minSlot)
|
||||
}
|
||||
|
||||
func (c *command) processParentBlock(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error {
|
||||
func (c *command) processParentBlock(_ context.Context, block *spec.VersionedSignedBeaconBlock) error {
|
||||
attestations, err := block.Attestations()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -412,7 +408,7 @@ func (c *command) calcTargetCorrect(ctx context.Context, attestation *phase0.Att
|
||||
return bytes.Equal(root[:], attestation.Data.Target.Root[:]), nil
|
||||
}
|
||||
|
||||
func (c *command) analyzeSyncCommittees(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error {
|
||||
func (c *command) analyzeSyncCommittees(_ context.Context, block *spec.VersionedSignedBeaconBlock) error {
|
||||
c.analysis.SyncCommitee = &syncCommitteeAnalysis{}
|
||||
switch block.Version {
|
||||
case spec.DataVersionPhase0:
|
||||
|
||||
@@ -43,7 +43,7 @@ type dataOut struct {
|
||||
slotsPerEpoch uint64
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
@@ -51,7 +51,7 @@ func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func outputBlockGeneral(ctx context.Context,
|
||||
func outputBlockGeneral(_ context.Context,
|
||||
verbose bool,
|
||||
slot phase0.Slot,
|
||||
blockRoot phase0.Root,
|
||||
@@ -89,7 +89,7 @@ func outputBlockGeneral(ctx context.Context,
|
||||
return res.String(), nil
|
||||
}
|
||||
|
||||
func outputBlockETH1Data(ctx context.Context, eth1Data *phase0.ETH1Data) (string, error) {
|
||||
func outputBlockETH1Data(_ context.Context, eth1Data *phase0.ETH1Data) (string, error) {
|
||||
res := strings.Builder{}
|
||||
|
||||
res.WriteString(fmt.Sprintf("Ethereum 1 deposit count: %d\n", eth1Data.DepositCount))
|
||||
@@ -194,7 +194,7 @@ func outputBlockAttesterSlashings(ctx context.Context, eth2Client eth2client.Ser
|
||||
return res.String(), nil
|
||||
}
|
||||
|
||||
func outputBlockDeposits(ctx context.Context, verbose bool, deposits []*phase0.Deposit) (string, error) {
|
||||
func outputBlockDeposits(_ context.Context, verbose bool, deposits []*phase0.Deposit) (string, error) {
|
||||
res := strings.Builder{}
|
||||
|
||||
// Deposits.
|
||||
@@ -638,7 +638,7 @@ func outputPhase0BlockText(ctx context.Context, data *dataOut, signedBlock *phas
|
||||
return res.String(), nil
|
||||
}
|
||||
|
||||
func outputCapellaBlockExecutionPayload(ctx context.Context,
|
||||
func outputCapellaBlockExecutionPayload(_ context.Context,
|
||||
verbose bool,
|
||||
payload *capella.ExecutionPayload,
|
||||
) (
|
||||
@@ -706,7 +706,7 @@ func outputCapellaBlockExecutionPayload(ctx context.Context,
|
||||
return res.String(), nil
|
||||
}
|
||||
|
||||
func outputBellatrixBlockExecutionPayload(ctx context.Context,
|
||||
func outputBellatrixBlockExecutionPayload(_ context.Context,
|
||||
verbose bool,
|
||||
payload *bellatrix.ExecutionPayload,
|
||||
) (
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(chainCmd)
|
||||
}
|
||||
|
||||
func chainFlags(cmd *cobra.Command) {
|
||||
func chainFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ type vote struct {
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -42,7 +42,7 @@ func (c *command) output(ctx context.Context) (string, error) {
|
||||
return c.outputText(ctx)
|
||||
}
|
||||
|
||||
func (c *command) outputJSON(ctx context.Context) (string, error) {
|
||||
func (c *command) outputJSON(_ context.Context) (string, error) {
|
||||
votes := make([]*vote, 0, len(c.votes))
|
||||
totalVotes := 0
|
||||
for _, vote := range c.votes {
|
||||
@@ -71,7 +71,7 @@ func (c *command) outputJSON(ctx context.Context) (string, error) {
|
||||
return string(data), nil
|
||||
}
|
||||
|
||||
func (c *command) outputText(ctx context.Context) (string, error) {
|
||||
func (c *command) outputText(_ context.Context) (string, error) {
|
||||
builder := strings.Builder{}
|
||||
|
||||
builder.WriteString("Voting period: ")
|
||||
|
||||
@@ -47,7 +47,7 @@ type command struct {
|
||||
exitQueue int
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -36,7 +36,7 @@ func (c *command) output(ctx context.Context) (string, error) {
|
||||
return c.outputText(ctx)
|
||||
}
|
||||
|
||||
func (c *command) outputJSON(ctx context.Context) (string, error) {
|
||||
func (c *command) outputJSON(_ context.Context) (string, error) {
|
||||
output := &jsonOutput{
|
||||
ActivationQueue: c.activationQueue,
|
||||
ExitQueue: c.exitQueue,
|
||||
@@ -49,7 +49,7 @@ func (c *command) outputJSON(ctx context.Context) (string, error) {
|
||||
return string(data), nil
|
||||
}
|
||||
|
||||
func (c *command) outputText(ctx context.Context) (string, error) {
|
||||
func (c *command) outputText(_ context.Context) (string, error) {
|
||||
builder := strings.Builder{}
|
||||
|
||||
if c.activationQueue > 0 {
|
||||
|
||||
@@ -36,7 +36,7 @@ type dataIn struct {
|
||||
epoch string
|
||||
}
|
||||
|
||||
func input(ctx context.Context) (*dataIn, error) {
|
||||
func input(_ context.Context) (*dataIn, error) {
|
||||
data := &dataIn{}
|
||||
|
||||
if viper.GetDuration("timeout") == 0 {
|
||||
|
||||
@@ -41,7 +41,7 @@ type dataOut struct {
|
||||
syncCommitteePeriodEpochEnd spec.Epoch
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ type command struct {
|
||||
additionalInfo string
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (c *command) output(ctx context.Context) (string, error) {
|
||||
func (c *command) output(_ context.Context) (string, error) {
|
||||
if c.quiet {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(depositCmd)
|
||||
}
|
||||
|
||||
func depositFlags(cmd *cobra.Command) {
|
||||
func depositFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ func init() {
|
||||
RootCmd.AddCommand(epochCmd)
|
||||
}
|
||||
|
||||
func epochFlags(cmd *cobra.Command) {
|
||||
func epochFlags(_ *cobra.Command) {
|
||||
epochSummaryCmd.Flags().String("epoch", "", "the epoch for which to obtain information (default current, can be 'current', 'last' or a number)")
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ type nonParticipatingValidator struct {
|
||||
Committee phase0.CommitteeIndex `json:"committee_index"`
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -48,11 +48,7 @@ func (c *command) process(ctx context.Context) error {
|
||||
if err := c.processAttesterDuties(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := c.processSyncCommitteeDuties(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.processSyncCommitteeDuties(ctx)
|
||||
}
|
||||
|
||||
func (c *command) processProposerDuties(ctx context.Context) error {
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(exitCmd)
|
||||
}
|
||||
|
||||
func exitFlags(cmd *cobra.Command) {
|
||||
func exitFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(nodeCmd)
|
||||
}
|
||||
|
||||
func nodeFlags(cmd *cobra.Command) {
|
||||
func nodeFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(proposerCmd)
|
||||
}
|
||||
|
||||
func proposerFlags(cmd *cobra.Command) {
|
||||
func proposerFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ type results struct {
|
||||
Duties []*apiv1.ProposerDuty `json:"duties"`
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -48,7 +48,7 @@ var RootCmd = &cobra.Command{
|
||||
PersistentPreRunE: persistentPreRunE,
|
||||
}
|
||||
|
||||
func persistentPreRunE(cmd *cobra.Command, args []string) error {
|
||||
func persistentPreRunE(cmd *cobra.Command, _ []string) error {
|
||||
if cmd.Name() == "help" {
|
||||
// User just wants help
|
||||
return nil
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(slotCmd)
|
||||
}
|
||||
|
||||
func slotFlags(cmd *cobra.Command) {
|
||||
func slotFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ type dataOut struct {
|
||||
endTime time.Time
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
RootCmd.AddCommand(synccommitteeCmd)
|
||||
}
|
||||
|
||||
func synccommitteeFlags(cmd *cobra.Command) {
|
||||
func synccommitteeFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ type command struct {
|
||||
inclusions []int
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (c *command) output(ctx context.Context) (string, error) {
|
||||
func (c *command) output(_ context.Context) (string, error) {
|
||||
if c.quiet {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ func (c *command) setup(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *command) calculateSlots(ctx context.Context) (phase0.Slot, phase0.Slot) {
|
||||
func (c *command) calculateSlots(_ context.Context) (phase0.Slot, phase0.Slot) {
|
||||
var firstSlot phase0.Slot
|
||||
var lastSlot phase0.Slot
|
||||
if c.epoch == -1 {
|
||||
|
||||
@@ -31,7 +31,7 @@ type dataOut struct {
|
||||
validators []phase0.ValidatorIndex
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func calculateEpoch(ctx context.Context, data *dataIn) (phase0.Epoch, error) {
|
||||
func calculateEpoch(_ context.Context, data *dataIn) (phase0.Epoch, error) {
|
||||
var epoch phase0.Epoch
|
||||
if data.epoch != -1 {
|
||||
epoch = phase0.Epoch(data.epoch)
|
||||
|
||||
@@ -28,7 +28,7 @@ func init() {
|
||||
RootCmd.AddCommand(validatorCmd)
|
||||
}
|
||||
|
||||
func validatorFlags(cmd *cobra.Command) {
|
||||
func validatorFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
func validatorBindings() {
|
||||
|
||||
@@ -44,7 +44,7 @@ type command struct {
|
||||
validatorInfo *apiv1.Validator
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
ethutil "github.com/wealdtech/go-eth2-util"
|
||||
)
|
||||
|
||||
func (c *command) output(ctx context.Context) (string, error) {
|
||||
func (c *command) output(_ context.Context) (string, error) {
|
||||
if c.quiet {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/wealdtech/ethdo/beacon"
|
||||
)
|
||||
|
||||
@@ -37,11 +38,7 @@ func (c *command) obtainChainInfo(ctx context.Context) error {
|
||||
return fmt.Errorf("failed to obtain offline preparation file: %w", err)
|
||||
}
|
||||
|
||||
if err := c.obtainChainInfoFromNode(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.obtainChainInfoFromNode(ctx)
|
||||
}
|
||||
|
||||
// obtainChainInfoFromFile obtains chain information from a pre-generated file.
|
||||
@@ -95,10 +92,10 @@ func (c *command) obtainChainInfoFromNode(ctx context.Context) error {
|
||||
func (c *command) writeChainInfoToFile(_ context.Context) error {
|
||||
data, err := json.Marshal(c.chainInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "failed to generate chain info JSON")
|
||||
}
|
||||
if err := os.WriteFile(offlinePreparationFilename, data, 0o600); err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "failed write chain info JSON")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -294,11 +294,7 @@ func (c *command) generateOperationsFromAccountAndWithdrawalAccount(ctx context.
|
||||
return errors.Wrap(err, "failed to obtain validator info")
|
||||
}
|
||||
|
||||
if err := c.generateOperationFromAccount(ctx, validatorInfo, withdrawalAccount); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.generateOperationFromAccount(ctx, validatorInfo, withdrawalAccount)
|
||||
}
|
||||
|
||||
func (c *command) generateOperationsFromAccountAndPrivateKey(ctx context.Context) error {
|
||||
@@ -321,11 +317,7 @@ func (c *command) generateOperationsFromAccountAndPrivateKey(ctx context.Context
|
||||
return errors.Wrap(err, "failed to obtain validator info")
|
||||
}
|
||||
|
||||
if err := c.generateOperationFromAccount(ctx, validatorInfo, withdrawalAccount); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.generateOperationFromAccount(ctx, validatorInfo, withdrawalAccount)
|
||||
}
|
||||
|
||||
func (c *command) generateOperationsFromValidatorAndPrivateKey(ctx context.Context) error {
|
||||
@@ -348,11 +340,7 @@ func (c *command) generateOperationsFromValidatorAndPrivateKey(ctx context.Conte
|
||||
return err
|
||||
}
|
||||
|
||||
if err := c.generateOperationFromAccount(ctx, validatorInfo, withdrawalAccount); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.generateOperationFromAccount(ctx, validatorInfo, withdrawalAccount)
|
||||
}
|
||||
|
||||
func (c *command) generateOperationsFromPrivateKey(ctx context.Context) error {
|
||||
@@ -633,7 +621,7 @@ func (c *command) validateOperations(ctx context.Context) (bool, string) {
|
||||
return true, ""
|
||||
}
|
||||
|
||||
func (c *command) verifyOperation(ctx context.Context, op *capella.SignedBLSToExecutionChange) error {
|
||||
func (c *command) verifyOperation(_ context.Context, op *capella.SignedBLSToExecutionChange) error {
|
||||
root, err := op.Message.HashTreeRoot()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to generate message root")
|
||||
@@ -778,7 +766,7 @@ func (c *command) generateDomain(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *command) obtainGenesisValidatorsRoot(ctx context.Context) (phase0.Root, error) {
|
||||
func (c *command) obtainGenesisValidatorsRoot(_ context.Context) (phase0.Root, error) {
|
||||
genesisValidatorsRoot := phase0.Root{}
|
||||
|
||||
if c.genesisValidatorsRoot != "" {
|
||||
@@ -806,7 +794,7 @@ func (c *command) obtainGenesisValidatorsRoot(ctx context.Context) (phase0.Root,
|
||||
return genesisValidatorsRoot, nil
|
||||
}
|
||||
|
||||
func (c *command) obtainForkVersion(ctx context.Context) (phase0.Version, error) {
|
||||
func (c *command) obtainForkVersion(_ context.Context) (phase0.Version, error) {
|
||||
forkVersion := phase0.Version{}
|
||||
|
||||
if c.forkVersion != "" {
|
||||
|
||||
@@ -121,7 +121,7 @@ func input() (*dataIn, error) {
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func inputForkVersion(ctx context.Context) (*spec.Version, error) {
|
||||
func inputForkVersion(_ context.Context) (*spec.Version, error) {
|
||||
// Default to mainnet.
|
||||
forkVersion := &spec.Version{0x00, 0x00, 0x00, 0x00}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ type dataIn struct {
|
||||
index string
|
||||
}
|
||||
|
||||
func input(ctx context.Context) (*dataIn, error) {
|
||||
func input(_ context.Context) (*dataIn, error) {
|
||||
data := &dataIn{}
|
||||
|
||||
if viper.GetDuration("timeout") == 0 {
|
||||
|
||||
@@ -35,7 +35,7 @@ type dataOut struct {
|
||||
nextEpochAttesterDuty *api.AttesterDuty
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/wealdtech/ethdo/beacon"
|
||||
)
|
||||
|
||||
@@ -37,11 +38,7 @@ func (c *command) obtainChainInfo(ctx context.Context) error {
|
||||
return fmt.Errorf("failed to obtain offline preparation file: %w", err)
|
||||
}
|
||||
|
||||
if err := c.obtainChainInfoFromNode(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.obtainChainInfoFromNode(ctx)
|
||||
}
|
||||
|
||||
// obtainChainInfoFromFile obtains chain information from a pre-generated file.
|
||||
@@ -95,10 +92,10 @@ func (c *command) obtainChainInfoFromNode(ctx context.Context) error {
|
||||
func (c *command) writeChainInfoToFile(_ context.Context) error {
|
||||
data, err := json.Marshal(c.chainInfo)
|
||||
if err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "failed to generate chain info JSON")
|
||||
}
|
||||
if err := os.WriteFile(offlinePreparationFilename, data, 0o600); err != nil {
|
||||
return err
|
||||
return errors.Wrap(err, "failed write chain info JSON")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -134,19 +134,13 @@ func (c *command) generateOperationFromMnemonicAndPath(ctx context.Context) erro
|
||||
return err
|
||||
}
|
||||
|
||||
// Turn the validators in to a map for easy lookup.
|
||||
validators := make(map[string]*beacon.ValidatorInfo, 0)
|
||||
for _, validator := range c.chainInfo.Validators {
|
||||
validators[fmt.Sprintf("%#x", validator.Pubkey)] = validator
|
||||
}
|
||||
|
||||
validatorKeyPath := c.path
|
||||
match := validatorPath.Match([]byte(c.path))
|
||||
if !match {
|
||||
return fmt.Errorf("path %s does not match EIP-2334 format for a validator", c.path)
|
||||
}
|
||||
|
||||
if err := c.generateOperationFromSeedAndPath(ctx, validators, seed, validatorKeyPath); err != nil {
|
||||
if err := c.generateOperationFromSeedAndPath(ctx, seed, validatorKeyPath); err != nil {
|
||||
return errors.Wrap(err, "failed to generate operation from seed and path")
|
||||
}
|
||||
|
||||
@@ -202,11 +196,7 @@ func (c *command) generateOperationFromPrivateKey(ctx context.Context) error {
|
||||
return errors.Wrap(err, "failed to parse validator account")
|
||||
}
|
||||
|
||||
if err = c.generateOperationFromAccount(ctx, validatorAccount); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.generateOperationFromAccount(ctx, validatorAccount)
|
||||
}
|
||||
|
||||
func (c *command) generateOperationFromValidator(ctx context.Context) error {
|
||||
@@ -215,11 +205,7 @@ func (c *command) generateOperationFromValidator(ctx context.Context) error {
|
||||
return errors.Wrap(err, "failed to parse validator account")
|
||||
}
|
||||
|
||||
if err := c.generateOperationFromAccount(ctx, validatorAccount); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.generateOperationFromAccount(ctx, validatorAccount)
|
||||
}
|
||||
|
||||
func (c *command) obtainOperationFromFileOrInput(ctx context.Context) error {
|
||||
@@ -247,11 +233,7 @@ func (c *command) obtainOperationFromFile(ctx context.Context) error {
|
||||
return errors.Wrap(err, "failed to parse exit operation file")
|
||||
}
|
||||
|
||||
if err := c.verifySignedOperation(ctx, c.signedOperation); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.verifySignedOperation(ctx, c.signedOperation)
|
||||
}
|
||||
|
||||
func (c *command) obtainOperationFromInput(ctx context.Context) error {
|
||||
@@ -268,15 +250,10 @@ func (c *command) obtainOperationFromInput(ctx context.Context) error {
|
||||
return errors.Wrap(err, "failed to parse exit operation input")
|
||||
}
|
||||
|
||||
if err := c.verifySignedOperation(ctx, c.signedOperation); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return c.verifySignedOperation(ctx, c.signedOperation)
|
||||
}
|
||||
|
||||
func (c *command) generateOperationFromSeedAndPath(ctx context.Context,
|
||||
validators map[string]*beacon.ValidatorInfo,
|
||||
seed []byte,
|
||||
path string,
|
||||
) error {
|
||||
@@ -502,7 +479,7 @@ func (c *command) generateDomain(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *command) obtainGenesisValidatorsRoot(ctx context.Context) (phase0.Root, error) {
|
||||
func (c *command) obtainGenesisValidatorsRoot(_ context.Context) (phase0.Root, error) {
|
||||
genesisValidatorsRoot := phase0.Root{}
|
||||
|
||||
if c.genesisValidatorsRoot != "" {
|
||||
@@ -530,7 +507,7 @@ func (c *command) obtainGenesisValidatorsRoot(ctx context.Context) (phase0.Root,
|
||||
return genesisValidatorsRoot, nil
|
||||
}
|
||||
|
||||
func (c *command) obtainForkVersion(ctx context.Context) (phase0.Version, error) {
|
||||
func (c *command) obtainForkVersion(_ context.Context) (phase0.Version, error) {
|
||||
forkVersion := phase0.Version{}
|
||||
|
||||
if c.forkVersion != "" {
|
||||
|
||||
@@ -45,7 +45,7 @@ type command struct {
|
||||
timeBetweenSyncCommittees time.Duration
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
"github.com/hako/durafmt"
|
||||
)
|
||||
|
||||
func (c *command) output(ctx context.Context) (string, error) {
|
||||
func (c *command) output(_ context.Context) (string, error) {
|
||||
if c.quiet {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ type dataIn struct {
|
||||
privKey string
|
||||
}
|
||||
|
||||
func input(ctx context.Context) (*dataIn, error) {
|
||||
func input(_ context.Context) (*dataIn, error) {
|
||||
data := &dataIn{}
|
||||
|
||||
data.quiet = viper.GetBool("quiet")
|
||||
|
||||
@@ -29,7 +29,7 @@ type dataOut struct {
|
||||
path string
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, int, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, int, error) {
|
||||
if data == nil {
|
||||
return "", 1, errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
match, err = checkPrivKey(ctx, data.debug, validatorWithdrawalCredentials, key)
|
||||
match, err = checkPrivKey(ctx, validatorWithdrawalCredentials, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -73,7 +73,7 @@ func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func checkPrivKey(ctx context.Context, debug bool, validatorWithdrawalCredentials []byte, key *e2types.BLSPrivateKey) (bool, error) {
|
||||
func checkPrivKey(_ context.Context, validatorWithdrawalCredentials []byte, key *e2types.BLSPrivateKey) (bool, error) {
|
||||
pubKey := key.PublicKey()
|
||||
|
||||
withdrawalCredentials := util.SHA256(pubKey.Marshal())
|
||||
@@ -110,7 +110,7 @@ func checkMnemonic(ctx context.Context, debug bool, validatorWithdrawalCredentia
|
||||
if err != nil {
|
||||
return false, "", errors.Wrap(err, "failed to generate key")
|
||||
}
|
||||
match, err := checkPrivKey(ctx, debug, validatorWithdrawalCredentials, key)
|
||||
match, err := checkPrivKey(ctx, validatorWithdrawalCredentials, key)
|
||||
if err != nil {
|
||||
return false, "", errors.Wrap(err, "failed to match key")
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ type nonParticipatingValidator struct {
|
||||
Committee phase0.CommitteeIndex `json:"committee_index"`
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -57,7 +57,7 @@ type output struct {
|
||||
Yield decimal.Decimal `json:"yield"`
|
||||
}
|
||||
|
||||
func newCommand(ctx context.Context) (*command, error) {
|
||||
func newCommand(_ context.Context) (*command, error) {
|
||||
c := &command{
|
||||
quiet: viper.GetBool("quiet"),
|
||||
verbose: viper.GetBool("verbose"),
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/wealdtech/go-string2eth"
|
||||
)
|
||||
|
||||
func (c *command) output(ctx context.Context) (string, error) {
|
||||
func (c *command) output(_ context.Context) (string, error) {
|
||||
if c.quiet {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
@@ -28,5 +28,5 @@ func init() {
|
||||
validatorCmd.AddCommand(validatorCredentialsCmd)
|
||||
}
|
||||
|
||||
func validatorCredentialsFlags(cmd *cobra.Command) {
|
||||
func validatorCredentialsFlags(_ *cobra.Command) {
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ type dataIn struct {
|
||||
mnemonic string
|
||||
}
|
||||
|
||||
func input(ctx context.Context) (*dataIn, error) {
|
||||
func input(_ context.Context) (*dataIn, error) {
|
||||
var err error
|
||||
data := &dataIn{}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ type dataOut struct {
|
||||
mnemonic string
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
type dataOut struct{}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
e2wtypes "github.com/wealdtech/go-eth2-wallet-types/v2"
|
||||
)
|
||||
|
||||
func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
func process(_ context.Context, data *dataIn) (*dataOut, error) {
|
||||
if data == nil {
|
||||
return nil, errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type dataOut struct {
|
||||
export []byte
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ type dataIn struct {
|
||||
verify bool
|
||||
}
|
||||
|
||||
func input(ctx context.Context) (*dataIn, error) {
|
||||
func input(_ context.Context) (*dataIn, error) {
|
||||
var err error
|
||||
data := &dataIn{}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ type export struct {
|
||||
Accounts []*accountInfo `json:"accounts"`
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
e2wallet "github.com/wealdtech/go-eth2-wallet"
|
||||
)
|
||||
|
||||
func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
func process(_ context.Context, data *dataIn) (*dataOut, error) {
|
||||
if data == nil {
|
||||
return nil, errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type dataOut struct {
|
||||
shares [][]byte
|
||||
}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, data *dataOut) (string, error) {
|
||||
if data == nil {
|
||||
return "", errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ type dataIn struct {
|
||||
shares []string
|
||||
}
|
||||
|
||||
func input(ctx context.Context) (*dataIn, error) {
|
||||
func input(_ context.Context) (*dataIn, error) {
|
||||
var err error
|
||||
data := &dataIn{}
|
||||
|
||||
|
||||
@@ -19,6 +19,6 @@ import (
|
||||
|
||||
type dataOut struct{}
|
||||
|
||||
func output(ctx context.Context, data *dataOut) (string, error) {
|
||||
func output(_ context.Context, _ *dataOut) (string, error) {
|
||||
return "Wallet imported", nil
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ type sharedExport struct {
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
func process(ctx context.Context, data *dataIn) (*dataOut, error) {
|
||||
func process(_ context.Context, data *dataIn) (*dataOut, error) {
|
||||
if data == nil {
|
||||
return nil, errors.New("no data")
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func (s cryptoSource) Int63() int64 {
|
||||
return int64(binary.BigEndian.Uint64(bytes) >> 1)
|
||||
}
|
||||
|
||||
func (s cryptoSource) Seed(seed int64) {
|
||||
func (s cryptoSource) Seed(_ int64) {
|
||||
panic("seed")
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ func NewGenesisTimeProvider(genesisTime time.Time) eth2client.GenesisTimeProvide
|
||||
}
|
||||
|
||||
// GenesisTime is a mock.
|
||||
func (m *GenesisTimeProvider) GenesisTime(ctx context.Context) (time.Time, error) {
|
||||
func (m *GenesisTimeProvider) GenesisTime(_ context.Context) (time.Time, error) {
|
||||
return m.genesisTime, nil
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func NewSpecProvider(slotDuration time.Duration,
|
||||
}
|
||||
|
||||
// Spec is a mock.
|
||||
func (m *SpecProvider) Spec(ctx context.Context) (map[string]interface{}, error) {
|
||||
func (m *SpecProvider) Spec(_ context.Context) (map[string]interface{}, error) {
|
||||
return m.spec, nil
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func NewForkScheduleProvider(schedule []*phase0.Fork) eth2client.ForkSchedulePro
|
||||
}
|
||||
|
||||
// ForkSchedule is a mock.
|
||||
func (m *ForkScheduleProvider) ForkSchedule(ctx context.Context) ([]*phase0.Fork, error) {
|
||||
func (m *ForkScheduleProvider) ForkSchedule(_ context.Context) ([]*phase0.Fork, error) {
|
||||
return m.schedule, nil
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ func NewSlotsPerEpochProvider(slotsPerEpoch uint64) eth2client.SlotsPerEpochProv
|
||||
}
|
||||
|
||||
// SlotsPerEpoch is a mock.
|
||||
func (m *SlotsPerEpochProvider) SlotsPerEpoch(ctx context.Context) (uint64, error) {
|
||||
func (m *SlotsPerEpochProvider) SlotsPerEpoch(_ context.Context) (uint64, error) {
|
||||
return m.slotsPerEpoch, nil
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ func NewAttestationSubmitter() eth2client.AttestationsSubmitter {
|
||||
}
|
||||
|
||||
// SubmitAttestations is a mock.
|
||||
func (m *AttestationsSubmitter) SubmitAttestations(ctx context.Context, attestations []*phase0.Attestation) error {
|
||||
func (m *AttestationsSubmitter) SubmitAttestations(_ context.Context, _ []*phase0.Attestation) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ func NewBeaconBlockSubmitter() eth2client.BeaconBlockSubmitter {
|
||||
}
|
||||
|
||||
// SubmitBeaconBlock is a mock.
|
||||
func (m *BeaconBlockSubmitter) SubmitBeaconBlock(ctx context.Context, bloc *spec.VersionedSignedBeaconBlock) error {
|
||||
func (m *BeaconBlockSubmitter) SubmitBeaconBlock(_ context.Context, _ *spec.VersionedSignedBeaconBlock) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ func NewAggregateAttestationsSubmitter() eth2client.AggregateAttestationsSubmitt
|
||||
}
|
||||
|
||||
// SubmitAggregateAttestations is a mock.
|
||||
func (m *AggregateAttestationsSubmitter) SubmitAggregateAttestations(ctx context.Context, aggregates []*phase0.SignedAggregateAndProof) error {
|
||||
func (m *AggregateAttestationsSubmitter) SubmitAggregateAttestations(_ context.Context, _ []*phase0.SignedAggregateAndProof) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -146,6 +146,6 @@ func NewBeaconCommitteeSubscriptionsSubmitter() eth2client.BeaconCommitteeSubscr
|
||||
}
|
||||
|
||||
// SubmitBeaconCommitteeSubscriptions is a mock.
|
||||
func (m *BeaconCommitteeSubscriptionsSubmitter) SubmitBeaconCommitteeSubscriptions(ctx context.Context, subscriptions []*api.BeaconCommitteeSubscription) error {
|
||||
func (m *BeaconCommitteeSubscriptionsSubmitter) SubmitBeaconCommitteeSubscriptions(_ context.Context, _ []*api.BeaconCommitteeSubscription) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
)
|
||||
|
||||
// ParseEpoch parses input to calculate the desired epoch.
|
||||
func ParseEpoch(ctx context.Context, chainTime chaintime.Service, epochStr string) (phase0.Epoch, error) {
|
||||
func ParseEpoch(_ context.Context, chainTime chaintime.Service, epochStr string) (phase0.Epoch, error) {
|
||||
currentEpoch := chainTime.CurrentEpoch()
|
||||
switch epochStr {
|
||||
case "", "current", "-0":
|
||||
|
||||
@@ -76,7 +76,7 @@ func (a *ScratchAccount) PublicKey() e2types.PublicKey {
|
||||
}
|
||||
|
||||
// PrivateKey returns the account private key.
|
||||
func (a *ScratchAccount) PrivateKey(ctx context.Context) (e2types.PrivateKey, error) {
|
||||
func (a *ScratchAccount) PrivateKey(_ context.Context) (e2types.PrivateKey, error) {
|
||||
if a.privKey == nil {
|
||||
return nil, errors.New("no private key available")
|
||||
}
|
||||
@@ -89,24 +89,24 @@ func (a *ScratchAccount) Path() string {
|
||||
}
|
||||
|
||||
// Lock locks the account.
|
||||
func (a *ScratchAccount) Lock(ctx context.Context) error {
|
||||
func (a *ScratchAccount) Lock(_ context.Context) error {
|
||||
a.unlocked = false
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unlock unlocks the account.
|
||||
func (a *ScratchAccount) Unlock(ctx context.Context, passphrase []byte) error {
|
||||
func (a *ScratchAccount) Unlock(_ context.Context, _ []byte) error {
|
||||
a.unlocked = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// IsUnlocked returns true if the account is unlocked.
|
||||
func (a *ScratchAccount) IsUnlocked(ctx context.Context) (bool, error) {
|
||||
func (a *ScratchAccount) IsUnlocked(_ context.Context) (bool, error) {
|
||||
return a.unlocked, nil
|
||||
}
|
||||
|
||||
// Sign signs data with the account's private key.
|
||||
func (a *ScratchAccount) Sign(ctx context.Context, data []byte) (e2types.Signature, error) {
|
||||
func (a *ScratchAccount) Sign(_ context.Context, data []byte) (e2types.Signature, error) {
|
||||
if !a.unlocked {
|
||||
return nil, errors.New("locked")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user