From ecaa635e9286c98cf4c69fcd2d35928606883929 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 24 Jun 2024 15:26:55 +0200 Subject: [PATCH] Apply code style fixes --- app/app.go | 1 - app/export.go | 1 - cmd/zetaclientd/debug.go | 1 - cmd/zetaclientd/gen_pre_params.go | 2 +- cmd/zetaclientd/keygen_tss.go | 1 - cmd/zetaclientd/main.go | 1 - cmd/zetaclientd/p2p_diagnostics.go | 2 -- cmd/zetaclientd/utils.go | 1 - cmd/zetacored/add_observer_list.go | 2 -- cmd/zetacored/main.go | 1 - cmd/zetacored/parse_genesis.go | 1 - cmd/zetatool/filterdeposit/evm.go | 1 - contrib/rpctest/main.go | 2 -- e2e/e2etests/test_context_upgrade.go | 2 -- e2e/e2etests/test_eth_deposit_liquidity_cap.go | 2 -- e2e/e2etests/test_rate_limiter.go | 1 - e2e/runner/report.go | 1 - e2e/runner/setup_zeta.go | 1 - e2e/runner/zeta.go | 1 - e2e/txserver/zeta_tx_server.go | 1 - pkg/chains/address_taproot.go | 1 - pkg/proofs/ethereum/proof.go | 1 - scripts/fmt.sh | 2 +- testutil/keeper/crosschain.go | 1 - testutil/network/genesis_state.go | 1 - testutil/sample/crosschain.go | 1 - testutil/sample/lightclient.go | 1 - x/authority/client/cli/tx_add_authorization.go | 1 - x/crosschain/client/cli/cli_tss.go | 2 -- x/crosschain/client/cli/cli_zeta_height.go | 1 - x/crosschain/client/querytests/suite.go | 1 - x/crosschain/keeper/events.go | 2 -- x/crosschain/keeper/msg_server_refund_aborted_tx.go | 2 -- x/crosschain/keeper/msg_server_update_tss.go | 1 - x/crosschain/migrations/v2/migrate.go | 1 - x/crosschain/migrations/v3/migrate.go | 1 - x/crosschain/migrations/v4/migrate.go | 1 - x/crosschain/migrations/v5/migrate.go | 3 --- x/crosschain/module.go | 1 - x/crosschain/types/status.go | 1 - x/emissions/client/cli/query_get_emmisons_factors.go | 1 - x/emissions/client/cli/query_list_balances.go | 1 - x/fungible/client/cli/tx_update_contract_bytecode.go | 1 - x/fungible/genesis.go | 1 - x/lightclient/client/cli/tx_disable_verification_flags.go | 1 - x/lightclient/client/cli/tx_enable_verification_flags.go | 1 - x/lightclient/keeper/grpc_query_header_enabled_chains.go | 1 - x/lightclient/types/message_disable_verification_flags.go | 1 - x/observer/client/cli/query_blame.go | 1 - x/observer/client/cli/query_chain_params.go | 1 - x/observer/client/cli/query_get_tss_address.go | 2 -- x/observer/client/cli/query_observers.go | 1 - x/observer/client/cli/query_show_observer_count.go | 1 - x/observer/client/cli/tx_add_observer.go | 1 - x/observer/client/cli/tx_disable_cctx_flags.go | 1 - x/observer/client/cli/tx_enable_cctx_flags.go | 1 - x/observer/client/cli/tx_update_chain_params.go | 1 - x/observer/client/cli/tx_update_gas_price_increase_flags.go | 1 - x/observer/client/cli/tx_update_observer.go | 1 - x/observer/client/cli/tx_vote_tss.go | 1 - x/observer/client/querytests/suite.go | 1 - x/observer/genesis.go | 1 - x/observer/keeper/grpc_query_observer.go | 1 - x/observer/keeper/hooks.go | 1 - x/observer/keeper/keeper.go | 1 - x/observer/keeper/msg_server_vote_tss.go | 1 - x/observer/keeper/nonce_to_cctx.go | 2 -- x/observer/keeper/observer_set.go | 1 - x/observer/keeper/tss.go | 1 - x/observer/types/ballot.go | 1 - x/observer/types/keys.go | 1 - zetaclient/chains/bitcoin/observer/outbound.go | 1 - zetaclient/chains/evm/observer/observer.go | 1 - zetaclient/chains/evm/signer/outbound_data.go | 1 - zetaclient/supplychecker/zeta_supply_checker.go | 1 - zetaclient/zetacore/client.go | 1 - 76 files changed, 2 insertions(+), 88 deletions(-) diff --git a/app/app.go b/app/app.go index 0688ca75db..f5d0abd7e9 100644 --- a/app/app.go +++ b/app/app.go @@ -316,7 +316,6 @@ func New( appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), ) *App { - appCodec := encodingConfig.Codec cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry diff --git a/app/export.go b/app/export.go index d75de64514..1f1ae26a96 100644 --- a/app/export.go +++ b/app/export.go @@ -17,7 +17,6 @@ import ( func (app *App) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, ) (servertypes.ExportedApp, error) { - // as if they could withdraw from the start of the next block ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) diff --git a/cmd/zetaclientd/debug.go b/cmd/zetaclientd/debug.go index 4e10b24c25..4ba2f01516 100644 --- a/cmd/zetaclientd/debug.go +++ b/cmd/zetaclientd/debug.go @@ -187,7 +187,6 @@ func DebugCmd() *cobra.Command { if err != nil { return err } - } fmt.Println("BallotIdentifier : ", ballotIdentifier) diff --git a/cmd/zetaclientd/gen_pre_params.go b/cmd/zetaclientd/gen_pre_params.go index c797a9f206..7837867b74 100644 --- a/cmd/zetaclientd/gen_pre_params.go +++ b/cmd/zetaclientd/gen_pre_params.go @@ -18,7 +18,7 @@ var GenPrePramsCmd = &cobra.Command{ Use: "gen-pre-params ", Short: "Generate pre parameters for TSS", Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, args []string) error { startTime := time.Now() preParams, err := keygen.GeneratePreParams(time.Second * 300) if err != nil { diff --git a/cmd/zetaclientd/keygen_tss.go b/cmd/zetaclientd/keygen_tss.go index 0e74d878ca..007ce9ec8c 100644 --- a/cmd/zetaclientd/keygen_tss.go +++ b/cmd/zetaclientd/keygen_tss.go @@ -203,7 +203,6 @@ func SetTSSPubKey(tss *mc.TSS, logger zerolog.Logger) error { } logger.Info().Msgf("TSS address in hex: %s", tss.EVMAddress().Hex()) return nil - } func TestTSS(tss *mc.TSS, logger zerolog.Logger) error { keygenLogger := logger.With().Str("module", "test-keygen").Logger() diff --git a/cmd/zetaclientd/main.go b/cmd/zetaclientd/main.go index 99aaf55c10..b0b8ffb0e1 100644 --- a/cmd/zetaclientd/main.go +++ b/cmd/zetaclientd/main.go @@ -42,5 +42,4 @@ func SetupConfigForTest() { }) rand.Seed(time.Now().UnixNano()) - } diff --git a/cmd/zetaclientd/p2p_diagnostics.go b/cmd/zetaclientd/p2p_diagnostics.go index 9816c16eab..330f520013 100644 --- a/cmd/zetaclientd/p2p_diagnostics.go +++ b/cmd/zetaclientd/p2p_diagnostics.go @@ -32,7 +32,6 @@ func RunDiagnostics( hotkeyPk cryptotypes.PrivKey, cfg config.Config, ) error { - startLogger.Warn().Msg("P2P Diagnostic mode enabled") startLogger.Warn().Msgf("seed peer: %s", peers) priKey := secp256k1.PrivKey(hotkeyPk.Bytes()[:32]) @@ -46,7 +45,6 @@ func RunDiagnostics( var s *metrics.TelemetryServer if len(peers) == 0 { startLogger.Warn().Msg("No seed peer specified; assuming I'm the host") - } p2pPriKey, err := crypto.UnmarshalSecp256k1PrivateKey(priKey[:]) if err != nil { diff --git a/cmd/zetaclientd/utils.go b/cmd/zetaclientd/utils.go index 64db1c3efa..43caf04c11 100644 --- a/cmd/zetaclientd/utils.go +++ b/cmd/zetaclientd/utils.go @@ -140,7 +140,6 @@ func CreateChainObserverMap( co, err := btcobserver.NewObserver(appContext, btcChain, zetacoreClient, tss, dbpath, logger, btcConfig, ts) if err != nil { logger.Std.Error().Err(err).Msgf("NewObserver error for bitcoin chain %s", btcChain.String()) - } else { observerMap[btcChain.ChainId] = co } diff --git a/cmd/zetacored/add_observer_list.go b/cmd/zetacored/add_observer_list.go index fd614efbef..e2dd16a5b5 100644 --- a/cmd/zetacored/add_observer_list.go +++ b/cmd/zetacored/add_observer_list.go @@ -104,7 +104,6 @@ func AddObserverListCmd() *cobra.Command { ObserverBalance := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, observerTokens)) // Generate the grant authorizations and created observer list for chain for _, info := range observerInfo { - if isValidatorOnly(info.IsObserver) { balances = append(balances, banktypes.Balance{ Address: info.ObserverAddress, @@ -403,7 +402,6 @@ func addStakingGrants(grants []authz.GrantAuthorization, info ObserverInfoReader }) return grants - } func AddGenesisAccount( diff --git a/cmd/zetacored/main.go b/cmd/zetacored/main.go index b00e3dd337..69fa673548 100644 --- a/cmd/zetacored/main.go +++ b/cmd/zetacored/main.go @@ -18,7 +18,6 @@ func main() { rootCmd, _ := NewRootCmd() if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { - switch e := err.(type) { case server.ErrorCode: os.Exit(e.Code) diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index ec0a9bd313..8f177ee7ef 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -129,7 +129,6 @@ func ImportDataIntoFile( cdc codec.Codec, modifyEnabled bool, ) error { - appState, err := genutiltypes.GenesisStateFromGenDoc(*genDoc) if err != nil { return err diff --git a/cmd/zetatool/filterdeposit/evm.go b/cmd/zetatool/filterdeposit/evm.go index dadaeb4377..f2cea39b99 100644 --- a/cmd/zetatool/filterdeposit/evm.go +++ b/cmd/zetatool/filterdeposit/evm.go @@ -119,7 +119,6 @@ func GetHashListSegment( endBlock uint64, tssAddress string, cfg *config.Config) ([]Deposit, error) { - deposits := make([]Deposit, 0) connectorAddress := common.HexToAddress(cfg.ConnectorAddress) connectorContract, err := zetaconnector.NewZetaConnectorNonEth(connectorAddress, client) diff --git a/contrib/rpctest/main.go b/contrib/rpctest/main.go index 50d55468ba..a9cc1fb405 100644 --- a/contrib/rpctest/main.go +++ b/contrib/rpctest/main.go @@ -252,9 +252,7 @@ func main() { fmt.Printf(" receipt block number: %d\n", receipt.BlockNumber) fmt.Printf(" receipt transaction index: %d\n", receipt.TransactionIndex) fmt.Printf(" receipt contract address: %s\n", receipt.ContractAddress.Hex()) - } - } type EthClient struct { diff --git a/e2e/e2etests/test_context_upgrade.go b/e2e/e2etests/test_context_upgrade.go index fc1e7599de..179354707d 100644 --- a/e2e/e2etests/test_context_upgrade.go +++ b/e2e/e2etests/test_context_upgrade.go @@ -71,7 +71,6 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) { if eventIter.Event.ChainID.Cmp(chainID) != 0 { panic("chainID mismatch") } - } if found { break @@ -82,5 +81,4 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) { if !found { panic("event not found") } - } diff --git a/e2e/e2etests/test_eth_deposit_liquidity_cap.go b/e2e/e2etests/test_eth_deposit_liquidity_cap.go index a132fdd35e..82e8f26545 100644 --- a/e2e/e2etests/test_eth_deposit_liquidity_cap.go +++ b/e2e/e2etests/test_eth_deposit_liquidity_cap.go @@ -69,7 +69,6 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { } cctx = utils.WaitCctxMinedByInboundHash(r.Ctx, signedTx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) if cctx.CctxStatus.Status != types.CctxStatus_OutboundMined { - panic(fmt.Sprintf( "expected cctx status to be Success; got %s; message: %s; supply: %s; liquidity cap: %s, amountLessThanCap: %s, amountMoreThanCap: %s", cctx.CctxStatus.Status, @@ -88,7 +87,6 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { panic(err) } if bal.Cmp(expectedBalance) != 0 { - panic(fmt.Sprintf("expected balance to be %s; got %s", expectedBalance.String(), bal.String())) } r.Logger.Info("Deposit succeeded") diff --git a/e2e/e2etests/test_rate_limiter.go b/e2e/e2etests/test_rate_limiter.go index db8d67f348..b72bb882a5 100644 --- a/e2e/e2etests/test_rate_limiter.go +++ b/e2e/e2etests/test_rate_limiter.go @@ -107,7 +107,6 @@ func createAndWaitWithdraws(r *runner.E2ERunner, withdrawType withdrawType, with // Perform RateLimiterWithdrawNumber withdraws to log time for completion txs := make([]*ethtypes.Transaction, rateLimiterWithdrawNumber) for i := 0; i < rateLimiterWithdrawNumber; i++ { - // create a new withdraw depending on the type switch withdrawType { case withdrawTypeZETA: diff --git a/e2e/runner/report.go b/e2e/runner/report.go index a25360a109..cb886bc4c5 100644 --- a/e2e/runner/report.go +++ b/e2e/runner/report.go @@ -126,5 +126,4 @@ func (runner *E2ERunner) PrintNetworkReport(nr NetworkReport) { runner.Logger.Print("Block Height: %d", nr.Height) runner.Logger.Print("CCTX Processed: %d", nr.CctxCount) runner.Logger.Print("Emissions Pool Balance: %sZETA", nr.EmissionsPoolBalance.Quo(sdkmath.NewIntFromUint64(1e18))) - } diff --git a/e2e/runner/setup_zeta.go b/e2e/runner/setup_zeta.go index ac24c02de2..3cff408aee 100644 --- a/e2e/runner/setup_zeta.go +++ b/e2e/runner/setup_zeta.go @@ -197,7 +197,6 @@ func (runner *E2ERunner) SetZEVMContracts() { } runner.ContextAppAddr = contextAppAddr runner.ContextApp = contextApp - } // SetupETHZRC20 sets up the ETH ZRC20 in the runner from the values queried from the chain diff --git a/e2e/runner/zeta.go b/e2e/runner/zeta.go index 104fb4900f..098e8316a7 100644 --- a/e2e/runner/zeta.go +++ b/e2e/runner/zeta.go @@ -202,7 +202,6 @@ func (runner *E2ERunner) WithdrawZeta(amount *big.Int, waitReceipt bool) *ethtyp runner.Logger.EVMReceipt(*receipt, "send") if receipt.Status == 0 { panic(fmt.Sprintf("send failed, logs: %+v", receipt.Logs)) - } runner.Logger.Info(" Logs:") diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index fb2c403ada..b6f19a5807 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -156,7 +156,6 @@ func (zts ZetaTxServer) GetAccountAddressFromName(name string) (string, error) { // GetAllAccountAddress returns all account addresses func (zts ZetaTxServer) GetAllAccountAddress() []string { return zts.address - } // GetAccountMnemonic returns the account name from the given index diff --git a/pkg/chains/address_taproot.go b/pkg/chains/address_taproot.go index 1d927e2f9d..4ff270da7d 100644 --- a/pkg/chains/address_taproot.go +++ b/pkg/chains/address_taproot.go @@ -29,7 +29,6 @@ var _ btcutil.Address = &AddressTaproot{} // NewAddressTaproot returns a new AddressTaproot. func NewAddressTaproot(witnessProg []byte, net *chaincfg.Params) (*AddressTaproot, error) { - return newAddressTaproot(net.Bech32HRPSegwit, witnessProg) } diff --git a/pkg/proofs/ethereum/proof.go b/pkg/proofs/ethereum/proof.go index 6d457bc444..b09919f971 100644 --- a/pkg/proofs/ethereum/proof.go +++ b/pkg/proofs/ethereum/proof.go @@ -75,7 +75,6 @@ func (m *Proof) Delete(key []byte) error { func (m *Proof) Has(key []byte) (bool, error) { for i := 0; i < len(m.Keys); i++ { if bytes.Equal(m.Keys[i], key) { - return true, nil } } diff --git a/scripts/fmt.sh b/scripts/fmt.sh index 48ad19e590..7d6ef5eb9f 100755 --- a/scripts/fmt.sh +++ b/scripts/fmt.sh @@ -23,4 +23,4 @@ golines -w --max-len=120 --ignore-generated --ignored-dirs=".git" --base-formatt echo "Formatting code..." golangci-lint run --enable-only 'gci' --enable-only 'gofmt' --enable-only 'whitespace' --fix -echo "fmt completed" +echo "Code is formatted" diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index aec1ac7838..d2b1bc1d5b 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -293,7 +293,6 @@ func MockGetRevertGasLimitForERC20( }, true).Once() m.On("QueryGasLimit", mock.Anything, mock.Anything). Return(big.NewInt(returnVal), nil).Once() - } func MockPayGasAndUpdateCCTX( diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go index 18f464ccb7..7f0bb2003c 100644 --- a/testutil/network/genesis_state.go +++ b/testutil/network/genesis_state.go @@ -28,7 +28,6 @@ func SetupZetaGenesisState( observerList []string, setupChainNonces bool, ) { - // Cross-chain genesis state var crossChainGenesis types.GenesisState require.NoError(t, codec.UnmarshalJSON(genesisState[types.ModuleName], &crossChainGenesis)) diff --git a/testutil/sample/crosschain.go b/testutil/sample/crosschain.go index 7fc6678580..38d490af62 100644 --- a/testutil/sample/crosschain.go +++ b/testutil/sample/crosschain.go @@ -308,7 +308,6 @@ func GetValidZrc20WithdrawToETH(t *testing.T) (receipt ethtypes.Receipt) { err := json.Unmarshal([]byte(block), &receipt) require.NoError(t, err) return - } // receiver is bc1qysd4sp9q8my59ul9wsf5rvs9p387hf8vfwatzu diff --git a/testutil/sample/lightclient.go b/testutil/sample/lightclient.go index 70aa55b51a..bbb0fc1d9b 100644 --- a/testutil/sample/lightclient.go +++ b/testutil/sample/lightclient.go @@ -49,7 +49,6 @@ func HeaderSupportedChains() []lightclienttypes.HeaderSupportedChain { func BlockHeaderVerification() lightclienttypes.BlockHeaderVerification { return lightclienttypes.BlockHeaderVerification{HeaderSupportedChains: HeaderSupportedChains()} - } // Proof generates a proof and block header diff --git a/x/authority/client/cli/tx_add_authorization.go b/x/authority/client/cli/tx_add_authorization.go index 5658d24e91..d1329801a3 100644 --- a/x/authority/client/cli/tx_add_authorization.go +++ b/x/authority/client/cli/tx_add_authorization.go @@ -57,5 +57,4 @@ func GetPolicyType(policyTypeString string) (types.PolicyType, error) { default: return types.PolicyType_groupEmpty, fmt.Errorf("invalid policy type value: %d", policyType) } - } diff --git a/x/crosschain/client/cli/cli_tss.go b/x/crosschain/client/cli/cli_tss.go index c24733431f..f1391b9658 100644 --- a/x/crosschain/client/cli/cli_tss.go +++ b/x/crosschain/client/cli/cli_tss.go @@ -19,7 +19,6 @@ func CmdUpdateTss() *cobra.Command { Short: "Create a new TSSVoter", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - argsPubkey, err := cast.ToStringE(args[0]) if err != nil { return err @@ -45,7 +44,6 @@ func CmdMigrateTssFunds() *cobra.Command { Short: "Migrate TSS funds to the latest TSS address", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { - argsChainID, err := strconv.ParseInt(args[0], 10, 64) if err != nil { return err diff --git a/x/crosschain/client/cli/cli_zeta_height.go b/x/crosschain/client/cli/cli_zeta_height.go index a2b0f1ea51..7d1f96c8ee 100644 --- a/x/crosschain/client/cli/cli_zeta_height.go +++ b/x/crosschain/client/cli/cli_zeta_height.go @@ -14,7 +14,6 @@ func CmdLastZetaHeight() *cobra.Command { Short: "Query last Zeta Height", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/crosschain/client/querytests/suite.go b/x/crosschain/client/querytests/suite.go index ca42b9b4ec..d9354b6d18 100644 --- a/x/crosschain/client/querytests/suite.go +++ b/x/crosschain/client/querytests/suite.go @@ -52,7 +52,6 @@ func (s *CliTestSuite) SetupSuite() { s.network = net _, err = s.network.WaitForHeight(1) s.Require().NoError(err) - } func (s *CliTestSuite) TearDownSuite() { diff --git a/x/crosschain/keeper/events.go b/x/crosschain/keeper/events.go index 1bff85d750..c503835f14 100644 --- a/x/crosschain/keeper/events.go +++ b/x/crosschain/keeper/events.go @@ -56,7 +56,6 @@ func EmitZetaWithdrawCreated(ctx sdk.Context, cctx types.CrossChainTx) { if err != nil { ctx.Logger().Error("Error emitting ZetaWithdrawCreated :", err) } - } func EmitOutboundSuccess(ctx sdk.Context, valueReceived string, oldStatus string, newStatus string, cctxIndex string) { @@ -70,7 +69,6 @@ func EmitOutboundSuccess(ctx sdk.Context, valueReceived string, oldStatus string if err != nil { ctx.Logger().Error("Error emitting MsgVoteOutbound :", err) } - } func EmitOutboundFailure(ctx sdk.Context, valueReceived string, oldStatus string, newStatus string, cctxIndex string) { diff --git a/x/crosschain/keeper/msg_server_refund_aborted_tx.go b/x/crosschain/keeper/msg_server_refund_aborted_tx.go index 1efd3227ec..201b507af6 100644 --- a/x/crosschain/keeper/msg_server_refund_aborted_tx.go +++ b/x/crosschain/keeper/msg_server_refund_aborted_tx.go @@ -22,7 +22,6 @@ func (k msgServer) RefundAbortedCCTX( goCtx context.Context, msg *types.MsgRefundAbortedCCTX, ) (*types.MsgRefundAbortedCCTXResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) // check if authorized @@ -99,5 +98,4 @@ func GetRefundAddress(refundAddress string) (ethcommon.Address, error) { return ethcommon.Address{}, errorsmod.Wrap(types.ErrInvalidAddress, "invalid refund address") } return ethRefundAddress, nil - } diff --git a/x/crosschain/keeper/msg_server_update_tss.go b/x/crosschain/keeper/msg_server_update_tss.go index 672d64e462..56052b6671 100644 --- a/x/crosschain/keeper/msg_server_update_tss.go +++ b/x/crosschain/keeper/msg_server_update_tss.go @@ -60,7 +60,6 @@ func (k msgServer) UpdateTssAddress( migratorTx.CctxStatus.Status.String(), ) } - } k.GetObserverKeeper().SetTssAndUpdateNonce(ctx, tss) diff --git a/x/crosschain/migrations/v2/migrate.go b/x/crosschain/migrations/v2/migrate.go index 67f6ae709e..4fad2501bb 100644 --- a/x/crosschain/migrations/v2/migrate.go +++ b/x/crosschain/migrations/v2/migrate.go @@ -19,7 +19,6 @@ func MigrateStore( crossChainStoreKey storetypes.StoreKey, cdc codec.BinaryCodec, ) error { - // Using New Types from observer module as the structure is the same var nodeAccounts []observerTypes.NodeAccount var crosschainFlags observerTypes.CrosschainFlags diff --git a/x/crosschain/migrations/v3/migrate.go b/x/crosschain/migrations/v3/migrate.go index cbe11eef98..a6ec4f293b 100644 --- a/x/crosschain/migrations/v3/migrate.go +++ b/x/crosschain/migrations/v3/migrate.go @@ -19,7 +19,6 @@ func MigrateStore( crossChainStoreKey storetypes.StoreKey, cdc codec.BinaryCodec, ) error { - // Fetch existing TSS existingTss := observertypes.TSS{} store := prefix.NewStore(ctx.KVStore(crossChainStoreKey), types.KeyPrefix(observertypes.TSSKey)) diff --git a/x/crosschain/migrations/v4/migrate.go b/x/crosschain/migrations/v4/migrate.go index 0be2ca2f08..367e9c54eb 100644 --- a/x/crosschain/migrations/v4/migrate.go +++ b/x/crosschain/migrations/v4/migrate.go @@ -130,7 +130,6 @@ func MoveNonceToObserverModule( for _, n := range nonceToCcTx { observerKeeper.SetNonceToCctx(ctx, n) } - } func MoveTssToObserverModule(ctx sdk.Context, diff --git a/x/crosschain/migrations/v5/migrate.go b/x/crosschain/migrations/v5/migrate.go index 58d33629da..fcb42dc4d0 100644 --- a/x/crosschain/migrations/v5/migrate.go +++ b/x/crosschain/migrations/v5/migrate.go @@ -94,7 +94,6 @@ func SetZetaAccounting( abortedAmountZeta := sdkmath.ZeroUint() for _, cctx := range ccctxList { if cctx.CctxStatus.Status == types.CctxStatus_Aborted { - switch cctx.InboundParams.CoinType { case coin.CoinType_ERC20: { @@ -124,7 +123,6 @@ func SetZetaAccounting( abortedValue := GetAbortedAmount(cctx) abortedAmountZeta = abortedAmountZeta.Add(abortedValue) cctx.CctxStatus.IsAbortRefunded = false - } case coin.CoinType_Gas: { @@ -134,7 +132,6 @@ func SetZetaAccounting( } crosschainKeeper.SetCrossChainTx(ctx, cctx) } - } crosschainKeeper.SetZetaAccounting(ctx, types.ZetaAccounting{AbortedZetaAmount: abortedAmountZeta}) diff --git a/x/crosschain/module.go b/x/crosschain/module.go index 01bb84fc82..59f6bdfb11 100644 --- a/x/crosschain/module.go +++ b/x/crosschain/module.go @@ -136,7 +136,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 4, m.Migrate4to5); err != nil { panic(err) } - } // RegisterInvariants registers the crosschain module's invariants. diff --git a/x/crosschain/types/status.go b/x/crosschain/types/status.go index ded81edeec..320209ae78 100644 --- a/x/crosschain/types/status.go +++ b/x/crosschain/types/status.go @@ -31,7 +31,6 @@ func (m *Status) ChangeStatus(newStatus CctxStatus, msg string) { return } m.Status = newStatus - } //nolint:typecheck func (m *Status) ValidateTransition(newStatus CctxStatus) bool { diff --git a/x/emissions/client/cli/query_get_emmisons_factors.go b/x/emissions/client/cli/query_get_emmisons_factors.go index c98ec7c6af..ef19623975 100644 --- a/x/emissions/client/cli/query_get_emmisons_factors.go +++ b/x/emissions/client/cli/query_get_emmisons_factors.go @@ -14,7 +14,6 @@ func CmdGetEmmisonsFactors() *cobra.Command { Short: "Query GetEmmisonsFactors", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/emissions/client/cli/query_list_balances.go b/x/emissions/client/cli/query_list_balances.go index 3e40965d87..d16b0191dc 100644 --- a/x/emissions/client/cli/query_list_balances.go +++ b/x/emissions/client/cli/query_list_balances.go @@ -14,7 +14,6 @@ func CmdListPoolAddresses() *cobra.Command { Short: "Query list-pool-addresses", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/fungible/client/cli/tx_update_contract_bytecode.go b/x/fungible/client/cli/tx_update_contract_bytecode.go index 334cd12a68..2b2077792c 100644 --- a/x/fungible/client/cli/tx_update_contract_bytecode.go +++ b/x/fungible/client/cli/tx_update_contract_bytecode.go @@ -15,7 +15,6 @@ func CmdUpdateContractBytecode() *cobra.Command { Short: "Broadcast message UpdateContractBytecode", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/fungible/genesis.go b/x/fungible/genesis.go index ba8a3d0153..be5d6f7555 100644 --- a/x/fungible/genesis.go +++ b/x/fungible/genesis.go @@ -18,7 +18,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) if genState.SystemContract != nil { k.SetSystemContract(ctx, *genState.SystemContract) } - } // ExportGenesis returns the fungible module's exported genesis. diff --git a/x/lightclient/client/cli/tx_disable_verification_flags.go b/x/lightclient/client/cli/tx_disable_verification_flags.go index 4d86dee552..41ba1203a6 100644 --- a/x/lightclient/client/cli/tx_disable_verification_flags.go +++ b/x/lightclient/client/cli/tx_disable_verification_flags.go @@ -24,7 +24,6 @@ func CmdDisableVerificationFlags() *cobra.Command { `, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/lightclient/client/cli/tx_enable_verification_flags.go b/x/lightclient/client/cli/tx_enable_verification_flags.go index cf896fd2be..d8866c7400 100644 --- a/x/lightclient/client/cli/tx_enable_verification_flags.go +++ b/x/lightclient/client/cli/tx_enable_verification_flags.go @@ -24,7 +24,6 @@ func CmdEnableVerificationFlags() *cobra.Command { `, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/lightclient/keeper/grpc_query_header_enabled_chains.go b/x/lightclient/keeper/grpc_query_header_enabled_chains.go index 8a9700cc03..7408923ad8 100644 --- a/x/lightclient/keeper/grpc_query_header_enabled_chains.go +++ b/x/lightclient/keeper/grpc_query_header_enabled_chains.go @@ -51,5 +51,4 @@ func (k Keeper) HeaderEnabledChains( } return &types.QueryHeaderEnabledChainsResponse{HeaderEnabledChains: val.GetHeaderEnabledChains()}, nil - } diff --git a/x/lightclient/types/message_disable_verification_flags.go b/x/lightclient/types/message_disable_verification_flags.go index e051a7d4b7..5ee2964aa7 100644 --- a/x/lightclient/types/message_disable_verification_flags.go +++ b/x/lightclient/types/message_disable_verification_flags.go @@ -19,7 +19,6 @@ func NewMsgDisableHeaderVerification(creator string, chainIDs []int64) *MsgDisab Creator: creator, ChainIdList: chainIDs, } - } func (msg *MsgDisableHeaderVerification) Route() string { diff --git a/x/observer/client/cli/query_blame.go b/x/observer/client/cli/query_blame.go index ded997d35c..9d173f0a00 100644 --- a/x/observer/client/cli/query_blame.go +++ b/x/observer/client/cli/query_blame.go @@ -49,7 +49,6 @@ func CmdGetAllBlameRecords() *cobra.Command { Short: "Query AllBlameRecords", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/query_chain_params.go b/x/observer/client/cli/query_chain_params.go index b4126b5c76..3652dbf411 100644 --- a/x/observer/client/cli/query_chain_params.go +++ b/x/observer/client/cli/query_chain_params.go @@ -48,7 +48,6 @@ func CmdGetChainParams() *cobra.Command { Short: "Query GetChainParams", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/query_get_tss_address.go b/x/observer/client/cli/query_get_tss_address.go index f663ca43df..8e9b92d8bb 100644 --- a/x/observer/client/cli/query_get_tss_address.go +++ b/x/observer/client/cli/query_get_tss_address.go @@ -16,7 +16,6 @@ func CmdGetTssAddress() *cobra.Command { Short: "Query current tss address", Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err @@ -51,7 +50,6 @@ func CmdGetTssAddressByFinalizedZetaHeight() *cobra.Command { Short: "Query tss address by finalized zeta height (for historical tss addresses)", Args: cobra.MaximumNArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/query_observers.go b/x/observer/client/cli/query_observers.go index 6bdc34616c..721a0b12a6 100644 --- a/x/observer/client/cli/query_observers.go +++ b/x/observer/client/cli/query_observers.go @@ -14,7 +14,6 @@ func CmdObserverSet() *cobra.Command { Short: "Query observer set", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/query_show_observer_count.go b/x/observer/client/cli/query_show_observer_count.go index 43c7feb7a6..0f5f6039b0 100644 --- a/x/observer/client/cli/query_show_observer_count.go +++ b/x/observer/client/cli/query_show_observer_count.go @@ -14,7 +14,6 @@ func CmdShowObserverCount() *cobra.Command { Short: "Query show-observer-count", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/tx_add_observer.go b/x/observer/client/cli/tx_add_observer.go index 3c18fbcca5..b55606c1d1 100644 --- a/x/observer/client/cli/tx_add_observer.go +++ b/x/observer/client/cli/tx_add_observer.go @@ -18,7 +18,6 @@ func CmdAddObserver() *cobra.Command { Short: "Broadcast message add-observer", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/tx_disable_cctx_flags.go b/x/observer/client/cli/tx_disable_cctx_flags.go index 53cdf923bf..be88aada31 100644 --- a/x/observer/client/cli/tx_disable_cctx_flags.go +++ b/x/observer/client/cli/tx_disable_cctx_flags.go @@ -17,7 +17,6 @@ func CmdDisableCCTX() *cobra.Command { Short: "Disable inbound and outbound for CCTX", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/tx_enable_cctx_flags.go b/x/observer/client/cli/tx_enable_cctx_flags.go index c21016e258..d4371118bd 100644 --- a/x/observer/client/cli/tx_enable_cctx_flags.go +++ b/x/observer/client/cli/tx_enable_cctx_flags.go @@ -17,7 +17,6 @@ func CmdEnableCCTX() *cobra.Command { Short: "Enable inbound and outbound for CCTX", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/tx_update_chain_params.go b/x/observer/client/cli/tx_update_chain_params.go index 81e5cac7a1..d677801c6a 100644 --- a/x/observer/client/cli/tx_update_chain_params.go +++ b/x/observer/client/cli/tx_update_chain_params.go @@ -19,7 +19,6 @@ func CmdUpdateChainParams() *cobra.Command { Short: "Broadcast message updateChainParams", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { - argChainParams := args[0] clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/observer/client/cli/tx_update_gas_price_increase_flags.go b/x/observer/client/cli/tx_update_gas_price_increase_flags.go index e2cc0a5685..5569104bcf 100644 --- a/x/observer/client/cli/tx_update_gas_price_increase_flags.go +++ b/x/observer/client/cli/tx_update_gas_price_increase_flags.go @@ -18,7 +18,6 @@ func CmdUpdateGasPriceIncreaseFlags() *cobra.Command { Short: "Update the gas price increase flags", Args: cobra.ExactArgs(5), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/tx_update_observer.go b/x/observer/client/cli/tx_update_observer.go index abc8c72e51..c04cfa2664 100644 --- a/x/observer/client/cli/tx_update_observer.go +++ b/x/observer/client/cli/tx_update_observer.go @@ -19,7 +19,6 @@ func CmdUpdateObserver() *cobra.Command { Short: "Broadcast message add-observer", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/observer/client/cli/tx_vote_tss.go b/x/observer/client/cli/tx_vote_tss.go index 088ec36fcf..ce6591c749 100644 --- a/x/observer/client/cli/tx_vote_tss.go +++ b/x/observer/client/cli/tx_vote_tss.go @@ -19,7 +19,6 @@ func CmdVoteTSS() *cobra.Command { Short: "Vote for a new TSS creation", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { - argsPubkey, err := cast.ToStringE(args[0]) if err != nil { return err diff --git a/x/observer/client/querytests/suite.go b/x/observer/client/querytests/suite.go index 8fc7063676..c0a0710c5b 100644 --- a/x/observer/client/querytests/suite.go +++ b/x/observer/client/querytests/suite.go @@ -51,7 +51,6 @@ func (s *CliTestSuite) SetupSuite() { s.network = net _, err = s.network.WaitForHeight(1) s.Require().NoError(err) - } func (s *CliTestSuite) TearDownSuite() { diff --git a/x/observer/genesis.go b/x/observer/genesis.go index 9a8a3bcee1..d39a771535 100644 --- a/x/observer/genesis.go +++ b/x/observer/genesis.go @@ -130,7 +130,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.NonceToCctx { k.SetNonceToCctx(ctx, elem) } - } // ExportGenesis returns the observer module's exported genesis. diff --git a/x/observer/keeper/grpc_query_observer.go b/x/observer/keeper/grpc_query_observer.go index 181ba163f8..5ae55ab30a 100644 --- a/x/observer/keeper/grpc_query_observer.go +++ b/x/observer/keeper/grpc_query_observer.go @@ -46,5 +46,4 @@ func (k Keeper) ObserverSet( return &types.QueryObserverSetResponse{ Observers: observerSet.ObserverList, }, nil - } diff --git a/x/observer/keeper/hooks.go b/x/observer/keeper/hooks.go index 7e11cae282..afe6b9eb91 100644 --- a/x/observer/keeper/hooks.go +++ b/x/observer/keeper/hooks.go @@ -37,7 +37,6 @@ func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, } func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error { - err := h.k.CleanSlashedValidator(ctx, valAddr, fraction) if err != nil { return err diff --git a/x/observer/keeper/keeper.go b/x/observer/keeper/keeper.go index 1019fc1002..1b26fd3af3 100644 --- a/x/observer/keeper/keeper.go +++ b/x/observer/keeper/keeper.go @@ -48,7 +48,6 @@ func NewKeeper( lightclientKeeper: lightclientKeeper, authority: authority, } - } func (k Keeper) GetSlashingKeeper() types.SlashingKeeper { diff --git a/x/observer/keeper/msg_server_vote_tss.go b/x/observer/keeper/msg_server_vote_tss.go index 065bfe68f2..ae40c41444 100644 --- a/x/observer/keeper/msg_server_vote_tss.go +++ b/x/observer/keeper/msg_server_vote_tss.go @@ -51,7 +51,6 @@ func (k msgServer) VoteTSS(goCtx context.Context, msg *types.MsgVoteTSS) (*types index := msg.Digest() ballot, found := k.GetBallot(ctx, index) if !found { - // if ballot does not exist, create a new ballot var voterList []string diff --git a/x/observer/keeper/nonce_to_cctx.go b/x/observer/keeper/nonce_to_cctx.go index 057f4b1b4b..8042a6df28 100644 --- a/x/observer/keeper/nonce_to_cctx.go +++ b/x/observer/keeper/nonce_to_cctx.go @@ -51,9 +51,7 @@ func (k Keeper) GetAllNonceToCctx(ctx sdk.Context) (list []types.NonceToCctx) { if err == nil { list = append(list, val) } - } return - } diff --git a/x/observer/keeper/observer_set.go b/x/observer/keeper/observer_set.go index deeae5395b..c8a22e0e0f 100644 --- a/x/observer/keeper/observer_set.go +++ b/x/observer/keeper/observer_set.go @@ -34,7 +34,6 @@ func (k Keeper) IsAddressPartOfObserverSet(ctx sdk.Context, address string) bool } } return false - } func (k Keeper) AddObserverToSet(ctx sdk.Context, address string) { diff --git a/x/observer/keeper/tss.go b/x/observer/keeper/tss.go index 55915d55d2..1d885a68cf 100644 --- a/x/observer/keeper/tss.go +++ b/x/observer/keeper/tss.go @@ -45,7 +45,6 @@ func (k Keeper) GetHistoricalTssByFinalizedHeight(ctx sdk.Context, finalizedZeta return types.TSS{}, false } return tss, true - } // GetTSS returns the current tss information diff --git a/x/observer/types/ballot.go b/x/observer/types/ballot.go index 2ddab67ec6..6c04963cf9 100644 --- a/x/observer/types/ballot.go +++ b/x/observer/types/ballot.go @@ -62,7 +62,6 @@ func (m Ballot) IsFinalizingVote() (Ballot, bool) { if vote == VoteType_FailureObservation { failure = failure.Add(sdk.OneDec()) } - } if failure.IsPositive() { if failure.Quo(total).GTE(m.BallotThreshold) { diff --git a/x/observer/types/keys.go b/x/observer/types/keys.go index eb05d34142..40b088686c 100644 --- a/x/observer/types/keys.go +++ b/x/observer/types/keys.go @@ -34,7 +34,6 @@ func GetMinObserverDelegation() (sdkmath.Int, bool) { func GetMinObserverDelegationDec() (sdk.Dec, error) { return sdk.NewDecFromStr(MinObserverDelegation) - } func KeyPrefix(p string) []byte { diff --git a/zetaclient/chains/bitcoin/observer/outbound.go b/zetaclient/chains/bitcoin/observer/outbound.go index a17d46883f..47d026c11a 100644 --- a/zetaclient/chains/bitcoin/observer/outbound.go +++ b/zetaclient/chains/bitcoin/observer/outbound.go @@ -328,7 +328,6 @@ func (ob *Observer) refreshPendingNonce() { } func (ob *Observer) getOutboundIDByNonce(nonce uint64, test bool) (string, error) { - // There are 2 types of txids an observer can trust // 1. The ones had been verified and saved by observer self. // 2. The ones had been finalized in zetacore based on majority vote. diff --git a/zetaclient/chains/evm/observer/observer.go b/zetaclient/chains/evm/observer/observer.go index 99db258f5a..0b3c02113c 100644 --- a/zetaclient/chains/evm/observer/observer.go +++ b/zetaclient/chains/evm/observer/observer.go @@ -481,7 +481,6 @@ func (ob *Observer) WatchGasPrice() { } func (ob *Observer) PostGasPrice() error { - // GAS PRICE gasPrice, err := ob.evmClient.SuggestGasPrice(context.TODO()) if err != nil { diff --git a/zetaclient/chains/evm/signer/outbound_data.go b/zetaclient/chains/evm/signer/outbound_data.go index d12ecb118c..070c73597e 100644 --- a/zetaclient/chains/evm/signer/outbound_data.go +++ b/zetaclient/chains/evm/signer/outbound_data.go @@ -71,7 +71,6 @@ func (txData *OutboundData) SetupGas( client interfaces.EVMRPCClient, chain *chains.Chain, ) error { - txData.gasLimit = cctx.GetCurrentOutboundParam().GasLimit if txData.gasLimit < MinGasLimit { txData.gasLimit = MinGasLimit diff --git a/zetaclient/supplychecker/zeta_supply_checker.go b/zetaclient/supplychecker/zeta_supply_checker.go index f975c7eb88..3984b740ab 100644 --- a/zetaclient/supplychecker/zeta_supply_checker.go +++ b/zetaclient/supplychecker/zeta_supply_checker.go @@ -113,7 +113,6 @@ func (zs *ZetaSupplyChecker) Stop() { } func (zs *ZetaSupplyChecker) CheckZetaTokenSupply() error { - externalChainTotalSupply := sdkmath.ZeroInt() for _, chain := range zs.externalEvmChain { externalEvmChainParams, ok := zs.coreContext.GetEVMChainParams(chain.ChainId) diff --git a/zetaclient/zetacore/client.go b/zetaclient/zetacore/client.go index d64fd56db1..3b85296fe1 100644 --- a/zetaclient/zetacore/client.go +++ b/zetaclient/zetacore/client.go @@ -57,7 +57,6 @@ func NewClient( hsmMode bool, telemetry *metrics.TelemetryServer, ) (*Client, error) { - // main module logger logger := log.With().Str("module", "ZetacoreClient").Logger() cfg := config.ClientConfiguration{