diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index eb58a30c0..2e6774195 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,6 +7,7 @@ on: branches: - master - main + - v2* pull_request: permissions: contents: read diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index aa511482a..535dd3db3 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -6,6 +6,7 @@ on: branches: - master - main + - v2* pull_request: permissions: contents: read diff --git a/rocketpool-cli/commands/minipool/reduce-bond.go b/rocketpool-cli/commands/minipool/reduce-bond.go index f42150378..26f83890c 100644 --- a/rocketpool-cli/commands/minipool/reduce-bond.go +++ b/rocketpool-cli/commands/minipool/reduce-bond.go @@ -24,11 +24,13 @@ func reduceBondAmount(c *cli.Context) error { // Check the fee distributor if !details.Data.IsFeeDistributorInitialized { - fmt.Println("Minipools cannot have their bonds reduced until your fee distributor has been initialized.\nPlease run `rocketpool node initialize-fee-distributor` first, then return here to reduce your bonds.") + fmt.Println("Minipools cannot have their bonds reduced until your fee distributor has been initialized.") + fmt.Println("Please run `rocketpool node initialize-fee-distributor` first, then return here to reduce your bonds.") return nil } - fmt.Println("NOTE: this function is used to complete the bond reduction process for a minipool. If you haven't started the process already, please run `rocketpool minipool begin-bond-reduction` first.\n") + fmt.Println("NOTE: this function is used to complete the bond reduction process for a minipool. If you haven't started the process already, please run `rocketpool minipool begin-bond-reduction` first.") + fmt.Println() // Get reduceable minipools reduceableMinipools := []api.MinipoolReduceBondDetails{} @@ -109,10 +111,12 @@ func forceFeeDistribution(c *cli.Context, rp *client.Client) error { balance := response.Data.Balance if balance.Cmp(common.Big0) == 0 { - fmt.Println("Your fee distributor does not have any ETH and does not need to be distributed.\n") + fmt.Println("Your fee distributor does not have any ETH and does not need to be distributed.") + fmt.Println() return nil } - fmt.Println("NOTE: prior to bond reduction, you must distribute the funds in your fee distributor.\n") + fmt.Println("NOTE: prior to bond reduction, you must distribute the funds in your fee distributor.") + fmt.Println() // Print info balanceFloat := eth.WeiToEth(response.Data.Balance) diff --git a/rocketpool-cli/commands/minipool/rescue-dissolved.go b/rocketpool-cli/commands/minipool/rescue-dissolved.go index 52a0cc936..749c573a1 100644 --- a/rocketpool-cli/commands/minipool/rescue-dissolved.go +++ b/rocketpool-cli/commands/minipool/rescue-dissolved.go @@ -29,7 +29,9 @@ func rescueDissolved(c *cli.Context) error { // Get RP client rp := client.NewClientFromCtx(c) - fmt.Println("This command will allow you to manually deposit the remaining ETH for any dissolved minipools, activating them so you can exit them and retrieve your minipool's funds.\nPlease read our guide at https://docs.rocketpool.net/guides/node/rescue-dissolved.html to fully read about the process before continuing.\n") + fmt.Println("This command will allow you to manually deposit the remaining ETH for any dissolved minipools, activating them so you can exit them and retrieve your minipool's funds.") + fmt.Println("Please read our guide at https://docs.rocketpool.net/guides/node/rescue-dissolved.html to fully read about the process before continuing.") + fmt.Println() // Get minipool statuses details, err := rp.Api.Minipool.GetRescueDissolvedDetails() @@ -91,14 +93,14 @@ func rescueDissolved(c *cli.Context) error { fmt.Printf("\nPlease upgrade the delegate for these minipools using `rocketpool minipool delegate-upgrade` before rescuing them.%s\n\n", terminal.ColorReset) } if len(balanceCompletedMinipools) > 0 { - fmt.Printf("%NOTE: The following minipools already have 32 ETH or more deposited:\n", terminal.ColorYellow) + fmt.Printf("%sNOTE: The following minipools already have 32 ETH or more deposited:\n", terminal.ColorYellow) for _, mp := range balanceCompletedMinipools { fmt.Printf("\t%s\n", mp.Address) } fmt.Printf("\nThese minipools don't need to be rescued.%s\n\n", terminal.ColorReset) } if len(invalidBeaconStateMinipools) > 0 { - fmt.Printf("%NOTE: The following minipools have an invalid state on the Beacon Chain (expected 'initialized_pending'):\n", terminal.ColorYellow) + fmt.Printf("%sNOTE: The following minipools have an invalid state on the Beacon Chain (expected 'initialized_pending'):\n", terminal.ColorYellow) for _, mp := range invalidBeaconStateMinipools { fmt.Printf("\t%s (%s)\n", mp.Address, mp.BeaconState) } diff --git a/rocketpool-cli/commands/service/export-ec-data.go b/rocketpool-cli/commands/service/export-ec-data.go index 88708d9e0..d3c6cbab8 100644 --- a/rocketpool-cli/commands/service/export-ec-data.go +++ b/rocketpool-cli/commands/service/export-ec-data.go @@ -57,7 +57,8 @@ func exportEcData(c *cli.Context, targetDir string) error { fmt.Println("This will export your execution client's chain data to an external directory, such as a portable hard drive.") fmt.Println("If your execution client is running, it will be shut down.") - fmt.Println("Once the export is complete, your execution client will restart automatically.\n") + fmt.Println("Once the export is complete, your execution client will restart automatically.") + fmt.Println() // Get the EC volume name executionContainerName := cfg.GetDockerArtifactName(config.ExecutionClientSuffix) diff --git a/rocketpool-cli/commands/service/import-ec-data.go b/rocketpool-cli/commands/service/import-ec-data.go index c5a597ada..55648e0fe 100644 --- a/rocketpool-cli/commands/service/import-ec-data.go +++ b/rocketpool-cli/commands/service/import-ec-data.go @@ -42,7 +42,8 @@ func importEcData(c *cli.Context, sourceDir string) error { fmt.Println("This will import execution layer chain data that you previously exported into your execution client.") fmt.Println("If your execution client is running, it will be shut down.") - fmt.Println("Once the import is complete, your execution client will restart automatically.\n") + fmt.Println("Once the import is complete, your execution client will restart automatically.") + fmt.Println() // Get the volume to import into executionContainerName := cfg.GetDockerArtifactName(config.ExecutionClientSuffix) diff --git a/rocketpool-cli/commands/service/sync.go b/rocketpool-cli/commands/service/sync.go index c356a00bc..3e1209a29 100644 --- a/rocketpool-cli/commands/service/sync.go +++ b/rocketpool-cli/commands/service/sync.go @@ -92,7 +92,8 @@ func getSyncProgress(c *cli.Context) error { depositContractInfo.Data.BeaconDepositContract) return nil } else { - fmt.Println("Your Beacon Node is on the correct network.\n") + fmt.Println("Your Beacon Node is on the correct network.") + fmt.Println() } // Get node status diff --git a/rocketpool-cli/commands/wallet/utils.go b/rocketpool-cli/commands/wallet/utils.go index 13eb8eec8..eee77fa57 100644 --- a/rocketpool-cli/commands/wallet/utils.go +++ b/rocketpool-cli/commands/wallet/utils.go @@ -194,7 +194,9 @@ func promptForCustomKeyPasswords(cfg *config.SmartNodeConfig, testOnly bool) (st } // Notify the user - fmt.Println("It looks like you have some custom keystores for your minipool's validators.\nYou will be prompted for the passwords each one was encrypted with, so they can be loaded into the Validator Client that Rocket Pool manages for you.\n") + fmt.Println("It looks like you have some custom keystores for your minipool's validators.") + fmt.Println("You will be prompted for the passwords each one was encrypted with, so they can be loaded into the Validator Client that Rocket Pool manages for you.") + fmt.Println() // Get the passwords for each one pubkeyPasswords := map[string]string{} diff --git a/rocketpool-cli/utils/gas/gas.go b/rocketpool-cli/utils/gas/gas.go index 525fe6249..5467bd954 100644 --- a/rocketpool-cli/utils/gas/gas.go +++ b/rocketpool-cli/utils/gas/gas.go @@ -193,7 +193,7 @@ func handleEtherchainGasPrices(gasSuggestion gas.EtherchainGasFeeSuggestion, gas desiredPriceFloat, err := strconv.ParseFloat(desiredPrice, 64) if err != nil { - fmt.Println("Not a valid gas price (%s), try again.", err.Error()) + fmt.Printf("Not a valid gas price (%s), try again.\n", err.Error()) continue } if desiredPriceFloat <= 0 { @@ -271,7 +271,7 @@ func handleEtherscanGasPrices(gasSuggestion gas.EtherscanGasFeeSuggestion, gasIn desiredPriceFloat, err := strconv.ParseFloat(desiredPrice, 64) if err != nil { - fmt.Println("Not a valid gas price (%s), try again.", err.Error()) + fmt.Printf("Not a valid gas price (%s), try again.\n", err.Error()) continue } if desiredPriceFloat <= 0 { diff --git a/rocketpool-cli/utils/migration/import-key.go b/rocketpool-cli/utils/migration/import-key.go index ef5d90bc5..4a593be8e 100644 --- a/rocketpool-cli/utils/migration/import-key.go +++ b/rocketpool-cli/utils/migration/import-key.go @@ -47,7 +47,8 @@ func ImportKey(c *cli.Context, rp *client.Client, minipoolAddress common.Address fmt.Printf("failed!\n%sWARNING: error restarting validator client: %s\n\nPlease restart it manually so it picks up the new validator key for your minipool.%s", terminal.ColorYellow, err.Error(), terminal.ColorReset) return false } - fmt.Println("done!\n") + fmt.Println("done!") + fmt.Println() } return true diff --git a/rocketpool-daemon/api/node/deposit.go b/rocketpool-daemon/api/node/deposit.go index 6321b61fc..0b5a9928d 100644 --- a/rocketpool-daemon/api/node/deposit.go +++ b/rocketpool-daemon/api/node/deposit.go @@ -267,7 +267,7 @@ func (c *nodeDepositContext) PrepareData(data *api.NodeDepositData, opts *bind.T if status.Exists { return types.ResponseStatus_InvalidChainState, fmt.Errorf("**** ALERT ****\n"+ "Your minipool %s has the following as a validator pubkey:\n\t%s\n"+ - "This key is already in use by validator %d on the Beacon chain!\n"+ + "This key is already in use by validator %s on the Beacon chain!\n"+ "Rocket Pool will not allow you to deposit this validator for your own safety so you do not get slashed.\n"+ "PLEASE REPORT THIS TO THE ROCKET POOL DEVELOPERS.\n"+ "***************\n", minipoolAddress.Hex(), pubkey.Hex(), status.Index) diff --git a/rocketpool-daemon/node/verify-pdao-props.go b/rocketpool-daemon/node/verify-pdao-props.go index dda9e90af..776b9cba1 100644 --- a/rocketpool-daemon/node/verify-pdao-props.go +++ b/rocketpool-daemon/node/verify-pdao-props.go @@ -299,15 +299,16 @@ func (t *VerifyPdaoProps) getChallengeOrDefeatForProposal(prop *protocol.Protoco } // Check if the index has been challenged yet - var state func() types.ChallengeState + var getState func() types.ChallengeState err = t.rp.Query(func(mc *batch.MultiCaller) error { - prop.GetChallengeState(mc, newChallengedIndex) + getState = prop.GetChallengeState(mc, newChallengedIndex) return nil }, opts) if err != nil { return nil, nil, fmt.Errorf("error checking challenge state for proposal %d, index %d: %w", prop.ID, challengedIndex, err) } - switch state() { + state := getState() + switch state { case types.ChallengeState_Unchallenged: // If it's unchallenged, this is the index to challenge return &challenge{ diff --git a/rocketpool-daemon/watchtower/generate-rewards-tree.go b/rocketpool-daemon/watchtower/generate-rewards-tree.go index 805ab7cc3..b5aa565dc 100644 --- a/rocketpool-daemon/watchtower/generate-rewards-tree.go +++ b/rocketpool-daemon/watchtower/generate-rewards-tree.go @@ -231,7 +231,7 @@ func (t *GenerateRewardsTree) generateRewardsTreeImpl(logger *slog.Logger, rp *r } rewardsFile, err := treegen.GenerateTree(t.ctx) if err != nil { - t.handleError(fmt.Errorf("%s Error generating Merkle tree: %w", err), logger) + t.handleError(fmt.Errorf("Error generating Merkle tree: %w", err), logger) return } header := rewardsFile.GetHeader() diff --git a/rocketpool-daemon/watchtower/submit-rpl-price.go b/rocketpool-daemon/watchtower/submit-rpl-price.go index d8de1f299..309732c95 100644 --- a/rocketpool-daemon/watchtower/submit-rpl-price.go +++ b/rocketpool-daemon/watchtower/submit-rpl-price.go @@ -82,7 +82,7 @@ func (t *SubmitRplPrice) Run(state *state.NetworkState) error { err := t.updateL2Prices(state) if err != nil { // Error is not fatal for this task so print and continue - t.logger.Error("Error updating L2 prices: %s", err.Error()) + t.logger.Error("Error updating L2 prices", "error", err.Error()) } // Make a new RP binding just for this portion