Skip to content

Commit

Permalink
Apply code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
swift1337 committed Jun 24, 2024
1 parent af8531a commit ecaa635
Show file tree
Hide file tree
Showing 76 changed files with 2 additions and 88 deletions.
1 change: 0 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ func New(
appOpts servertypes.AppOptions,
baseAppOptions ...func(*baseapp.BaseApp),
) *App {

appCodec := encodingConfig.Codec
cdc := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry
Expand Down
1 change: 0 additions & 1 deletion app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()})

Expand Down
1 change: 0 additions & 1 deletion cmd/zetaclientd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ func DebugCmd() *cobra.Command {
if err != nil {
return err
}

}
fmt.Println("BallotIdentifier : ", ballotIdentifier)

Expand Down
2 changes: 1 addition & 1 deletion cmd/zetaclientd/gen_pre_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var GenPrePramsCmd = &cobra.Command{
Use: "gen-pre-params <path>",
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 {
Expand Down
1 change: 0 additions & 1 deletion cmd/zetaclientd/keygen_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion cmd/zetaclientd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ func SetupConfigForTest() {
})

rand.Seed(time.Now().UnixNano())

}
2 changes: 0 additions & 2 deletions cmd/zetaclientd/p2p_diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion cmd/zetaclientd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/zetacored/add_observer_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -403,7 +402,6 @@ func addStakingGrants(grants []authz.GrantAuthorization, info ObserverInfoReader
})

return grants

}

func AddGenesisAccount(
Expand Down
1 change: 0 additions & 1 deletion cmd/zetacored/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion cmd/zetacored/parse_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ func ImportDataIntoFile(
cdc codec.Codec,
modifyEnabled bool,
) error {

appState, err := genutiltypes.GenesisStateFromGenDoc(*genDoc)
if err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion cmd/zetatool/filterdeposit/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions contrib/rpctest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions e2e/e2etests/test_context_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) {
if eventIter.Event.ChainID.Cmp(chainID) != 0 {
panic("chainID mismatch")
}

}
if found {
break
Expand All @@ -82,5 +81,4 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) {
if !found {
panic("event not found")
}

}
2 changes: 0 additions & 2 deletions e2e/e2etests/test_eth_deposit_liquidity_cap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")
Expand Down
1 change: 0 additions & 1 deletion e2e/e2etests/test_rate_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion e2e/runner/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

}
1 change: 0 additions & 1 deletion e2e/runner/setup_zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion e2e/runner/zeta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down
1 change: 0 additions & 1 deletion e2e/txserver/zeta_tx_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/chains/address_taproot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
1 change: 0 additions & 1 deletion pkg/proofs/ethereum/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 0 additions & 1 deletion testutil/keeper/crosschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ func MockGetRevertGasLimitForERC20(
}, true).Once()
m.On("QueryGasLimit", mock.Anything, mock.Anything).
Return(big.NewInt(returnVal), nil).Once()

}

func MockPayGasAndUpdateCCTX(
Expand Down
1 change: 0 additions & 1 deletion testutil/network/genesis_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion testutil/sample/crosschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion testutil/sample/lightclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ func HeaderSupportedChains() []lightclienttypes.HeaderSupportedChain {

func BlockHeaderVerification() lightclienttypes.BlockHeaderVerification {
return lightclienttypes.BlockHeaderVerification{HeaderSupportedChains: HeaderSupportedChains()}

}

// Proof generates a proof and block header
Expand Down
1 change: 0 additions & 1 deletion x/authority/client/cli/tx_add_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ func GetPolicyType(policyTypeString string) (types.PolicyType, error) {
default:
return types.PolicyType_groupEmpty, fmt.Errorf("invalid policy type value: %d", policyType)
}

}
2 changes: 0 additions & 2 deletions x/crosschain/client/cli/cli_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/client/cli/cli_zeta_height.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/client/querytests/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func (s *CliTestSuite) SetupSuite() {
s.network = net
_, err = s.network.WaitForHeight(1)
s.Require().NoError(err)

}

func (s *CliTestSuite) TearDownSuite() {
Expand Down
2 changes: 0 additions & 2 deletions x/crosschain/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions x/crosschain/keeper/msg_server_refund_aborted_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (k msgServer) RefundAbortedCCTX(
goCtx context.Context,
msg *types.MsgRefundAbortedCCTX,
) (*types.MsgRefundAbortedCCTXResponse, error) {

ctx := sdk.UnwrapSDKContext(goCtx)

// check if authorized
Expand Down Expand Up @@ -99,5 +98,4 @@ func GetRefundAddress(refundAddress string) (ethcommon.Address, error) {
return ethcommon.Address{}, errorsmod.Wrap(types.ErrInvalidAddress, "invalid refund address")
}
return ethRefundAddress, nil

}
1 change: 0 additions & 1 deletion x/crosschain/keeper/msg_server_update_tss.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func (k msgServer) UpdateTssAddress(
migratorTx.CctxStatus.Status.String(),
)
}

}

k.GetObserverKeeper().SetTssAndUpdateNonce(ctx, tss)
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/migrations/v2/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/migrations/v3/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/migrations/v4/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ func MoveNonceToObserverModule(
for _, n := range nonceToCcTx {
observerKeeper.SetNonceToCctx(ctx, n)
}

}

func MoveTssToObserverModule(ctx sdk.Context,
Expand Down
3 changes: 0 additions & 3 deletions x/crosschain/migrations/v5/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
{
Expand Down Expand Up @@ -124,7 +123,6 @@ func SetZetaAccounting(
abortedValue := GetAbortedAmount(cctx)
abortedAmountZeta = abortedAmountZeta.Add(abortedValue)
cctx.CctxStatus.IsAbortRefunded = false

}
case coin.CoinType_Gas:
{
Expand All @@ -134,7 +132,6 @@ func SetZetaAccounting(
}
crosschainKeeper.SetCrossChainTx(ctx, cctx)
}

}
crosschainKeeper.SetZetaAccounting(ctx, types.ZetaAccounting{AbortedZetaAmount: abortedAmountZeta})

Expand Down
1 change: 0 additions & 1 deletion x/crosschain/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/types/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion x/emissions/client/cli/query_get_emmisons_factors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion x/emissions/client/cli/query_list_balances.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit ecaa635

Please sign in to comment.