Skip to content

Commit

Permalink
Merge branch 'develop' into format/proto
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Aug 2, 2023
2 parents 0619046 + c3051bb commit 54e0595
Show file tree
Hide file tree
Showing 38 changed files with 207 additions and 352 deletions.
2 changes: 0 additions & 2 deletions x/crosschain/client/cli/cli_cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

var _ = strconv.Itoa(0)

func CmdListSend() *cobra.Command {
cmd := &cobra.Command{
Use: "list-cctx",
Expand Down
6 changes: 1 addition & 5 deletions x/crosschain/client/cli/cli_out_tx_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ package cli_test

import (
"fmt"
"github.com/zeta-chain/zetacore/app"
"strconv"
"testing"

"github.com/stretchr/testify/require"
"github.com/zeta-chain/zetacore/app"
"github.com/zeta-chain/zetacore/testutil/network"
"github.com/zeta-chain/zetacore/testutil/nullify"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

// Prevent strconv unused error
var _ = strconv.IntSize

func networkWithOutTxTrackerObjects(t *testing.T, n int) (*network.Network, []types.OutTxTracker) {
t.Helper()
cfg := network.DefaultConfig()
Expand Down
6 changes: 1 addition & 5 deletions x/crosschain/client/cli/cli_zeta_height.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package cli

import (
"github.com/spf13/cobra"
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

var _ = strconv.Itoa(0)

func CmdLastZetaHeight() *cobra.Command {
cmd := &cobra.Command{
Use: "last-zeta-height",
Expand Down
34 changes: 18 additions & 16 deletions x/crosschain/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,24 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(CmdListOutTxTracker())
cmd.AddCommand(CmdShowOutTxTracker())
cmd.AddCommand(cli.CmdShowKeygen())
cmd.AddCommand(CmdShowTSS())
cmd.AddCommand(CmdListGasPrice())
cmd.AddCommand(CmdShowGasPrice())
cmd.AddCommand(CmdListChainNonces())
cmd.AddCommand(CmdShowChainNonces())
cmd.AddCommand(CmdListSend())
cmd.AddCommand(CmdShowSend())
cmd.AddCommand(CmdLastZetaHeight())
cmd.AddCommand(CmdListInTxHashToCctx())
cmd.AddCommand(CmdShowInTxHashToCctx())
cmd.AddCommand(CmdQueryParams())
cmd.AddCommand(cli.CmdShowPermissionFlags())
cmd.AddCommand(CmdGetTssAddress())
cmd.AddCommand(
CmdListOutTxTracker(),
CmdShowOutTxTracker(),
cli.CmdShowKeygen(),
CmdShowTSS(),
CmdListGasPrice(),
CmdShowGasPrice(),
CmdListChainNonces(),
CmdShowChainNonces(),
CmdListSend(),
CmdShowSend(),
CmdLastZetaHeight(),
CmdListInTxHashToCctx(),
CmdShowInTxHashToCctx(),
CmdQueryParams(),
cli.CmdShowPermissionFlags(),
CmdGetTssAddress(),
)

// this line is used by starport scaffolding # 1

Expand Down
4 changes: 0 additions & 4 deletions x/crosschain/client/cli/query_get_tss_address.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

var _ = strconv.Itoa(0)

func CmdGetTssAddress() *cobra.Command {
cmd := &cobra.Command{
Use: "get-tss-address",
Expand Down
32 changes: 12 additions & 20 deletions x/crosschain/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@ package cli

import (
"fmt"
"github.com/zeta-chain/zetacore/x/observer/client/cli"
"time"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/zeta-chain/zetacore/x/observer/client/cli"
// "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

var (
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)

const (
// flagPacketTimeoutTimestamp = "packet-timeout-timestamp"
)

// GetTxCmd returns the transaction commands for this module
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Expand All @@ -30,15 +20,17 @@ func GetTxCmd() *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(CmdAddToWatchList())
cmd.AddCommand(CmdCreateTSSVoter())
cmd.AddCommand(CmdGasPriceVoter())
cmd.AddCommand(CmdNonceVoter())
cmd.AddCommand(CmdCCTXOutboundVoter())
cmd.AddCommand(CmdCCTXInboundVoter())
cmd.AddCommand(CmdRemoveFromWatchList())
cmd.AddCommand(cli.CmdUpdatePermissionFlags())
cmd.AddCommand(cli.CmdUpdateKeygen())
cmd.AddCommand(
CmdAddToWatchList(),
CmdCreateTSSVoter(),
CmdGasPriceVoter(),
CmdNonceVoter(),
CmdCCTXOutboundVoter(),
CmdCCTXInboundVoter(),
CmdRemoveFromWatchList(),
cli.CmdUpdatePermissionFlags(),
cli.CmdUpdateKeygen(),
)
// this line is used by starport scaffolding # 1

return cmd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg
cctx := k.CreateNewCCTX(ctx, msg, index, types.CctxStatus_PendingInbound, observationChain, receiverChain)
defer func() {
EmitEventInboundFinalized(ctx, &cctx)
cctx.InboundTxParams.InboundTxFinalizedZetaHeight = uint64(ctx.BlockHeight())
k.SetCctxAndNonceToCctxAndInTxHashToCctx(ctx, cctx)
}()
// FinalizeInbound updates CCTX Prices and Nonce
Expand Down Expand Up @@ -134,7 +135,6 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg
} else { // Cross Chain SWAP
tmpCtx, commit := ctx.CacheContext()
err = func() error {
cctx.InboundTxParams.InboundTxFinalizedZetaHeight = uint64(ctx.BlockHeader().Height)
err := k.PayGasInZetaAndUpdateCctx(tmpCtx, receiverChain.ChainId, &cctx)
if err != nil {
return err
Expand Down
14 changes: 0 additions & 14 deletions x/crosschain/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@ package crosschain
import (
"math/rand"

"github.com/cosmos/cosmos-sdk/baseapp"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/zeta-chain/zetacore/testutil/sample"
crosschainsimulation "github.com/zeta-chain/zetacore/x/crosschain/simulation"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

// avoid unused import issue
var (
_ = sample.AccAddress
_ = crosschainsimulation.FindAccount
_ = simappparams.StakePerAccount
_ = simulation.MsgEntryKind
_ = baseapp.Paramspace
)

const (
// this line is used by starport scaffolding # simapp/module/const
)
Expand Down
15 changes: 0 additions & 15 deletions x/crosschain/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,12 @@ func RegisterCodec(cdc *codec.LegacyAmino) {
func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgAddToOutTxTracker{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgRemoveFromOutTxTracker{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgCreateTSSVoter{},
)

registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgGasPriceVoter{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgNonceVoter{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgVoteOnObservedOutboundTx{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgVoteOnObservedInboundTx{},
)
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgSetNodeKeys{},
)

Expand Down
4 changes: 0 additions & 4 deletions x/crosschain/types/key_in_tx_hash_to_cctx.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package types

import "encoding/binary"

var _ binary.ByteOrder

const (
// InTxHashToCctxKeyPrefix is the prefix to retrieve all InTxHashToCctx
InTxHashToCctxKeyPrefix = "InTxHashToCctx/value/"
Expand Down
6 changes: 4 additions & 2 deletions x/emissions/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(CmdQueryParams())
cmd.AddCommand(CmdListPoolAddresses())
cmd.AddCommand(
CmdQueryParams(),
CmdListPoolAddresses(),
)

// this line is used by starport scaffolding # 1

Expand Down
4 changes: 0 additions & 4 deletions x/emissions/client/cli/query_list_balances.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/emissions/types"
)

var _ = strconv.Itoa(0)

func CmdListPoolAddresses() *cobra.Command {
cmd := &cobra.Command{
Use: "list-pool-addresses",
Expand Down
8 changes: 5 additions & 3 deletions x/fungible/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(CmdQueryParams())
cmd.AddCommand(CmdListForeignCoins())
cmd.AddCommand(CmdShowForeignCoins())
cmd.AddCommand(
CmdQueryParams(),
CmdListForeignCoins(),
CmdShowForeignCoins(),
)
// this line is used by starport scaffolding # 1

return cmd
Expand Down
14 changes: 5 additions & 9 deletions x/fungible/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ package cli

import (
"fmt"
"time"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"
// "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/zeta-chain/zetacore/x/fungible/types"
)

var (
DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds())
)

// GetTxCmd returns the transaction commands for this module
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Expand All @@ -25,8 +19,10 @@ func GetTxCmd() *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(CmdDeployFungibleCoinZRC4())
cmd.AddCommand(CmdRemoveForeignCoin())
cmd.AddCommand(
CmdDeployFungibleCoinZRC4(),
CmdRemoveForeignCoin(),
)
// this line is used by starport scaffolding # 1

return cmd
Expand Down
2 changes: 0 additions & 2 deletions x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
"github.com/zeta-chain/zetacore/x/fungible/types"
)

var _ = strconv.Itoa(0)

func CmdDeployFungibleCoinZRC4() *cobra.Command {
cmd := &cobra.Command{
Use: "deploy-fungible-coin-zrc-4 [erc-20] [foreign-chain] [decimals] [name] [symbol] [coin-type] [gas-limit]",
Expand Down
4 changes: 0 additions & 4 deletions x/fungible/client/cli/tx_remove_foreign_coin.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package cli

import (
"strconv"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/fungible/types"
)

var _ = strconv.Itoa(0)

func CmdRemoveForeignCoin() *cobra.Command {
cmd := &cobra.Command{
Use: "remove-foreign-coin [name]",
Expand Down
14 changes: 0 additions & 14 deletions x/fungible/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@ package fungible
import (
"math/rand"

"github.com/cosmos/cosmos-sdk/baseapp"
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"
"github.com/zeta-chain/zetacore/testutil/sample"
fungiblesimulation "github.com/zeta-chain/zetacore/x/fungible/simulation"
"github.com/zeta-chain/zetacore/x/fungible/types"
)

// avoid unused import issue
var (
_ = sample.AccAddress
_ = fungiblesimulation.FindAccount
_ = simappparams.StakePerAccount
_ = simulation.MsgEntryKind
_ = baseapp.Paramspace
)

const (
// this line is used by starport scaffolding # simapp/module/const
)
Expand Down
5 changes: 1 addition & 4 deletions x/fungible/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ func RegisterCodec(cdc *codec.LegacyAmino) {
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {

registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgDeployFungibleCoinZRC20{},
)

registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgRemoveForeignCoin{},
)

// this line is used by starport scaffolding # 3

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
Expand Down
4 changes: 0 additions & 4 deletions x/fungible/types/key_foreign_coins.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package types

import "encoding/binary"

var _ binary.ByteOrder

const (
// ForeignCoinsKeyPrefix is the prefix to retrieve all ForeignCoins
ForeignCoinsKeyPrefix = "ForeignCoins/value/"
Expand Down
Loading

0 comments on commit 54e0595

Please sign in to comment.