Skip to content

Commit

Permalink
Merge branch 'develop' into fungible-evm-keeper-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Aug 5, 2023
2 parents d70fdd4 + b77c02f commit 38e9132
Show file tree
Hide file tree
Showing 53 changed files with 99 additions and 258 deletions.
6 changes: 1 addition & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
tmjson "github.com/tendermint/tendermint/libs/json"

// this line is used by starport scaffolding # stargate/app/moduleImport
zetaCoreModule "github.com/zeta-chain/zetacore/x/crosschain"
zetaCoreModuleTypes "github.com/zeta-chain/zetacore/x/crosschain/types"

Expand Down Expand Up @@ -151,8 +150,6 @@ var (
Bech32PrefixConsPub = AccountAddressPrefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals

func getGovProposalHandlers() []govclient.ProposalHandler {
var govProposalHandlers []govclient.ProposalHandler
govProposalHandlers = append(govProposalHandlers,
Expand Down Expand Up @@ -405,7 +402,7 @@ func New(
app.AccountKeeper,
app.BankKeeper,
app.ZetaObserverKeeper,
app.FungibleKeeper,
&app.FungibleKeeper,
)
app.GroupKeeper = groupkeeper.NewKeeper(keys[group.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper, group.Config{
MaxExecutionPeriod: 2 * time.Hour, // Two hours.
Expand Down Expand Up @@ -759,7 +756,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(evmtypes.ModuleName)
paramsKeeper.Subspace(feemarkettypes.ModuleName)
paramsKeeper.Subspace(group.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace
paramsKeeper.Subspace(zetaCoreModuleTypes.ModuleName)
paramsKeeper.Subspace(zetaObserverModuleTypes.ModuleName)
paramsKeeper.Subspace(fungibleModuleTypes.ModuleName)
Expand Down
2 changes: 0 additions & 2 deletions cmd/zetacored/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ func (ac appCreator) appExport(
homePath,
uint(1),
ac.encCfg,
// this line is used by starport scaffolding # stargate/root/exportArgument
appOpts,
)

Expand All @@ -299,7 +298,6 @@ func (ac appCreator) appExport(
homePath,
uint(1),
ac.encCfg,
// this line is used by starport scaffolding # stargate/root/noHeightExportArgument
appOpts,
)
}
Expand Down
3 changes: 0 additions & 3 deletions proto/crosschain/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "crosschain/last_block_height.proto";
import "crosschain/out_tx_tracker.proto";
import "crosschain/params.proto";
import "crosschain/tss.proto";
// this line is used by starport scaffolding # genesis/proto/import
import "gogoproto/gogo.proto";

option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types";
Expand All @@ -25,6 +24,4 @@ message GenesisState {

repeated LastBlockHeight lastBlockHeightList = 8;
repeated InTxHashToCctx inTxHashToCctxList = 9 [(gogoproto.nullable) = false];

// this line is used by starport scaffolding # genesis/proto/state
}
5 changes: 0 additions & 5 deletions proto/crosschain/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import "crosschain/nonce_to_cctx.proto";
import "crosschain/out_tx_tracker.proto";
import "crosschain/params.proto";
import "crosschain/tss.proto";
// this line is used by starport scaffolding # 1
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";

Expand Down Expand Up @@ -53,8 +52,6 @@ service Query {
option (google.api.http).get = "/zeta-chain/crosschain/get_tss_address";
}

// this line is used by starport scaffolding # 2

// Queries a tSS by index.
rpc TSS(QueryGetTSSRequest) returns (QueryGetTSSResponse) {
option (google.api.http).get = "/zeta-chain/crosschain/TSS";
Expand Down Expand Up @@ -183,8 +180,6 @@ message QueryGetTssAddressResponse {
string btc = 2;
}

// this line is used by starport scaffolding # 3

message QueryGetTSSRequest {}

message QueryGetTSSResponse {
Expand Down
3 changes: 0 additions & 3 deletions proto/crosschain/tx.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
syntax = "proto3";
package zetachain.zetacore.crosschain;

// this line is used by starport scaffolding # proto/tx/import
import "common/common.proto";
import "gogoproto/gogo.proto";

Expand All @@ -16,7 +15,6 @@ service Msg {
rpc NonceVoter(MsgNonceVoter) returns (MsgNonceVoterResponse);
rpc VoteOnObservedOutboundTx(MsgVoteOnObservedOutboundTx) returns (MsgVoteOnObservedOutboundTxResponse);
rpc VoteOnObservedInboundTx(MsgVoteOnObservedInboundTx) returns (MsgVoteOnObservedInboundTxResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

message MsgAddToOutTxTracker {
Expand All @@ -36,7 +34,6 @@ message MsgRemoveFromOutTxTracker {

message MsgRemoveFromOutTxTrackerResponse {}

// this line is used by starport scaffolding # proto/tx/message
message MsgCreateTSSVoter {
string creator = 1;
string tss_pubkey = 2;
Expand Down
2 changes: 0 additions & 2 deletions proto/emissions/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ package zetachain.zetacore.emissions;

import "emissions/params.proto";
import "gogoproto/gogo.proto";
// this line is used by starport scaffolding # genesis/proto/import

option go_package = "github.com/zeta-chain/zetacore/x/emissions/types";

// GenesisState defines the emissions module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
// this line is used by starport scaffolding # genesis/proto/state
}
5 changes: 0 additions & 5 deletions proto/emissions/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "cosmos/base/query/v1beta1/pagination.proto";
import "emissions/params.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
// this line is used by starport scaffolding # 1

option go_package = "github.com/zeta-chain/zetacore/x/emissions/types";

Expand All @@ -19,8 +18,6 @@ service Query {
rpc ListPoolAddresses(QueryListPoolAddressesRequest) returns (QueryListPoolAddressesResponse) {
option (google.api.http).get = "/zeta-chain/zetacore/emissions/list_addresses";
}

// this line is used by starport scaffolding # 2
}

// QueryParamsRequest is request type for the Query/Params RPC method.
Expand All @@ -39,5 +36,3 @@ message QueryListPoolAddressesResponse {
string undistributed_tss_balances_address = 2;
string emission_module_address = 3;
}

// this line is used by starport scaffolding # 3
5 changes: 0 additions & 5 deletions proto/emissions/tx.proto
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
syntax = "proto3";
package zetachain.zetacore.emissions;

// this line is used by starport scaffolding # proto/tx/import

import "gogoproto/gogo.proto";

option go_package = "github.com/zeta-chain/zetacore/x/emissions/types";

// Msg defines the Msg service.
service Msg {
// this line is used by starport scaffolding # proto/tx/rpc
}

// this line is used by starport scaffolding # proto/tx/message
2 changes: 0 additions & 2 deletions proto/fungible/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "fungible/foreign_coins.proto";
import "fungible/params.proto";
import "fungible/system_contract.proto";
import "gogoproto/gogo.proto";
// this line is used by starport scaffolding # genesis/proto/import

option go_package = "github.com/zeta-chain/zetacore/x/fungible/types";

Expand All @@ -14,5 +13,4 @@ message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
repeated ForeignCoins foreignCoinsList = 2 [(gogoproto.nullable) = false];
SystemContract systemContract = 3;
// this line is used by starport scaffolding # genesis/proto/state
}
3 changes: 0 additions & 3 deletions proto/fungible/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import "fungible/params.proto";
import "fungible/system_contract.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
// this line is used by starport scaffolding # 1

option go_package = "github.com/zeta-chain/zetacore/x/fungible/types";

Expand All @@ -31,7 +30,6 @@ service Query {
rpc SystemContract(QueryGetSystemContractRequest) returns (QueryGetSystemContractResponse) {
option (google.api.http).get = "/zeta-chain/zetacore/fungible/system_contract";
}
// this line is used by starport scaffolding # 2
}

// QueryParamsRequest is request type for the Query/Params RPC method.
Expand Down Expand Up @@ -65,4 +63,3 @@ message QueryGetSystemContractRequest {}
message QueryGetSystemContractResponse {
SystemContract SystemContract = 1 [(gogoproto.nullable) = false];
}
// this line is used by starport scaffolding # 3
5 changes: 0 additions & 5 deletions proto/fungible/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ package zetachain.zetacore.fungible;

import "common/common.proto";

// this line is used by starport scaffolding # proto/tx/import

option go_package = "github.com/zeta-chain/zetacore/x/fungible/types";

// Msg defines the Msg service.
service Msg {
rpc DeployFungibleCoinZRC20(MsgDeployFungibleCoinZRC20) returns (MsgDeployFungibleCoinZRC20Response);
rpc RemoveForeignCoin(MsgRemoveForeignCoin) returns (MsgRemoveForeignCoinResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

message MsgDeployFungibleCoinZRC20 {
Expand All @@ -33,5 +30,3 @@ message MsgRemoveForeignCoin {
}

message MsgRemoveForeignCoinResponse {}

// this line is used by starport scaffolding # proto/tx/message
5 changes: 0 additions & 5 deletions proto/observer/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package zetachain.zetacore.observer;

import "common/common.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
// this line is used by starport scaffolding # 1
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "observer/ballot.proto";
Expand Down Expand Up @@ -80,8 +79,6 @@ service Query {
rpc GetAllBlameRecords(QueryAllBlameRecordsRequest) returns (QueryAllBlameRecordsResponse) {
option (google.api.http).get = "/zeta-chain/observer/get_all_blame_records";
}

// this line is used by starport scaffolding # 2
}

message QueryParamsRequest {}
Expand Down Expand Up @@ -188,5 +185,3 @@ message QueryAllBlameRecordsRequest {}
message QueryAllBlameRecordsResponse {
repeated Blame blameInfo = 1;
}

// this line is used by starport scaffolding # 3
5 changes: 0 additions & 5 deletions proto/observer/tx.proto
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
syntax = "proto3";
package zetachain.zetacore.observer;

// this line is used by starport scaffolding # proto/tx/import

import "common/common.proto";
import "gogoproto/gogo.proto";
import "observer/blame.proto";
Expand All @@ -18,7 +16,6 @@ service Msg {
rpc AddBlameVote(MsgAddBlameVote) returns (MsgAddBlameVoteResponse);
rpc UpdatePermissionFlags(MsgUpdatePermissionFlags) returns (MsgUpdatePermissionFlagsResponse);
rpc UpdateKeygen(MsgUpdateKeygen) returns (MsgUpdateKeygenResponse);
// this line is used by starport scaffolding # proto/tx/rpc
}

message MsgUpdateCoreParams {
Expand Down Expand Up @@ -55,5 +52,3 @@ message MsgUpdateKeygen {
}

message MsgUpdateKeygenResponse {}

// this line is used by starport scaffolding # proto/tx/message
34 changes: 17 additions & 17 deletions testutil/keeper/zetacore.go → testutil/keeper/crosschain.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
package keeper

import (
authkeeper2 "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper2 "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/zeta-chain/zetacore/x/crosschain/keeper"
"testing"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmdb "github.com/tendermint/tm-db"
"github.com/zeta-chain/zetacore/x/crosschain/types"
fungibleKeeper "github.com/zeta-chain/zetacore/x/fungible/keeper"
zetaobserverKeeper "github.com/zeta-chain/zetacore/x/observer/keeper"

typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/zeta-chain/zetacore/x/crosschain/keeper"
"github.com/zeta-chain/zetacore/x/crosschain/types"
fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper"
observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper"
)

func ZetacoreKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
func CrosschainKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
storeKey := sdk.NewKVStoreKey(types.StoreKey)
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey)

Expand All @@ -36,28 +36,28 @@ func ZetacoreKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
registry := codectypes.NewInterfaceRegistry()
cdc := codec.NewProtoCodec(registry)

paramsSubspace := typesparams.NewSubspace(cdc,
paramsSubspace := paramstypes.NewSubspace(cdc,
types.Amino,
storeKey,
memStoreKey,
"ZetacoreParams",
)

bankkeeper := bankkeeper2.BaseKeeper{}
authkeeper := authkeeper2.AccountKeeper{}
zetaobserverKeeper := zetaobserverKeeper.Keeper{}
fungibleKeeper := fungibleKeeper.Keeper{}
bankKeeper := bankkeeper.BaseKeeper{}
authKeeper := authkeeper.AccountKeeper{}
observerKeeper := observerkeeper.Keeper{}
fungibleKeeper := fungiblekeeper.Keeper{}

k := keeper.NewKeeper(
codec.NewProtoCodec(registry),
storeKey,
memStoreKey,
stakingkeeper.Keeper{}, // custom
paramsSubspace,
authkeeper,
bankkeeper,
zetaobserverKeeper,
fungibleKeeper,
authKeeper,
bankKeeper,
observerKeeper,
&fungibleKeeper,
)

ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())
Expand Down
2 changes: 0 additions & 2 deletions x/crosschain/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,5 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
CmdGetTssAddress(),
)

// this line is used by starport scaffolding # 1

return cmd
}
1 change: 0 additions & 1 deletion x/crosschain/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func GetTxCmd() *cobra.Command {
cli.CmdUpdatePermissionFlags(),
cli.CmdUpdateKeygen(),
)
// this line is used by starport scaffolding # 1

return cmd
}
3 changes: 0 additions & 3 deletions x/crosschain/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
k.SetInTxHashToCctx(ctx, elem)
}

// this line is used by starport scaffolding # genesis/module/init

// Set all the gasPrice
for _, elem := range genState.GasPriceList {
k.SetGasPrice(ctx, *elem)
Expand Down Expand Up @@ -53,7 +51,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
genesis.OutTxTrackerList = k.GetAllOutTxTracker(ctx)
genesis.InTxHashToCctxList = k.GetAllInTxHashToCctx(ctx)

// this line is used by starport scaffolding # genesis/module/export
// Get all keygen

// Get all tSSVoter
Expand Down
Loading

0 comments on commit 38e9132

Please sign in to comment.