Skip to content

Commit

Permalink
Resolve go test action errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jshufro committed Apr 17, 2024
1 parent c726ad9 commit 476c5b4
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches:
- master
- main
- v2*
pull_request:
permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- master
- main
- v2*
pull_request:
permissions:
contents: read
Expand Down
12 changes: 8 additions & 4 deletions rocketpool-cli/commands/minipool/reduce-bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions rocketpool-cli/commands/minipool/rescue-dissolved.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 2 additions & 1 deletion rocketpool-cli/commands/service/export-ec-data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion rocketpool-cli/commands/service/import-ec-data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion rocketpool-cli/commands/service/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion rocketpool-cli/commands/wallet/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
4 changes: 2 additions & 2 deletions rocketpool-cli/utils/gas/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion rocketpool-cli/utils/migration/import-key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion rocketpool-daemon/api/node/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions rocketpool-daemon/node/verify-pdao-props.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion rocketpool-daemon/watchtower/generate-rewards-tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion rocketpool-daemon/watchtower/submit-rpl-price.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 476c5b4

Please sign in to comment.