diff --git a/app/ante.go b/app/ante.go index e54ed2b..0432ffc 100644 --- a/app/ante.go +++ b/app/ante.go @@ -13,10 +13,10 @@ import ( ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" "github.com/cosmos/ibc-go/v7/modules/core/keeper" - feeshareante "github.com/terpnetwork/terp-core/x/feeshare/ante" - feesharekeeper "github.com/terpnetwork/terp-core/x/feeshare/keeper" - globalfeeante "github.com/terpnetwork/terp-core/x/globalfee/ante" - globalfeekeeper "github.com/terpnetwork/terp-core/x/globalfee/keeper" + feeshareante "github.com/terpnetwork/terp-core/v2/x/feeshare/ante" + feesharekeeper "github.com/terpnetwork/terp-core/v2/x/feeshare/keeper" + globalfeeante "github.com/terpnetwork/terp-core/v2/x/globalfee/ante" + globalfeekeeper "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" diff --git a/app/app.go b/app/app.go index e9e7d35..fe834ff 100644 --- a/app/app.go +++ b/app/app.go @@ -126,12 +126,12 @@ import ( ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ibcmock "github.com/cosmos/ibc-go/v7/testing/mock" - "github.com/terpnetwork/terp-core/x/feeshare" - feesharekeeper "github.com/terpnetwork/terp-core/x/feeshare/keeper" - feesharetypes "github.com/terpnetwork/terp-core/x/feeshare/types" - "github.com/terpnetwork/terp-core/x/globalfee" - globalfeekeeper "github.com/terpnetwork/terp-core/x/globalfee/keeper" - globalfeetypes "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare" + feesharekeeper "github.com/terpnetwork/terp-core/v2/x/feeshare/keeper" + feesharetypes "github.com/terpnetwork/terp-core/v2/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee" + globalfeekeeper "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" + globalfeetypes "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7" ibchookskeeper "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/keeper" @@ -145,22 +145,22 @@ import ( icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper" icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/bindings" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings" "github.com/spf13/cast" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - v2 "github.com/terpnetwork/terp-core/app/upgrades/v2" + v2 "github.com/terpnetwork/terp-core/v2/app/upgrades/v2" "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" // token factory - "github.com/terpnetwork/terp-core/x/tokenfactory" - tokenfactorykeeper "github.com/terpnetwork/terp-core/x/tokenfactory/keeper" - tokenfactorytypes "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory" + tokenfactorykeeper "github.com/terpnetwork/terp-core/v2/x/tokenfactory/keeper" + tokenfactorytypes "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" // statik for swagger UI support @@ -1372,6 +1372,16 @@ func (app *TerpApp) GetChainBondDenom() string { return d } +// ModuleAccountAddrs returns all the app's module account addresses. +func (app *TerpApp) ModuleAccountAddrs() map[string]bool { + modAccAddrs := make(map[string]bool) + for acc := range GetMaccPerms() { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } + + return modAccAddrs +} + // initParamsKeeper init params keeper and its subspaces func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) diff --git a/app/app_test.go b/app/app_test.go deleted file mode 100644 index 5a245cb..0000000 --- a/app/app_test.go +++ /dev/null @@ -1,85 +0,0 @@ -package app - -import ( - "os" - "testing" - - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/CosmWasm/wasmd/x/wasm" -) - -var emptyWasmOpts []wasm.Option - -func TestWasmdExport(t *testing.T) { - db := dbm.NewMemDB() - gapp := NewTerpAppWithCustomOptions(t, false, SetupOptions{ - Logger: log.NewTMLogger(log.NewSyncWriter(os.Stdout)), - DB: db, - AppOpts: simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), - }) - gapp.Commit() - - // Making a new app object with the db, so that initchain hasn't been called - newGapp := NewTerpApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, wasm.EnableAllProposals, simtestutil.NewAppOptionsWithFlagHome(t.TempDir()), emptyWasmOpts) - _, err := newGapp.ExportAppStateAndValidators(false, []string{}, nil) - require.NoError(t, err, "ExportAppStateAndValidators should not have an error") -} - -// ensure that blocked addresses are properly set in bank keeper -func TestBlockedAddrs(t *testing.T) { - gapp := Setup(t) - - for acc := range BlockedAddresses() { - t.Run(acc, func(t *testing.T) { - var addr sdk.AccAddress - if modAddr, err := sdk.AccAddressFromBech32(acc); err == nil { - addr = modAddr - } else { - addr = gapp.AccountKeeper.GetModuleAddress(acc) - } - require.True(t, gapp.BankKeeper.BlockedAddr(addr), "ensure that blocked addresses are properly set in bank keeper") - }) - } -} - -func TestGetMaccPerms(t *testing.T) { - dup := GetMaccPerms() - require.Equal(t, maccPerms, dup, "duplicated module account permissions differed from actual module account permissions") -} - -func TestGetEnabledProposals(t *testing.T) { - cases := map[string]struct { - proposalsEnabled string - specificEnabled string - expected []wasm.ProposalType - }{ - "all disabled": { - proposalsEnabled: "false", - expected: wasm.DisableAllProposals, - }, - "all enabled": { - proposalsEnabled: "true", - expected: wasm.EnableAllProposals, - }, - "some enabled": { - proposalsEnabled: "okay", - specificEnabled: "StoreCode,InstantiateContract", - expected: []wasm.ProposalType{wasm.ProposalTypeStoreCode, wasm.ProposalTypeInstantiateContract}, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - ProposalsEnabled = tc.proposalsEnabled - EnableSpecificProposals = tc.specificEnabled - proposals := GetEnabledProposals() - assert.Equal(t, tc.expected, proposals) - }) - } -} diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index 298ba00..e13e086 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -34,8 +34,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/terpnetwork/terp-core/app" - appparams "github.com/terpnetwork/terp-core/app/params" + "github.com/terpnetwork/terp-core/v2/app" + appparams "github.com/terpnetwork/terp-core/v2/app/params" ) type KeeperTestHelper struct { diff --git a/app/encoding.go b/app/encoding.go index b9c0d93..8ebe3ed 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -3,7 +3,7 @@ package app import ( "github.com/cosmos/cosmos-sdk/std" - "github.com/terpnetwork/terp-core/app/params" + "github.com/terpnetwork/terp-core/v2/app/params" ) // MakeEncodingConfig creates a new EncodingConfig with all modules registered diff --git a/app/sim_test.go b/app/sim_test.go index 239fd45..2eca812 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -1,46 +1,31 @@ package app import ( - "encoding/json" "fmt" - "math/rand" "os" - "runtime/debug" - "strings" + "path/filepath" "testing" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/stretchr/testify/require" + dbm "github.com/cometbft/cometbft-db" - abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/libs/log" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/kv" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/simulation" simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" - slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" - - "github.com/CosmWasm/wasmd/x/wasm" ) -// SimAppChainID hardcoded chainID for simulation -const SimAppChainID = "simulation-app" +const SimAppChainID = "testing" // Get flags every time the simulator is run func init() { @@ -53,299 +38,107 @@ type StoreKeysPrefixes struct { Prefixes [][]byte } -// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of -// an IAVLStore for faster simulation speed. -func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { - bapp.SetFauxMerkleMode() -} - -// interBlockCacheOpt returns a BaseApp option function that sets the persistent -// inter-block write-through cache. -func interBlockCacheOpt() func(*baseapp.BaseApp) { - return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager()) -} - -func TestFullAppSimulation(t *testing.T) { - config, db, _, app := setupSimulationApp(t, "skipping application simulation") - // run randomized simulation - _, simParams, simErr := simulation.SimulateFromSeed( - t, - os.Stdout, - app.BaseApp, - simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), - simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simtestutil.SimulationOperations(app, app.AppCodec(), config), - BlockedAddresses(), - config, - app.AppCodec(), - ) - - // export state and simParams before the simulation error is checked - err := simtestutil.CheckExportSimulation(app, config, simParams) - require.NoError(t, err) - require.NoError(t, simErr) +// SetupSimulation wraps simapp.SetupSimulation in order to create any export directory if they do not exist yet +func SetupSimulation() (simtypes.Config, dbm.DB, string, log.Logger, bool, error) { + config := simcli.NewConfigFromFlags() + config.ChainID = SimAppChainID - if config.Commit { - simtestutil.PrintStats(db) + db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) + if err != nil { + return simtypes.Config{}, nil, "", nil, false, err } -} -func TestAppImportExport(t *testing.T) { - config, db, appOptions, app := setupSimulationApp(t, "skipping application import/export simulation") + paths := []string{config.ExportParamsPath, config.ExportStatePath, config.ExportStatsPath} + for _, path := range paths { + if len(path) == 0 { + continue + } - // Run randomized simulation - _, simParams, simErr := simulation.SimulateFromSeed( - t, - os.Stdout, - app.BaseApp, - simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), - simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simtestutil.SimulationOperations(app, app.AppCodec(), config), - BlockedAddresses(), - config, - app.AppCodec(), - ) + path = filepath.Dir(path) + if _, err := os.Stat(path); os.IsNotExist(err) { + if err := os.MkdirAll(path, os.ModePerm); err != nil { + panic(err) + } + } + } - // export state and simParams before the simulation error is checked - err := simtestutil.CheckExportSimulation(app, config, simParams) - require.NoError(t, err) - require.NoError(t, simErr) + return config, db, dir, logger, skip, err +} - if config.Commit { - simtestutil.PrintStats(db) +// GetSimulationLog unmarshals the KVPair's Value to the corresponding type based on the +// each's module store key and the prefix bytes of the KVPair's key. +func GetSimulationLog(storeName string, sdr sdk.StoreDecoderRegistry, kvAs, kvBs []kv.Pair) (log string) { + for i := 0; i < len(kvAs); i++ { + if len(kvAs[i].Value) == 0 && len(kvBs[i].Value) == 0 { + // skip if the value doesn't have any bytes + continue + } + decoder, ok := sdr[storeName] + if ok { + log += decoder(kvAs[i], kvBs[i]) + } else { + log += fmt.Sprintf("store A %q => %q\nstore B %q => %q\n", kvAs[i].Key, kvAs[i].Value, kvBs[i].Key, kvBs[i].Value) + } } - fmt.Printf("exporting genesis...\n") - - exported, err := app.ExportAppStateAndValidators(false, []string{}, []string{}) - require.NoError(t, err) + return log +} - fmt.Printf("importing genesis...\n") +// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of +// an IAVLStore for faster simulation speed. +func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { + bapp.SetFauxMerkleMode() +} - newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) +func TestFullAppSimulation(t *testing.T) { + config, db, dir, logger, skip, err := SetupSimulation() + if skip { + t.Skip("skipping application simulation") + } require.NoError(t, err, "simulation setup failed") defer func() { - require.NoError(t, newDB.Close()) - require.NoError(t, os.RemoveAll(newDir)) - }() - - newApp := NewTerpApp(log.NewNopLogger(), newDB, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.Equal(t, "TerpApp", newApp.Name()) - - var genesisState GenesisState - err = json.Unmarshal(exported.AppState, &genesisState) - require.NoError(t, err) - - defer func() { - if r := recover(); r != nil { - err := fmt.Sprintf("%v", r) - if !strings.Contains(err, "validator set is empty after InitGenesis") { - panic(r) - } - t.Log("Skipping simulation as all validators have been unbonded") - t.Logf("err: %s stacktrace: %s\n", err, string(debug.Stack())) - } + db.Close() + require.NoError(t, os.RemoveAll(dir)) }() - ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState) - newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) - - fmt.Printf("comparing stores...\n") - - storeKeysPrefixes := []StoreKeysPrefixes{ - {app.GetKey(authtypes.StoreKey), newApp.GetKey(authtypes.StoreKey), [][]byte{}}, - { - app.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey), - [][]byte{ - stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, - }, - }, // ordering may change but it doesn't matter - {app.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}}, - {app.GetKey(minttypes.StoreKey), newApp.GetKey(minttypes.StoreKey), [][]byte{}}, - {app.GetKey(distrtypes.StoreKey), newApp.GetKey(distrtypes.StoreKey), [][]byte{}}, - {app.GetKey(banktypes.StoreKey), newApp.GetKey(banktypes.StoreKey), [][]byte{banktypes.BalancesPrefix}}, - {app.GetKey(paramtypes.StoreKey), newApp.GetKey(paramtypes.StoreKey), [][]byte{}}, - {app.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}}, - {app.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, - {app.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, - {app.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, - } - - for _, skp := range storeKeysPrefixes { - storeA := ctxA.KVStore(skp.A) - storeB := ctxB.KVStore(skp.B) - - failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) - require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") - - fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), app.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) - } -} + appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = DefaultNodeHome + appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue -func TestAppSimulationAfterImport(t *testing.T) { - config, db, appOptions, app := setupSimulationApp(t, "skipping application simulation after import") + var emptyWasmOption []wasmkeeper.Option + app := NewTerpApp( + logger, + db, + nil, + true, + wasmtypes.EnableAllProposals, + appOptions, + emptyWasmOption, + fauxMerkleModeOpt, + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(t, "terp", app.Name()) - // Run randomized simulation - stopEarly, simParams, simErr := simulation.SimulateFromSeed( + // run randomized simulation + _, simParams, simErr := simulation.SimulateFromSeed( t, os.Stdout, app.BaseApp, - simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), + simtestutil.AppStateFn(app.appCodec, app.SimulationManager(), NewDefaultGenesisState(app.appCodec)), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(app, app.AppCodec(), config), - BlockedAddresses(), + app.ModuleAccountAddrs(), config, app.AppCodec(), ) // export state and simParams before the simulation error is checked - err := simtestutil.CheckExportSimulation(app, config, simParams) + err = simtestutil.CheckExportSimulation(app, config, simParams) require.NoError(t, err) require.NoError(t, simErr) if config.Commit { simtestutil.PrintStats(db) } - - if stopEarly { - fmt.Println("can't export or import a zero-validator genesis, exiting test...") - return - } - - fmt.Printf("exporting genesis...\n") - - exported, err := app.ExportAppStateAndValidators(true, []string{}, []string{}) - require.NoError(t, err) - - fmt.Printf("importing genesis...\n") - - newDB, newDir, _, _, err := simtestutil.SetupSimulation(config, "leveldb-app-sim-2", "Simulation-2", simcli.FlagVerboseValue, simcli.FlagEnabledValue) - require.NoError(t, err, "simulation setup failed") - - defer func() { - require.NoError(t, newDB.Close()) - require.NoError(t, os.RemoveAll(newDir)) - }() - - newApp := NewTerpApp(log.NewNopLogger(), newDB, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.Equal(t, "TerpApp", newApp.Name()) - - newApp.InitChain(abci.RequestInitChain{ - ChainId: SimAppChainID, - AppStateBytes: exported.AppState, - }) - - _, _, err = simulation.SimulateFromSeed( - t, - os.Stdout, - newApp.BaseApp, - simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), - simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config), - BlockedAddresses(), - config, - app.AppCodec(), - ) - require.NoError(t, err) -} - -func setupSimulationApp(t *testing.T, msg string) (simtypes.Config, dbm.DB, simtestutil.AppOptionsMap, *TerpApp) { - t.Helper() - config := simcli.NewConfigFromFlags() - config.ChainID = SimAppChainID - - db, dir, logger, skip, err := simtestutil.SetupSimulation(config, "leveldb-app-sim", "Simulation", simcli.FlagVerboseValue, simcli.FlagEnabledValue) - if skip { - t.Skip(msg) - } - require.NoError(t, err, "simulation setup failed") - - t.Cleanup(func() { - require.NoError(t, db.Close()) - require.NoError(t, os.RemoveAll(dir)) - }) - - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[flags.FlagHome] = dir // ensure a unique folder - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - app := NewTerpApp(logger, db, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.Equal(t, "TerpApp", app.Name()) - return config, db, appOptions, app -} - -// TODO: Make another test for the fuzzer itself, which just has noOp txs -// and doesn't depend on the application. -func TestAppStateDeterminism(t *testing.T) { - if !simcli.FlagEnabledValue { - t.Skip("skipping application simulation") - } - - config := simcli.NewConfigFromFlags() - config.InitialBlockHeight = 1 - config.ExportParamsPath = "" - config.OnOperation = false - config.AllInvariants = false - config.ChainID = SimAppChainID - - numSeeds := 3 - numTimesToRunPerSeed := 5 - appHashList := make([]json.RawMessage, numTimesToRunPerSeed) - - appOptions := make(simtestutil.AppOptionsMap, 0) - appOptions[flags.FlagHome] = t.TempDir() // ensure a unique folder - appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - - for i := 0; i < numSeeds; i++ { - config.Seed = rand.Int63() - - for j := 0; j < numTimesToRunPerSeed; j++ { - var logger log.Logger - if simcli.FlagVerboseValue { - logger = log.TestingLogger() - } else { - logger = log.NewNopLogger() - } - - db := dbm.NewMemDB() - app := NewTerpApp(logger, db, nil, true, wasm.EnableAllProposals, appOptions, emptyWasmOpts, interBlockCacheOpt(), baseapp.SetChainID(SimAppChainID)) - - fmt.Printf( - "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", - config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - - _, _, err := simulation.SimulateFromSeed( - t, - os.Stdout, - app.BaseApp, - simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager(), app.DefaultGenesis()), - simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simtestutil.SimulationOperations(app, app.AppCodec(), config), - BlockedAddresses(), - config, - app.AppCodec(), - ) - require.NoError(t, err) - - if config.Commit { - simtestutil.PrintStats(db) - } - - appHash := app.LastCommitID().Hash - appHashList[j] = appHash - - if j != 0 { - require.Equal( - t, string(appHashList[0]), string(appHashList[j]), - "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, - ) - } - } - } } diff --git a/app/test_helpers.go b/app/test_helpers.go index f7556ea..829d1c5 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -33,13 +33,8 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - apphelpers "github.com/terpnetwork/terp-core/app/helpers" - appparams "github.com/terpnetwork/terp-core/app/params" -) - -// SimAppChainID hardcoded chainID for simulation -const ( - SimAppChainID = "testing" + apphelpers "github.com/terpnetwork/terp-core/v2/app/helpers" + appparams "github.com/terpnetwork/terp-core/v2/app/params" ) // EmptyBaseAppOptions is a stub implementing AppOptions diff --git a/app/upgrades/v2/upgrade.go b/app/upgrades/v2/upgrade.go index 44d8a4b..18234aa 100644 --- a/app/upgrades/v2/upgrade.go +++ b/app/upgrades/v2/upgrade.go @@ -7,14 +7,14 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - feesharekeeper "github.com/terpnetwork/terp-core/x/feeshare/keeper" - feesharetypes "github.com/terpnetwork/terp-core/x/feeshare/types" + feesharekeeper "github.com/terpnetwork/terp-core/v2/x/feeshare/keeper" + feesharetypes "github.com/terpnetwork/terp-core/v2/x/feeshare/types" - globalfeekeeper "github.com/terpnetwork/terp-core/x/globalfee/keeper" - globalfeetypes "github.com/terpnetwork/terp-core/x/globalfee/types" + globalfeekeeper "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" + globalfeetypes "github.com/terpnetwork/terp-core/v2/x/globalfee/types" - tokenfactorykeeper "github.com/terpnetwork/terp-core/x/tokenfactory/keeper" - tokenfactorytypes "github.com/terpnetwork/terp-core/x/tokenfactory/types" + tokenfactorykeeper "github.com/terpnetwork/terp-core/v2/x/tokenfactory/keeper" + tokenfactorytypes "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper" icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types" @@ -22,7 +22,7 @@ import ( packetforwardkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/keeper" packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types" - "github.com/terpnetwork/terp-core/app/upgrades" + "github.com/terpnetwork/terp-core/v2/app/upgrades" ) // We now charge 2 million gas * gas price to create a denom. diff --git a/cmd/terpd/cmd/balances_from_state_export.go b/cmd/terpd/cmd/balances_from_state_export.go index deaa02e..2033484 100644 --- a/cmd/terpd/cmd/balances_from_state_export.go +++ b/cmd/terpd/cmd/balances_from_state_export.go @@ -1,272 +1,272 @@ -package cmd - -// modified from osmosis - -import ( - "encoding/csv" - "encoding/json" - "fmt" - "io" - "os" - "path/filepath" - - "github.com/spf13/cobra" - - tmjson "github.com/cometbft/cometbft/libs/json" - tmtypes "github.com/cometbft/cometbft/types" - - "cosmossdk.io/math" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server" - sdk "github.com/cosmos/cosmos-sdk/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - appparams "github.com/terpnetwork/terp-core/app/params" -) - -const ( - FlagMinimumStakeAmount = "minimum-stake-amount" -) - -type DeriveSnapshot struct { - NumberAccounts uint64 `json:"num_accounts"` - Accounts map[string]DerivedAccount `json:"accounts"` -} - -// DerivedAccount provide fields of snapshot per account -// It is the simplified struct we are presenting in this 'balances from state export' snapshot for people. -type DerivedAccount struct { - Address string `json:"address"` - LiquidBalances sdk.Coins `json:"liquid_balance"` - Staked math.Int `json:"staked"` - UnbondingStake math.Int `json:"unbonding_stake"` - Bonded sdk.Coins `json:"bonded"` - TotalBalances sdk.Coins `json:"total_balances"` -} - -// newDerivedAccount returns a new derived account. -func newDerivedAccount(address string) DerivedAccount { - return DerivedAccount{ - Address: address, - LiquidBalances: sdk.Coins{}, - Staked: sdk.ZeroInt(), - UnbondingStake: sdk.ZeroInt(), - Bonded: sdk.Coins{}, - } -} - -// getGenStateFromPath returns a JSON genState message from inputted path. -func getGenStateFromPath(genesisFilePath string) (map[string]json.RawMessage, error) { - genState := make(map[string]json.RawMessage) - - genesisFile, err := os.Open(filepath.Clean(genesisFilePath)) - if err != nil { - return genState, err - } - defer genesisFile.Close() - - byteValue, _ := io.ReadAll(genesisFile) - - var doc tmtypes.GenesisDoc - err = tmjson.Unmarshal(byteValue, &doc) - if err != nil { - return genState, err - } - - err = json.Unmarshal(doc.AppState, &genState) - if err != nil { - panic(err) - } - return genState, nil -} - -// ExportAirdropSnapshotCmd generates a snapshot.json from a provided exported genesis.json. -func ExportDeriveBalancesCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "export-derive-balances [input-genesis-file] [output-snapshot-json]", - Short: "Export a derive balances from a provided genesis export", - Long: `Export a derive balances from a provided genesis export -Example: - terpd export-derive-balances ../genesis.json ../snapshot.json -`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - config.SetRoot(clientCtx.HomeDir) - - genesisFile := args[0] - genState, err := getGenStateFromPath(genesisFile) - if err != nil { - return err - } - snapshotOutput := args[1] - - // Produce the map of address to total terp balance, both staked and UnbondingStake - snapshotAccs := make(map[string]DerivedAccount) - - bankGenesis := banktypes.GenesisState{} - if len(genState["bank"]) > 0 { - clientCtx.Codec.MustUnmarshalJSON(genState["bank"], &bankGenesis) - } - for _, balance := range bankGenesis.Balances { - address := balance.Address - acc, ok := snapshotAccs[address] - if !ok { - acc = newDerivedAccount(address) - } - - acc.LiquidBalances = balance.Coins - snapshotAccs[address] = acc - } - - stakingGenesis := stakingtypes.GenesisState{} - if len(genState["staking"]) > 0 { - clientCtx.Codec.MustUnmarshalJSON(genState["staking"], &stakingGenesis) - } - for _, unbonding := range stakingGenesis.UnbondingDelegations { - address := unbonding.DelegatorAddress - acc, ok := snapshotAccs[address] - if !ok { - acc = newDerivedAccount(address) - } - - unbondingTerps := sdk.NewInt(0) - for _, entry := range unbonding.Entries { - unbondingTerps = unbondingTerps.Add(entry.Balance) - } - - acc.UnbondingStake = acc.UnbondingStake.Add(unbondingTerps) - - snapshotAccs[address] = acc - } - - // Make a map from validator operator address to the v036 validator type - validators := make(map[string]stakingtypes.Validator) - for _, validator := range stakingGenesis.Validators { - validators[validator.OperatorAddress] = validator - } - - for _, delegation := range stakingGenesis.Delegations { - address := delegation.DelegatorAddress - - acc, ok := snapshotAccs[address] - if !ok { - acc = newDerivedAccount(address) - } - - val := validators[delegation.ValidatorAddress] - stakedTerps := delegation.Shares.MulInt(val.Tokens).Quo(val.DelegatorShares).RoundInt() - - acc.Staked = acc.Staked.Add(stakedTerps) - - snapshotAccs[address] = acc - } - - // convert balances to underlying coins and sum up balances to total balance - for addr, account := range snapshotAccs { - // account.LiquidBalances = underlyingCoins(account.LiquidBalances) - // account.Bonded = underlyingCoins(account.Bonded) - account.TotalBalances = sdk.NewCoins(). - Add(account.LiquidBalances...). - Add(sdk.NewCoin(appparams.BondDenom, account.Staked)). - Add(sdk.NewCoin(appparams.BondDenom, account.UnbondingStake)). - Add(account.Bonded...) - snapshotAccs[addr] = account - } - - snapshot := DeriveSnapshot{ - NumberAccounts: uint64(len(snapshotAccs)), - Accounts: snapshotAccs, - } - - fmt.Printf("# accounts: %d\n", len(snapshotAccs)) - - // export snapshot json - snapshotJSON, err := json.MarshalIndent(snapshot, "", " ") - if err != nil { - return fmt.Errorf("failed to marshal snapshot: %w", err) - } - - err = os.WriteFile(snapshotOutput, snapshotJSON, 0o600) - return err - }, - } - - return cmd -} - -// StakedToCSVCmd generates a airdrop.csv from a provided exported balances.json. -func StakedToCSVCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "staked-to-csv [input-balances-file] [output-airdrop-csv]", - Short: "Export a airdrop csv from a provided balances export", - Long: `Export a airdrop csv from a provided balances export (from export-derive-balances) -Example: - terpd staked-to-csv ../balances.json ../airdrop.csv -`, - Args: cobra.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - config.SetRoot(clientCtx.HomeDir) - - balancesFile := args[0] - - snapshotOutput := args[1] - - minStakeAmount, _ := cmd.Flags().GetInt64(FlagMinimumStakeAmount) - - var deriveSnapshot DeriveSnapshot - - sourceFile, err := os.Open(balancesFile) - if err != nil { - return err - } - // remember to close the file at the end of the function - defer sourceFile.Close() - - // decode the balances json file into the struct array - if err := json.NewDecoder(sourceFile).Decode(&deriveSnapshot); err != nil { - return err - } - - // create a new file to store CSV data - outputFile, err := os.Create(snapshotOutput) - if err != nil { - return err - } - defer outputFile.Close() - - // write the header of the CSV file - writer := csv.NewWriter(outputFile) - defer writer.Flush() - - header := []string{"address", "staked"} - if err := writer.Write(header); err != nil { - return err - } - - // iterate through all accounts, leave out accounts that do not meet the user provided min stake amount - for _, r := range deriveSnapshot.Accounts { - var csvRow []string - if r.Staked.GT(sdk.NewInt(minStakeAmount)) { - csvRow = append(csvRow, r.Address, r.Staked.String()) - if err := writer.Write(csvRow); err != nil { - return err - } - } - } - - return nil - }, - } - - cmd.Flags().Int64(FlagMinimumStakeAmount, 0, "Specify minimum amount (non inclusive) accounts must stake to be included in airdrop (default: 0)") - - return cmd -} +package cmd + +// modified from osmosis + +import ( + "encoding/csv" + "encoding/json" + "fmt" + "io" + "os" + "path/filepath" + + "github.com/spf13/cobra" + + tmjson "github.com/cometbft/cometbft/libs/json" + tmtypes "github.com/cometbft/cometbft/types" + + "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" + sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + appparams "github.com/terpnetwork/terp-core/v2/app/params" +) + +const ( + FlagMinimumStakeAmount = "minimum-stake-amount" +) + +type DeriveSnapshot struct { + NumberAccounts uint64 `json:"num_accounts"` + Accounts map[string]DerivedAccount `json:"accounts"` +} + +// DerivedAccount provide fields of snapshot per account +// It is the simplified struct we are presenting in this 'balances from state export' snapshot for people. +type DerivedAccount struct { + Address string `json:"address"` + LiquidBalances sdk.Coins `json:"liquid_balance"` + Staked math.Int `json:"staked"` + UnbondingStake math.Int `json:"unbonding_stake"` + Bonded sdk.Coins `json:"bonded"` + TotalBalances sdk.Coins `json:"total_balances"` +} + +// newDerivedAccount returns a new derived account. +func newDerivedAccount(address string) DerivedAccount { + return DerivedAccount{ + Address: address, + LiquidBalances: sdk.Coins{}, + Staked: sdk.ZeroInt(), + UnbondingStake: sdk.ZeroInt(), + Bonded: sdk.Coins{}, + } +} + +// getGenStateFromPath returns a JSON genState message from inputted path. +func getGenStateFromPath(genesisFilePath string) (map[string]json.RawMessage, error) { + genState := make(map[string]json.RawMessage) + + genesisFile, err := os.Open(filepath.Clean(genesisFilePath)) + if err != nil { + return genState, err + } + defer genesisFile.Close() + + byteValue, _ := io.ReadAll(genesisFile) + + var doc tmtypes.GenesisDoc + err = tmjson.Unmarshal(byteValue, &doc) + if err != nil { + return genState, err + } + + err = json.Unmarshal(doc.AppState, &genState) + if err != nil { + panic(err) + } + return genState, nil +} + +// ExportAirdropSnapshotCmd generates a snapshot.json from a provided exported genesis.json. +func ExportDeriveBalancesCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "export-derive-balances [input-genesis-file] [output-snapshot-json]", + Short: "Export a derive balances from a provided genesis export", + Long: `Export a derive balances from a provided genesis export +Example: + terpd export-derive-balances ../genesis.json ../snapshot.json +`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + config.SetRoot(clientCtx.HomeDir) + + genesisFile := args[0] + genState, err := getGenStateFromPath(genesisFile) + if err != nil { + return err + } + snapshotOutput := args[1] + + // Produce the map of address to total terp balance, both staked and UnbondingStake + snapshotAccs := make(map[string]DerivedAccount) + + bankGenesis := banktypes.GenesisState{} + if len(genState["bank"]) > 0 { + clientCtx.Codec.MustUnmarshalJSON(genState["bank"], &bankGenesis) + } + for _, balance := range bankGenesis.Balances { + address := balance.Address + acc, ok := snapshotAccs[address] + if !ok { + acc = newDerivedAccount(address) + } + + acc.LiquidBalances = balance.Coins + snapshotAccs[address] = acc + } + + stakingGenesis := stakingtypes.GenesisState{} + if len(genState["staking"]) > 0 { + clientCtx.Codec.MustUnmarshalJSON(genState["staking"], &stakingGenesis) + } + for _, unbonding := range stakingGenesis.UnbondingDelegations { + address := unbonding.DelegatorAddress + acc, ok := snapshotAccs[address] + if !ok { + acc = newDerivedAccount(address) + } + + unbondingTerps := sdk.NewInt(0) + for _, entry := range unbonding.Entries { + unbondingTerps = unbondingTerps.Add(entry.Balance) + } + + acc.UnbondingStake = acc.UnbondingStake.Add(unbondingTerps) + + snapshotAccs[address] = acc + } + + // Make a map from validator operator address to the v036 validator type + validators := make(map[string]stakingtypes.Validator) + for _, validator := range stakingGenesis.Validators { + validators[validator.OperatorAddress] = validator + } + + for _, delegation := range stakingGenesis.Delegations { + address := delegation.DelegatorAddress + + acc, ok := snapshotAccs[address] + if !ok { + acc = newDerivedAccount(address) + } + + val := validators[delegation.ValidatorAddress] + stakedTerps := delegation.Shares.MulInt(val.Tokens).Quo(val.DelegatorShares).RoundInt() + + acc.Staked = acc.Staked.Add(stakedTerps) + + snapshotAccs[address] = acc + } + + // convert balances to underlying coins and sum up balances to total balance + for addr, account := range snapshotAccs { + // account.LiquidBalances = underlyingCoins(account.LiquidBalances) + // account.Bonded = underlyingCoins(account.Bonded) + account.TotalBalances = sdk.NewCoins(). + Add(account.LiquidBalances...). + Add(sdk.NewCoin(appparams.BondDenom, account.Staked)). + Add(sdk.NewCoin(appparams.BondDenom, account.UnbondingStake)). + Add(account.Bonded...) + snapshotAccs[addr] = account + } + + snapshot := DeriveSnapshot{ + NumberAccounts: uint64(len(snapshotAccs)), + Accounts: snapshotAccs, + } + + fmt.Printf("# accounts: %d\n", len(snapshotAccs)) + + // export snapshot json + snapshotJSON, err := json.MarshalIndent(snapshot, "", " ") + if err != nil { + return fmt.Errorf("failed to marshal snapshot: %w", err) + } + + err = os.WriteFile(snapshotOutput, snapshotJSON, 0o600) + return err + }, + } + + return cmd +} + +// StakedToCSVCmd generates a airdrop.csv from a provided exported balances.json. +func StakedToCSVCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "staked-to-csv [input-balances-file] [output-airdrop-csv]", + Short: "Export a airdrop csv from a provided balances export", + Long: `Export a airdrop csv from a provided balances export (from export-derive-balances) +Example: + terpd staked-to-csv ../balances.json ../airdrop.csv +`, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + config.SetRoot(clientCtx.HomeDir) + + balancesFile := args[0] + + snapshotOutput := args[1] + + minStakeAmount, _ := cmd.Flags().GetInt64(FlagMinimumStakeAmount) + + var deriveSnapshot DeriveSnapshot + + sourceFile, err := os.Open(balancesFile) + if err != nil { + return err + } + // remember to close the file at the end of the function + defer sourceFile.Close() + + // decode the balances json file into the struct array + if err := json.NewDecoder(sourceFile).Decode(&deriveSnapshot); err != nil { + return err + } + + // create a new file to store CSV data + outputFile, err := os.Create(snapshotOutput) + if err != nil { + return err + } + defer outputFile.Close() + + // write the header of the CSV file + writer := csv.NewWriter(outputFile) + defer writer.Flush() + + header := []string{"address", "staked"} + if err := writer.Write(header); err != nil { + return err + } + + // iterate through all accounts, leave out accounts that do not meet the user provided min stake amount + for _, r := range deriveSnapshot.Accounts { + var csvRow []string + if r.Staked.GT(sdk.NewInt(minStakeAmount)) { + csvRow = append(csvRow, r.Address, r.Staked.String()) + if err := writer.Write(csvRow); err != nil { + return err + } + } + } + + return nil + }, + } + + cmd.Flags().Int64(FlagMinimumStakeAmount, 0, "Specify minimum amount (non inclusive) accounts must stake to be included in airdrop (default: 0)") + + return cmd +} diff --git a/cmd/terpd/cmd/config.go b/cmd/terpd/cmd/config.go index 28f0df0..34e5f86 100644 --- a/cmd/terpd/cmd/config.go +++ b/cmd/terpd/cmd/config.go @@ -1,235 +1,235 @@ -package cmd - -import ( - "bytes" - "encoding/json" - "fmt" - "os" - "path/filepath" - "text/template" - - "github.com/spf13/cobra" - viper "github.com/spf13/viper" - - tmcli "github.com/cometbft/cometbft/libs/cli" - - "github.com/cosmos/cosmos-sdk/client" - scconfig "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/client/flags" -) - -type TerpCustomClient struct { - scconfig.ClientConfig - Gas string `mapstructure:"gas" json:"gas"` - GasPrices string `mapstructure:"gas-prices" json:"gas-prices"` - GasAdjustment string `mapstructure:"gas-adjustment" json:"gas-adjustment"` - - Fees string `mapstructure:"fees" json:"fees"` - FeeGranter string `mapstructure:"fee-granter" json:"fee-granter"` - FeePayer string `mapstructure:"fee-payer" json:"fee-payer"` - - Note string `mapstructure:"note" json:"note"` -} - -// ConfigCmd returns a CLI command to interactively create an application CLI -// config file. -func ConfigCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "config [value]", - Short: "Create or query an application CLI configuration file", - RunE: runConfigCmd, - Args: cobra.RangeArgs(0, 2), - } - return cmd -} - -func runConfigCmd(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - configPath := filepath.Join(clientCtx.HomeDir, "config") - - conf, err := getClientConfig(configPath, clientCtx.Viper) - if err != nil { - return fmt.Errorf("couldn't get client config: %v", err) - } - - tcc := TerpCustomClient{ - *conf, - os.Getenv("TERPD_GAS"), - os.Getenv("TERPD_GAS_PRICES"), - os.Getenv("TERPD_GAS_ADJUSTMENT"), - - os.Getenv("TERPD_FEES"), - os.Getenv("TERPD_FEE_GRANTER"), - os.Getenv("TERPD_FEE_PAYER"), - - os.Getenv("TERPD_NOTE"), - } - - switch len(args) { - case 0: - s, err := json.MarshalIndent(tcc, "", "\t") - if err != nil { - return err - } - - cmd.Println(string(s)) - - case 1: - // it's a get - key := args[0] - - switch key { - case flags.FlagChainID: - cmd.Println(conf.ChainID) - case flags.FlagKeyringBackend: - cmd.Println(conf.KeyringBackend) - case tmcli.OutputFlag: - cmd.Println(conf.Output) - case flags.FlagNode: - cmd.Println(conf.Node) - case flags.FlagBroadcastMode: - cmd.Println(conf.BroadcastMode) - - // Custom flags - case flags.FlagGas: - cmd.Println(tcc.Gas) - case flags.FlagGasPrices: - cmd.Println(tcc.GasPrices) - case flags.FlagGasAdjustment: - cmd.Println(tcc.GasAdjustment) - case flags.FlagFees: - cmd.Println(tcc.Fees) - case flags.FlagFeeGranter: - cmd.Println(tcc.FeeGranter) - case flags.FlagFeePayer: - cmd.Println(tcc.FeePayer) - case flags.FlagNote: - cmd.Println(tcc.Note) - default: - err := errUnknownConfigKey(key) - return fmt.Errorf("couldn't get the value for the key: %v, error: %v", key, err) - } - - case 2: - // it's set - key, value := args[0], args[1] - - switch key { - case flags.FlagChainID: - tcc.ChainID = value - case flags.FlagKeyringBackend: - tcc.KeyringBackend = value - case tmcli.OutputFlag: - tcc.Output = value - case flags.FlagNode: - tcc.Node = value - case flags.FlagBroadcastMode: - tcc.BroadcastMode = value - case flags.FlagGas: - tcc.Gas = value - case flags.FlagGasPrices: - tcc.GasPrices = value - tcc.Fees = "" // resets since we can only use 1 at a time - case flags.FlagGasAdjustment: - tcc.GasAdjustment = value - case flags.FlagFees: - tcc.Fees = value - tcc.GasPrices = "" // resets since we can only use 1 at a time - case flags.FlagFeeGranter: - tcc.FeeGranter = value - case flags.FlagFeePayer: - tcc.FeePayer = value - case flags.FlagNote: - tcc.Note = value - default: - return errUnknownConfigKey(key) - } - - confFile := filepath.Join(configPath, "client.toml") - if err := writeConfigToFile(confFile, &tcc); err != nil { - return fmt.Errorf("could not write client config to the file: %v", err) - } - - default: - panic("cound not execute config command") - } - - return nil -} - -const defaultConfigTemplate = `# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Client Configuration ### -############################################################################### - -# The network chain ID -chain-id = "{{ .ChainID }}" -# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) -keyring-backend = "{{ .KeyringBackend }}" -# CLI output format (text|json) -output = "{{ .Output }}" -# : to Tendermint RPC interface for this chain -node = "{{ .Node }}" -# Transaction broadcasting mode (sync|async|block) -broadcast-mode = "{{ .BroadcastMode }}" - -############################################################################### -### Terp Tx Configuration ### -############################################################################### - -# Amount of gas per transaction -gas = "{{ .Gas }}" -# Price per unit of gas (ex: 0.005uthiol) -gas-prices = "{{ .GasPrices }}" -gas-adjustment = "{{ .GasAdjustment }}" - -# Fees to use instead of set gas prices -fees = "{{ .Fees }}" -fee-granter = "{{ .FeeGranter }}" -fee-payer = "{{ .FeePayer }}" - -# Memo to include in your Transactions -note = "{{ .Note }}" -` - -// writeConfigToFile parses defaultConfigTemplate, renders config using the template and writes it to -// configFilePath. -func writeConfigToFile(configFilePath string, config *TerpCustomClient) error { - var buffer bytes.Buffer - - tmpl := template.New("clientConfigFileTemplate") - configTemplate, err := tmpl.Parse(defaultConfigTemplate) - if err != nil { - return err - } - - if err := configTemplate.Execute(&buffer, config); err != nil { - return err - } - - return os.WriteFile(configFilePath, buffer.Bytes(), 0o600) -} - -// getClientConfig reads values from client.toml file and unmarshalls them into ClientConfig -func getClientConfig(configPath string, v *viper.Viper) (*scconfig.ClientConfig, error) { - v.AddConfigPath(configPath) - v.SetConfigName("client") - v.SetConfigType("toml") - - if err := v.ReadInConfig(); err != nil { - return nil, err - } - - conf := new(scconfig.ClientConfig) - if err := v.Unmarshal(conf); err != nil { - return nil, err - } - - return conf, nil -} - -func errUnknownConfigKey(key string) error { - return fmt.Errorf("unknown configuration key: %q", key) -} +package cmd + +import ( + "bytes" + "encoding/json" + "fmt" + "os" + "path/filepath" + "text/template" + + "github.com/spf13/cobra" + viper "github.com/spf13/viper" + + tmcli "github.com/cometbft/cometbft/libs/cli" + + "github.com/cosmos/cosmos-sdk/client" + scconfig "github.com/cosmos/cosmos-sdk/client/config" + "github.com/cosmos/cosmos-sdk/client/flags" +) + +type TerpCustomClient struct { + scconfig.ClientConfig + Gas string `mapstructure:"gas" json:"gas"` + GasPrices string `mapstructure:"gas-prices" json:"gas-prices"` + GasAdjustment string `mapstructure:"gas-adjustment" json:"gas-adjustment"` + + Fees string `mapstructure:"fees" json:"fees"` + FeeGranter string `mapstructure:"fee-granter" json:"fee-granter"` + FeePayer string `mapstructure:"fee-payer" json:"fee-payer"` + + Note string `mapstructure:"note" json:"note"` +} + +// ConfigCmd returns a CLI command to interactively create an application CLI +// config file. +func ConfigCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "config [value]", + Short: "Create or query an application CLI configuration file", + RunE: runConfigCmd, + Args: cobra.RangeArgs(0, 2), + } + return cmd +} + +func runConfigCmd(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + configPath := filepath.Join(clientCtx.HomeDir, "config") + + conf, err := getClientConfig(configPath, clientCtx.Viper) + if err != nil { + return fmt.Errorf("couldn't get client config: %v", err) + } + + tcc := TerpCustomClient{ + *conf, + os.Getenv("TERPD_GAS"), + os.Getenv("TERPD_GAS_PRICES"), + os.Getenv("TERPD_GAS_ADJUSTMENT"), + + os.Getenv("TERPD_FEES"), + os.Getenv("TERPD_FEE_GRANTER"), + os.Getenv("TERPD_FEE_PAYER"), + + os.Getenv("TERPD_NOTE"), + } + + switch len(args) { + case 0: + s, err := json.MarshalIndent(tcc, "", "\t") + if err != nil { + return err + } + + cmd.Println(string(s)) + + case 1: + // it's a get + key := args[0] + + switch key { + case flags.FlagChainID: + cmd.Println(conf.ChainID) + case flags.FlagKeyringBackend: + cmd.Println(conf.KeyringBackend) + case tmcli.OutputFlag: + cmd.Println(conf.Output) + case flags.FlagNode: + cmd.Println(conf.Node) + case flags.FlagBroadcastMode: + cmd.Println(conf.BroadcastMode) + + // Custom flags + case flags.FlagGas: + cmd.Println(tcc.Gas) + case flags.FlagGasPrices: + cmd.Println(tcc.GasPrices) + case flags.FlagGasAdjustment: + cmd.Println(tcc.GasAdjustment) + case flags.FlagFees: + cmd.Println(tcc.Fees) + case flags.FlagFeeGranter: + cmd.Println(tcc.FeeGranter) + case flags.FlagFeePayer: + cmd.Println(tcc.FeePayer) + case flags.FlagNote: + cmd.Println(tcc.Note) + default: + err := errUnknownConfigKey(key) + return fmt.Errorf("couldn't get the value for the key: %v, error: %v", key, err) + } + + case 2: + // it's set + key, value := args[0], args[1] + + switch key { + case flags.FlagChainID: + tcc.ChainID = value + case flags.FlagKeyringBackend: + tcc.KeyringBackend = value + case tmcli.OutputFlag: + tcc.Output = value + case flags.FlagNode: + tcc.Node = value + case flags.FlagBroadcastMode: + tcc.BroadcastMode = value + case flags.FlagGas: + tcc.Gas = value + case flags.FlagGasPrices: + tcc.GasPrices = value + tcc.Fees = "" // resets since we can only use 1 at a time + case flags.FlagGasAdjustment: + tcc.GasAdjustment = value + case flags.FlagFees: + tcc.Fees = value + tcc.GasPrices = "" // resets since we can only use 1 at a time + case flags.FlagFeeGranter: + tcc.FeeGranter = value + case flags.FlagFeePayer: + tcc.FeePayer = value + case flags.FlagNote: + tcc.Note = value + default: + return errUnknownConfigKey(key) + } + + confFile := filepath.Join(configPath, "client.toml") + if err := writeConfigToFile(confFile, &tcc); err != nil { + return fmt.Errorf("could not write client config to the file: %v", err) + } + + default: + panic("cound not execute config command") + } + + return nil +} + +const defaultConfigTemplate = `# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +############################################################################### +### Client Configuration ### +############################################################################### + +# The network chain ID +chain-id = "{{ .ChainID }}" +# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) +keyring-backend = "{{ .KeyringBackend }}" +# CLI output format (text|json) +output = "{{ .Output }}" +# : to Tendermint RPC interface for this chain +node = "{{ .Node }}" +# Transaction broadcasting mode (sync|async|block) +broadcast-mode = "{{ .BroadcastMode }}" + +############################################################################### +### Terp Tx Configuration ### +############################################################################### + +# Amount of gas per transaction +gas = "{{ .Gas }}" +# Price per unit of gas (ex: 0.005uthiol) +gas-prices = "{{ .GasPrices }}" +gas-adjustment = "{{ .GasAdjustment }}" + +# Fees to use instead of set gas prices +fees = "{{ .Fees }}" +fee-granter = "{{ .FeeGranter }}" +fee-payer = "{{ .FeePayer }}" + +# Memo to include in your Transactions +note = "{{ .Note }}" +` + +// writeConfigToFile parses defaultConfigTemplate, renders config using the template and writes it to +// configFilePath. +func writeConfigToFile(configFilePath string, config *TerpCustomClient) error { + var buffer bytes.Buffer + + tmpl := template.New("clientConfigFileTemplate") + configTemplate, err := tmpl.Parse(defaultConfigTemplate) + if err != nil { + return err + } + + if err := configTemplate.Execute(&buffer, config); err != nil { + return err + } + + return os.WriteFile(configFilePath, buffer.Bytes(), 0o600) +} + +// getClientConfig reads values from client.toml file and unmarshalls them into ClientConfig +func getClientConfig(configPath string, v *viper.Viper) (*scconfig.ClientConfig, error) { + v.AddConfigPath(configPath) + v.SetConfigName("client") + v.SetConfigType("toml") + + if err := v.ReadInConfig(); err != nil { + return nil, err + } + + conf := new(scconfig.ClientConfig) + if err := v.Unmarshal(conf); err != nil { + return nil, err + } + + return conf, nil +} + +func errUnknownConfigKey(key string) error { + return fmt.Errorf("unknown configuration key: %q", key) +} diff --git a/cmd/terpd/cmd/debug.go b/cmd/terpd/cmd/debug.go index 032d3b2..71cc578 100644 --- a/cmd/terpd/cmd/debug.go +++ b/cmd/terpd/cmd/debug.go @@ -1,175 +1,175 @@ -package cmd - -import ( - "encoding/hex" - "fmt" - "strconv" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/bech32" - "github.com/cosmos/cosmos-sdk/version" -) - -// Cmd creates a main CLI command -func DebugCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "debug", - Short: "Tool for helping with debugging your application", - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - PubkeyCmd(), - AddrCmd(), - RawBytesCmd(), - ConvertBech32Cmd(), - ExportDeriveBalancesCmd(), - StakedToCSVCmd(), - ) - - return cmd -} - -var flagBech32Prefix = "prefix" - -// get cmd to convert any bech32 address to a terp prefix. -func ConvertBech32Cmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "bech32-convert [bech32 string]", - Short: "Convert any bech32 string to the terp prefix", - Long: `Convert any bech32 string to the terp prefix -Especially useful for converting cosmos addresses to terp addresses -Example: - terpd bech32-convert terp1ey69r37gfxvxg62sh4r0ktpuc46pzjrm9qvyl8 -p osmo - `, - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - bech32prefix, err := cmd.Flags().GetString(flagBech32Prefix) - if err != nil { - return err - } - - _, bz, err := bech32.DecodeAndConvert(args[0]) - if err != nil { - return err - } - - bech32Addr, err := bech32.ConvertAndEncode(bech32prefix, bz) - if err != nil { - panic(err) - } - - cmd.Println(bech32Addr) - - return nil - }, - } - - cmd.Flags().StringP(flagBech32Prefix, "p", "terp", "Bech32 Prefix to encode to") - - return cmd -} - -// getPubKeyFromString decodes SDK PubKey using JSON marshaler. -func getPubKeyFromString(ctx client.Context, pkstr string) (cryptotypes.PubKey, error) { - var pk cryptotypes.PubKey - err := ctx.Codec.UnmarshalInterfaceJSON([]byte(pkstr), &pk) - return pk, err -} - -func PubkeyCmd() *cobra.Command { - return &cobra.Command{ - Use: "pubkey [pubkey]", - Short: "Decode a pubkey from proto JSON", - Long: fmt.Sprintf(`Decode a pubkey from proto JSON and display it's address. - -Example: -$ %s debug pubkey '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AurroA7jvfPd1AadmmOvWM2rJSwipXfRf8yD6pLbA2DJ"}' - `, version.AppName), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - pk, err := getPubKeyFromString(clientCtx, args[0]) - if err != nil { - return err - } - cmd.Println("Address:", pk.Address()) - cmd.Println("PubKey Hex:", hex.EncodeToString(pk.Bytes())) - return nil - }, - } -} - -func AddrCmd() *cobra.Command { - return &cobra.Command{ - Use: "addr [address]", - Short: "Convert an address between hex and bech32", - Long: fmt.Sprintf(`Convert an address between hex encoding and bech32. - -Example: -$ %s debug addr cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg - `, version.AppName), - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - addrString := args[0] - var addr []byte - - // try hex, then bech32 - var err error - addr, err = hex.DecodeString(addrString) - if err != nil { - var err2 error - addr, err2 = sdk.AccAddressFromBech32(addrString) - if err2 != nil { - var err3 error - addr, err3 = sdk.ValAddressFromBech32(addrString) - - if err3 != nil { - return fmt.Errorf("expected hex or bech32. Got errors: hex: %v, bech32 acc: %v, bech32 val: %v", err, err2, err3) - } - } - } - - cmd.Println("Address:", addr) - cmd.Printf("Address (hex): %X\n", addr) - cmd.Printf("Bech32 Acc: %s\n", sdk.AccAddress(addr)) - cmd.Printf("Bech32 Val: %s\n", sdk.ValAddress(addr)) - return nil - }, - } -} - -func RawBytesCmd() *cobra.Command { - return &cobra.Command{ - Use: "raw-bytes [raw-bytes]", - Short: "Convert raw bytes output (eg. [10 21 13 255]) to hex", - Long: fmt.Sprintf(`Convert raw-bytes to hex. - -Example: -$ %s debug raw-bytes [72 101 108 108 111 44 32 112 108 97 121 103 114 111 117 110 100] - `, version.AppName), - Args: cobra.ExactArgs(1), - RunE: func(_ *cobra.Command, args []string) error { - stringBytes := args[0] - stringBytes = strings.Trim(stringBytes, "[") - stringBytes = strings.Trim(stringBytes, "]") - spl := strings.Split(stringBytes, " ") - - byteArray := []byte{} - for _, s := range spl { - b, err := strconv.ParseInt(s, 10, 8) - if err != nil { - return err - } - byteArray = append(byteArray, byte(b)) - } - fmt.Printf("%X\n", byteArray) - return nil - }, - } -} +package cmd + +import ( + "encoding/hex" + "fmt" + "strconv" + "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/bech32" + "github.com/cosmos/cosmos-sdk/version" +) + +// Cmd creates a main CLI command +func DebugCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "debug", + Short: "Tool for helping with debugging your application", + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + PubkeyCmd(), + AddrCmd(), + RawBytesCmd(), + ConvertBech32Cmd(), + ExportDeriveBalancesCmd(), + StakedToCSVCmd(), + ) + + return cmd +} + +var flagBech32Prefix = "prefix" + +// get cmd to convert any bech32 address to a terp prefix. +func ConvertBech32Cmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "bech32-convert [bech32 string]", + Short: "Convert any bech32 string to the terp prefix", + Long: `Convert any bech32 string to the terp prefix +Especially useful for converting cosmos addresses to terp addresses +Example: + terpd bech32-convert terp1ey69r37gfxvxg62sh4r0ktpuc46pzjrm9qvyl8 -p osmo + `, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + bech32prefix, err := cmd.Flags().GetString(flagBech32Prefix) + if err != nil { + return err + } + + _, bz, err := bech32.DecodeAndConvert(args[0]) + if err != nil { + return err + } + + bech32Addr, err := bech32.ConvertAndEncode(bech32prefix, bz) + if err != nil { + panic(err) + } + + cmd.Println(bech32Addr) + + return nil + }, + } + + cmd.Flags().StringP(flagBech32Prefix, "p", "terp", "Bech32 Prefix to encode to") + + return cmd +} + +// getPubKeyFromString decodes SDK PubKey using JSON marshaler. +func getPubKeyFromString(ctx client.Context, pkstr string) (cryptotypes.PubKey, error) { + var pk cryptotypes.PubKey + err := ctx.Codec.UnmarshalInterfaceJSON([]byte(pkstr), &pk) + return pk, err +} + +func PubkeyCmd() *cobra.Command { + return &cobra.Command{ + Use: "pubkey [pubkey]", + Short: "Decode a pubkey from proto JSON", + Long: fmt.Sprintf(`Decode a pubkey from proto JSON and display it's address. + +Example: +$ %s debug pubkey '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AurroA7jvfPd1AadmmOvWM2rJSwipXfRf8yD6pLbA2DJ"}' + `, version.AppName), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + pk, err := getPubKeyFromString(clientCtx, args[0]) + if err != nil { + return err + } + cmd.Println("Address:", pk.Address()) + cmd.Println("PubKey Hex:", hex.EncodeToString(pk.Bytes())) + return nil + }, + } +} + +func AddrCmd() *cobra.Command { + return &cobra.Command{ + Use: "addr [address]", + Short: "Convert an address between hex and bech32", + Long: fmt.Sprintf(`Convert an address between hex encoding and bech32. + +Example: +$ %s debug addr cosmos1e0jnq2sun3dzjh8p2xq95kk0expwmd7shwjpfg + `, version.AppName), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + addrString := args[0] + var addr []byte + + // try hex, then bech32 + var err error + addr, err = hex.DecodeString(addrString) + if err != nil { + var err2 error + addr, err2 = sdk.AccAddressFromBech32(addrString) + if err2 != nil { + var err3 error + addr, err3 = sdk.ValAddressFromBech32(addrString) + + if err3 != nil { + return fmt.Errorf("expected hex or bech32. Got errors: hex: %v, bech32 acc: %v, bech32 val: %v", err, err2, err3) + } + } + } + + cmd.Println("Address:", addr) + cmd.Printf("Address (hex): %X\n", addr) + cmd.Printf("Bech32 Acc: %s\n", sdk.AccAddress(addr)) + cmd.Printf("Bech32 Val: %s\n", sdk.ValAddress(addr)) + return nil + }, + } +} + +func RawBytesCmd() *cobra.Command { + return &cobra.Command{ + Use: "raw-bytes [raw-bytes]", + Short: "Convert raw bytes output (eg. [10 21 13 255]) to hex", + Long: fmt.Sprintf(`Convert raw-bytes to hex. + +Example: +$ %s debug raw-bytes [72 101 108 108 111 44 32 112 108 97 121 103 114 111 117 110 100] + `, version.AppName), + Args: cobra.ExactArgs(1), + RunE: func(_ *cobra.Command, args []string) error { + stringBytes := args[0] + stringBytes = strings.Trim(stringBytes, "[") + stringBytes = strings.Trim(stringBytes, "]") + spl := strings.Split(stringBytes, " ") + + byteArray := []byte{} + for _, s := range spl { + b, err := strconv.ParseInt(s, 10, 8) + if err != nil { + return err + } + byteArray = append(byteArray, byte(b)) + } + fmt.Printf("%X\n", byteArray) + return nil + }, + } +} diff --git a/cmd/terpd/cmd/genica.go b/cmd/terpd/cmd/genica.go index 3805ce0..fe60220 100644 --- a/cmd/terpd/cmd/genica.go +++ b/cmd/terpd/cmd/genica.go @@ -1,77 +1,77 @@ -package cmd - -import ( - "encoding/json" - "fmt" - - "github.com/spf13/cobra" - - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icagenesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" -) - -// AddGenesisAccountCmd returns add-genesis-account cobra Command. -func AddGenesisIcaCmd(defaultNodeHome string) *cobra.Command { - cmd := &cobra.Command{ - Use: "add-ica-config", - Short: "Add ICA config to genesis.json", - Long: `Add default ICA configuration to genesis.json`, - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - genFile := config.GenesisFile() - appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) - if err != nil { - return fmt.Errorf("failed to unmarshal genesis state: %w", err) - } - - controllerGenesisState := icagenesistypes.DefaultControllerGenesis() - // no params set in upgrade handler, no params set here - controllerGenesisState.Params = icacontrollertypes.Params{} - - hostGenesisState := icagenesistypes.DefaultHostGenesis() - // add the messages we want (from old upgrade handler) - hostGenesisState.Params = icahosttypes.Params{ - HostEnabled: true, - AllowMessages: []string{"*"}, - } - - newIcaGenState := icagenesistypes.NewGenesisState(controllerGenesisState, hostGenesisState) - - icaGenStateBz, err := clientCtx.Codec.MarshalJSON(newIcaGenState) - if err != nil { - return fmt.Errorf("failed to marshal auth genesis state: %w", err) - } - - appState[icatypes.ModuleName] = icaGenStateBz - - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - - genDoc.AppState = appStateJSON - return genutil.ExportGenesisFile(genDoc, genFile) - }, - } - - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} +package cmd + +import ( + "encoding/json" + "fmt" + + "github.com/spf13/cobra" + + icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" + icagenesistypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/genesis/types" + icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/server" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" +) + +// AddGenesisAccountCmd returns add-genesis-account cobra Command. +func AddGenesisIcaCmd(defaultNodeHome string) *cobra.Command { + cmd := &cobra.Command{ + Use: "add-ica-config", + Short: "Add ICA config to genesis.json", + Long: `Add default ICA configuration to genesis.json`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + config.SetRoot(clientCtx.HomeDir) + + genFile := config.GenesisFile() + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) + if err != nil { + return fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + controllerGenesisState := icagenesistypes.DefaultControllerGenesis() + // no params set in upgrade handler, no params set here + controllerGenesisState.Params = icacontrollertypes.Params{} + + hostGenesisState := icagenesistypes.DefaultHostGenesis() + // add the messages we want (from old upgrade handler) + hostGenesisState.Params = icahosttypes.Params{ + HostEnabled: true, + AllowMessages: []string{"*"}, + } + + newIcaGenState := icagenesistypes.NewGenesisState(controllerGenesisState, hostGenesisState) + + icaGenStateBz, err := clientCtx.Codec.MarshalJSON(newIcaGenState) + if err != nil { + return fmt.Errorf("failed to marshal auth genesis state: %w", err) + } + + appState[icatypes.ModuleName] = icaGenStateBz + + appStateJSON, err := json.Marshal(appState) + if err != nil { + return fmt.Errorf("failed to marshal application genesis state: %w", err) + } + + genDoc.AppState = appStateJSON + return genutil.ExportGenesisFile(genDoc, genFile) + }, + } + + cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/cmd/terpd/cmd/resets.go b/cmd/terpd/cmd/resets.go index 40d6c18..314f531 100644 --- a/cmd/terpd/cmd/resets.go +++ b/cmd/terpd/cmd/resets.go @@ -1,94 +1,94 @@ -package cmd - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/spf13/cobra" - - tmos "github.com/cometbft/cometbft/libs/os" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/server" -) - -// Cmd creates a main CLI command -func ResetCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "reset", - Short: "Reset commands for different parts of application state", - RunE: client.ValidateCmd, - } - - cmd.AddCommand(ResetWasmCmd) - cmd.AddCommand(ResetAppCmd) - - return cmd -} - -// ResetWasmCmd removes the database of the specified Tendermint core instance. -var ResetWasmCmd = &cobra.Command{ - Use: "wasm", - Short: "Reset WASM files", - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - return resetWasm(config.DBDir()) - }, -} - -// ResetAppCmd removes the database of the specified Tendermint core instance. -var ResetAppCmd = &cobra.Command{ - Use: "app", - Short: "Reset App files", - RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx := client.GetClientContextFromCmd(cmd) - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - config.SetRoot(clientCtx.HomeDir) - - return resetApp(config.DBDir()) - }, -} - -// resetWasm removes wasm files -func resetWasm(dbDir string) error { - wasmDir := filepath.Join(dbDir, "wasm") - - if tmos.FileExists(wasmDir) { - if err := os.RemoveAll(wasmDir); err == nil { - fmt.Println("Removed wasm", "dir", wasmDir) - } else { - return fmt.Errorf("error removing wasm dir: %s; err: %w", wasmDir, err) - } - } - - if err := tmos.EnsureDir(wasmDir, 0o700); err != nil { - return fmt.Errorf("unable to recreate wasm %w", err) - } - return nil -} - -// resetApp removes application.db files -func resetApp(dbDir string) error { - appDir := filepath.Join(dbDir, "application.db") - - if tmos.FileExists(appDir) { - if err := os.RemoveAll(appDir); err == nil { - fmt.Println("Removed application.db", "dir", appDir) - } else { - return fmt.Errorf("error removing application.db dir: %s; err: %w", appDir, err) - } - } - - if err := tmos.EnsureDir(appDir, 0o700); err != nil { - return fmt.Errorf("unable to recreate application.db %w", err) - } - return nil -} +package cmd + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/spf13/cobra" + + tmos "github.com/cometbft/cometbft/libs/os" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/server" +) + +// Cmd creates a main CLI command +func ResetCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "reset", + Short: "Reset commands for different parts of application state", + RunE: client.ValidateCmd, + } + + cmd.AddCommand(ResetWasmCmd) + cmd.AddCommand(ResetAppCmd) + + return cmd +} + +// ResetWasmCmd removes the database of the specified Tendermint core instance. +var ResetWasmCmd = &cobra.Command{ + Use: "wasm", + Short: "Reset WASM files", + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + config.SetRoot(clientCtx.HomeDir) + + return resetWasm(config.DBDir()) + }, +} + +// ResetAppCmd removes the database of the specified Tendermint core instance. +var ResetAppCmd = &cobra.Command{ + Use: "app", + Short: "Reset App files", + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx := client.GetClientContextFromCmd(cmd) + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + config.SetRoot(clientCtx.HomeDir) + + return resetApp(config.DBDir()) + }, +} + +// resetWasm removes wasm files +func resetWasm(dbDir string) error { + wasmDir := filepath.Join(dbDir, "wasm") + + if tmos.FileExists(wasmDir) { + if err := os.RemoveAll(wasmDir); err == nil { + fmt.Println("Removed wasm", "dir", wasmDir) + } else { + return fmt.Errorf("error removing wasm dir: %s; err: %w", wasmDir, err) + } + } + + if err := tmos.EnsureDir(wasmDir, 0o700); err != nil { + return fmt.Errorf("unable to recreate wasm %w", err) + } + return nil +} + +// resetApp removes application.db files +func resetApp(dbDir string) error { + appDir := filepath.Join(dbDir, "application.db") + + if tmos.FileExists(appDir) { + if err := os.RemoveAll(appDir); err == nil { + fmt.Println("Removed application.db", "dir", appDir) + } else { + return fmt.Errorf("error removing application.db dir: %s; err: %w", appDir, err) + } + } + + if err := tmos.EnsureDir(appDir, 0o700); err != nil { + return fmt.Errorf("unable to recreate application.db %w", err) + } + return nil +} diff --git a/cmd/terpd/cmd/root.go b/cmd/terpd/cmd/root.go index 67c5bc3..0735e58 100644 --- a/cmd/terpd/cmd/root.go +++ b/cmd/terpd/cmd/root.go @@ -1,378 +1,378 @@ -package cmd - -import ( - "errors" - "io" - "os" - "path/filepath" - - "github.com/CosmWasm/wasmd/x/wasm" - wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli" - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/prometheus/client_golang/prometheus" - "github.com/spf13/cast" - "github.com/spf13/cobra" - "github.com/spf13/viper" - - dbm "github.com/cometbft/cometbft-db" - tmcfg "github.com/cometbft/cometbft/config" - tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cometbft/cometbft/libs/log" - - rosettaCmd "cosmossdk.io/tools/rosetta/cmd" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/config" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/keys" - "github.com/cosmos/cosmos-sdk/client/pruning" - "github.com/cosmos/cosmos-sdk/client/rpc" - "github.com/cosmos/cosmos-sdk/server" - serverconfig "github.com/cosmos/cosmos-sdk/server/config" - servertypes "github.com/cosmos/cosmos-sdk/server/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/version" - authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/crisis" - genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - - "github.com/terpnetwork/terp-core/app" - "github.com/terpnetwork/terp-core/app/params" -) - -// NewRootCmd creates a new root command for terpd. It is called once in the -// main function. -func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - encodingConfig := app.MakeEncodingConfig() - - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) - cfg.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub) - cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) - cfg.SetAddressVerifier(wasmtypes.VerifyAddressLen()) - cfg.Seal() - - initClientCtx := client.Context{}. - WithCodec(encodingConfig.Marshaler). - WithInterfaceRegistry(encodingConfig.InterfaceRegistry). - WithTxConfig(encodingConfig.TxConfig). - WithLegacyAmino(encodingConfig.Amino). - WithInput(os.Stdin). - WithAccountRetriever(authtypes.AccountRetriever{}). - WithBroadcastMode(flags.FlagBroadcastMode). - WithHomeDir(app.DefaultNodeHome). - WithViper("") // In terpd, we don't use any prefix for env variables. - - // Allows you to add extra params to your client.toml - // gas, gas-price, gas-adjustment, fees, note, etc. - SetCustomEnvVariablesFromClientToml(initClientCtx) - - rootCmd := &cobra.Command{ - Use: version.AppName, - Short: "Terp Network Community Network", - PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - // set the default command outputs - cmd.SetOut(cmd.OutOrStdout()) - cmd.SetErr(cmd.ErrOrStderr()) - - initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) - if err != nil { - return err - } - - initClientCtx, err = config.ReadFromClientConfig(initClientCtx) - if err != nil { - return err - } - - if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { - return err - } - - customAppTemplate, customAppConfig := initAppConfig() - customTMConfig := initTendermintConfig() - - return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig) - }, - } - - initRootCmd(rootCmd, encodingConfig) - - return rootCmd, encodingConfig -} - -// initTendermintConfig helps to override default Tendermint Config values. -// return tmcfg.DefaultConfig if no custom configuration is required for the application. -func initTendermintConfig() *tmcfg.Config { - cfg := tmcfg.DefaultConfig() - - // these values put a higher strain on node memory - // cfg.P2P.MaxNumInboundPeers = 100 - // cfg.P2P.MaxNumOutboundPeers = 40 - - return cfg -} - -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - // The following code snippet is just for reference. - - type CustomAppConfig struct { - serverconfig.Config - - Wasm wasmtypes.WasmConfig `mapstructure:"wasm"` - } - - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - // The SDK's default minimum gas price is set to "" (empty value) inside - // app.toml. If left empty by validators, the node will halt on startup. - // However, the chain developer can set a default app.toml value for their - // validators here. - // - // In summary: - // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their - // own app.toml config, - // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their - // own app.toml to override, or use this default value. - // - // In simapp, we set the min gas prices to 0. - srvCfg.MinGasPrices = "0stake" - // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default - - customAppConfig := CustomAppConfig{ - Config: *srvCfg, - Wasm: wasmtypes.DefaultWasmConfig(), - } - - customAppTemplate := serverconfig.DefaultConfigTemplate + - wasmtypes.DefaultConfigTemplate() - - return customAppTemplate, customAppConfig -} - -// Reads the custom extra values in the config.toml file if set. -// If they are, then use them. -func SetCustomEnvVariablesFromClientToml(ctx client.Context) { - configFilePath := filepath.Join(ctx.HomeDir, "config", "client.toml") - - if _, err := os.Stat(configFilePath); os.IsNotExist(err) { - return - } - - viper := ctx.Viper - viper.SetConfigFile(configFilePath) - - if err := viper.ReadInConfig(); err != nil { - panic(err) - } - - setEnvFromConfig := func(key string, envVar string) { - // if the user sets the env key manually, then we don't want to override it - if os.Getenv(envVar) != "" { - return - } - - // reads from the config file - val := viper.GetString(key) - if val != "" { - // Sets the env for this instance of the app only. - os.Setenv(envVar, val) - } - } - - // gas - setEnvFromConfig("gas", "TERPD_GAS") - setEnvFromConfig("gas-prices", "TERPD_GAS_PRICES") - setEnvFromConfig("gas-adjustment", "TERPD_GAS_ADJUSTMENT") - // fees - setEnvFromConfig("fees", "TERPD_FEES") - setEnvFromConfig("fee-account", "TERPD_FEE_ACCOUNT") - // memo - setEnvFromConfig("note", "TERPD_NOTE") -} - -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { - ac := appCreator{ - encCfg: encodingConfig, - } - - rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), - AddGenesisIcaCmd(app.DefaultNodeHome), - tmcli.NewCompletionCmd(rootCmd, true), - DebugCmd(), - ConfigCmd(), - pruning.PruningCmd(ac.newApp), - ) - - server.AddCommands(rootCmd, app.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags) - wasmcli.ExtendUnsafeResetAllCmd(rootCmd) - - // add keybase, auxiliary RPC, query, and tx child commands - rootCmd.AddCommand( - rpc.StatusCommand(), - genesisCommand(encodingConfig), - queryCommand(), - txCommand(), - keys.Commands(app.DefaultNodeHome), - ) - // add rosetta - rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) -} - -func addModuleInitFlags(startCmd *cobra.Command) { - crisis.AddModuleInitFlags(startCmd) - wasm.AddModuleInitFlags(startCmd) -} - -// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { - cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome) - - for _, subCmd := range cmds { - cmd.AddCommand(subCmd) - } - return cmd -} - -func queryCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "query", - Aliases: []string{"q"}, - Short: "Querying subcommands", - DisableFlagParsing: false, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetAccountCmd(), - rpc.ValidatorCommand(), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(), - authcmd.QueryTxCmd(), - ) - - app.ModuleBasics.AddQueryCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -func txCommand() *cobra.Command { - cmd := &cobra.Command{ - Use: "tx", - Short: "Transactions subcommands", - DisableFlagParsing: false, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - authcmd.GetSignCommand(), - authcmd.GetSignBatchCommand(), - authcmd.GetMultiSignCommand(), - authcmd.GetMultiSignBatchCmd(), - authcmd.GetValidateSignaturesCommand(), - flags.LineBreak, - authcmd.GetBroadcastCommand(), - authcmd.GetEncodeCommand(), - authcmd.GetDecodeCommand(), - authcmd.GetAuxToFeeCommand(), - ) - - app.ModuleBasics.AddTxCommands(cmd) - cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") - - return cmd -} - -type appCreator struct { - encCfg params.EncodingConfig -} - -// newApp creates the application -func (ac appCreator) newApp( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - appOpts servertypes.AppOptions, -) servertypes.Application { - skipUpgradeHeights := make(map[int64]bool) - for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { - skipUpgradeHeights[int64(h)] = true - } - - var wasmOpts []wasmkeeper.Option - if cast.ToBool(appOpts.Get("telemetry.enabled")) { - wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) - } - - loadLatest := true - - baseappOptions := server.DefaultBaseappOptions(appOpts) - - return app.NewTerpApp( - logger, - db, - traceStore, - loadLatest, - app.GetEnabledProposals(), - appOpts, - wasmOpts, - baseappOptions..., - ) -} - -// appExport creates a new wasm app (optionally at a given height) and exports state. -func (ac appCreator) appExport( - logger log.Logger, - db dbm.DB, - traceStore io.Writer, - height int64, - forZeroHeight bool, - jailAllowedAddrs []string, - appOpts servertypes.AppOptions, - modulesToExport []string, -) (servertypes.ExportedApp, error) { - var wasmApp *app.TerpApp - homePath, ok := appOpts.Get(flags.FlagHome).(string) - if !ok || homePath == "" { - return servertypes.ExportedApp{}, errors.New("application home is not set") - } - - viperAppOpts, ok := appOpts.(*viper.Viper) - if !ok { - return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") - } - - // overwrite the FlagInvCheckPeriod - viperAppOpts.Set(server.FlagInvCheckPeriod, 1) - appOpts = viperAppOpts - - var emptyWasmOpts []wasmkeeper.Option - wasmApp = app.NewTerpApp( - logger, - db, - traceStore, - height == -1, - app.GetEnabledProposals(), - appOpts, - emptyWasmOpts, - ) - - if height != -1 { - if err := wasmApp.LoadHeight(height); err != nil { - return servertypes.ExportedApp{}, err - } - } - - return wasmApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) -} +package cmd + +import ( + "errors" + "io" + "os" + "path/filepath" + + "github.com/CosmWasm/wasmd/x/wasm" + wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/prometheus/client_golang/prometheus" + "github.com/spf13/cast" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + dbm "github.com/cometbft/cometbft-db" + tmcfg "github.com/cometbft/cometbft/config" + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cometbft/cometbft/libs/log" + + rosettaCmd "cosmossdk.io/tools/rosetta/cmd" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/config" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/server" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/version" + authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + + "github.com/terpnetwork/terp-core/v2/app" + "github.com/terpnetwork/terp-core/v2/app/params" +) + +// NewRootCmd creates a new root command for terpd. It is called once in the +// main function. +func NewRootCmd() (*cobra.Command, params.EncodingConfig) { + encodingConfig := app.MakeEncodingConfig() + + cfg := sdk.GetConfig() + cfg.SetBech32PrefixForAccount(app.Bech32PrefixAccAddr, app.Bech32PrefixAccPub) + cfg.SetBech32PrefixForValidator(app.Bech32PrefixValAddr, app.Bech32PrefixValPub) + cfg.SetBech32PrefixForConsensusNode(app.Bech32PrefixConsAddr, app.Bech32PrefixConsPub) + cfg.SetAddressVerifier(wasmtypes.VerifyAddressLen()) + cfg.Seal() + + initClientCtx := client.Context{}. + WithCodec(encodingConfig.Marshaler). + WithInterfaceRegistry(encodingConfig.InterfaceRegistry). + WithTxConfig(encodingConfig.TxConfig). + WithLegacyAmino(encodingConfig.Amino). + WithInput(os.Stdin). + WithAccountRetriever(authtypes.AccountRetriever{}). + WithBroadcastMode(flags.FlagBroadcastMode). + WithHomeDir(app.DefaultNodeHome). + WithViper("") // In terpd, we don't use any prefix for env variables. + + // Allows you to add extra params to your client.toml + // gas, gas-price, gas-adjustment, fees, note, etc. + SetCustomEnvVariablesFromClientToml(initClientCtx) + + rootCmd := &cobra.Command{ + Use: version.AppName, + Short: "Terp Network Community Network", + PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { + // set the default command outputs + cmd.SetOut(cmd.OutOrStdout()) + cmd.SetErr(cmd.ErrOrStderr()) + + initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) + if err != nil { + return err + } + + initClientCtx, err = config.ReadFromClientConfig(initClientCtx) + if err != nil { + return err + } + + if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { + return err + } + + customAppTemplate, customAppConfig := initAppConfig() + customTMConfig := initTendermintConfig() + + return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customTMConfig) + }, + } + + initRootCmd(rootCmd, encodingConfig) + + return rootCmd, encodingConfig +} + +// initTendermintConfig helps to override default Tendermint Config values. +// return tmcfg.DefaultConfig if no custom configuration is required for the application. +func initTendermintConfig() *tmcfg.Config { + cfg := tmcfg.DefaultConfig() + + // these values put a higher strain on node memory + // cfg.P2P.MaxNumInboundPeers = 100 + // cfg.P2P.MaxNumOutboundPeers = 40 + + return cfg +} + +// initAppConfig helps to override default appConfig template and configs. +// return "", nil if no custom configuration is required for the application. +func initAppConfig() (string, interface{}) { + // The following code snippet is just for reference. + + type CustomAppConfig struct { + serverconfig.Config + + Wasm wasmtypes.WasmConfig `mapstructure:"wasm"` + } + + // Optionally allow the chain developer to overwrite the SDK's default + // server config. + srvCfg := serverconfig.DefaultConfig() + // The SDK's default minimum gas price is set to "" (empty value) inside + // app.toml. If left empty by validators, the node will halt on startup. + // However, the chain developer can set a default app.toml value for their + // validators here. + // + // In summary: + // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their + // own app.toml config, + // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their + // own app.toml to override, or use this default value. + // + // In simapp, we set the min gas prices to 0. + srvCfg.MinGasPrices = "0stake" + // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default + + customAppConfig := CustomAppConfig{ + Config: *srvCfg, + Wasm: wasmtypes.DefaultWasmConfig(), + } + + customAppTemplate := serverconfig.DefaultConfigTemplate + + wasmtypes.DefaultConfigTemplate() + + return customAppTemplate, customAppConfig +} + +// Reads the custom extra values in the config.toml file if set. +// If they are, then use them. +func SetCustomEnvVariablesFromClientToml(ctx client.Context) { + configFilePath := filepath.Join(ctx.HomeDir, "config", "client.toml") + + if _, err := os.Stat(configFilePath); os.IsNotExist(err) { + return + } + + viper := ctx.Viper + viper.SetConfigFile(configFilePath) + + if err := viper.ReadInConfig(); err != nil { + panic(err) + } + + setEnvFromConfig := func(key string, envVar string) { + // if the user sets the env key manually, then we don't want to override it + if os.Getenv(envVar) != "" { + return + } + + // reads from the config file + val := viper.GetString(key) + if val != "" { + // Sets the env for this instance of the app only. + os.Setenv(envVar, val) + } + } + + // gas + setEnvFromConfig("gas", "TERPD_GAS") + setEnvFromConfig("gas-prices", "TERPD_GAS_PRICES") + setEnvFromConfig("gas-adjustment", "TERPD_GAS_ADJUSTMENT") + // fees + setEnvFromConfig("fees", "TERPD_FEES") + setEnvFromConfig("fee-account", "TERPD_FEE_ACCOUNT") + // memo + setEnvFromConfig("note", "TERPD_NOTE") +} + +func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { + ac := appCreator{ + encCfg: encodingConfig, + } + + rootCmd.AddCommand( + genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), + NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), + AddGenesisIcaCmd(app.DefaultNodeHome), + tmcli.NewCompletionCmd(rootCmd, true), + DebugCmd(), + ConfigCmd(), + pruning.PruningCmd(ac.newApp), + ) + + server.AddCommands(rootCmd, app.DefaultNodeHome, ac.newApp, ac.appExport, addModuleInitFlags) + wasmcli.ExtendUnsafeResetAllCmd(rootCmd) + + // add keybase, auxiliary RPC, query, and tx child commands + rootCmd.AddCommand( + rpc.StatusCommand(), + genesisCommand(encodingConfig), + queryCommand(), + txCommand(), + keys.Commands(app.DefaultNodeHome), + ) + // add rosetta + rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) +} + +func addModuleInitFlags(startCmd *cobra.Command) { + crisis.AddModuleInitFlags(startCmd) + wasm.AddModuleInitFlags(startCmd) +} + +// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + +func queryCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "query", + Aliases: []string{"q"}, + Short: "Querying subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetAccountCmd(), + rpc.ValidatorCommand(), + rpc.BlockCommand(), + authcmd.QueryTxsByEventsCmd(), + authcmd.QueryTxCmd(), + ) + + app.ModuleBasics.AddQueryCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +func txCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "tx", + Short: "Transactions subcommands", + DisableFlagParsing: false, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand( + authcmd.GetSignCommand(), + authcmd.GetSignBatchCommand(), + authcmd.GetMultiSignCommand(), + authcmd.GetMultiSignBatchCmd(), + authcmd.GetValidateSignaturesCommand(), + flags.LineBreak, + authcmd.GetBroadcastCommand(), + authcmd.GetEncodeCommand(), + authcmd.GetDecodeCommand(), + authcmd.GetAuxToFeeCommand(), + ) + + app.ModuleBasics.AddTxCommands(cmd) + cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") + + return cmd +} + +type appCreator struct { + encCfg params.EncodingConfig +} + +// newApp creates the application +func (ac appCreator) newApp( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + appOpts servertypes.AppOptions, +) servertypes.Application { + skipUpgradeHeights := make(map[int64]bool) + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + + var wasmOpts []wasmkeeper.Option + if cast.ToBool(appOpts.Get("telemetry.enabled")) { + wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) + } + + loadLatest := true + + baseappOptions := server.DefaultBaseappOptions(appOpts) + + return app.NewTerpApp( + logger, + db, + traceStore, + loadLatest, + app.GetEnabledProposals(), + appOpts, + wasmOpts, + baseappOptions..., + ) +} + +// appExport creates a new wasm app (optionally at a given height) and exports state. +func (ac appCreator) appExport( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { + var wasmApp *app.TerpApp + homePath, ok := appOpts.Get(flags.FlagHome).(string) + if !ok || homePath == "" { + return servertypes.ExportedApp{}, errors.New("application home is not set") + } + + viperAppOpts, ok := appOpts.(*viper.Viper) + if !ok { + return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") + } + + // overwrite the FlagInvCheckPeriod + viperAppOpts.Set(server.FlagInvCheckPeriod, 1) + appOpts = viperAppOpts + + var emptyWasmOpts []wasmkeeper.Option + wasmApp = app.NewTerpApp( + logger, + db, + traceStore, + height == -1, + app.GetEnabledProposals(), + appOpts, + emptyWasmOpts, + ) + + if height != -1 { + if err := wasmApp.LoadHeight(height); err != nil { + return servertypes.ExportedApp{}, err + } + } + + return wasmApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +} diff --git a/cmd/terpd/cmd/testnet.go b/cmd/terpd/cmd/testnet.go index 54e236c..69c1c2d 100644 --- a/cmd/terpd/cmd/testnet.go +++ b/cmd/terpd/cmd/testnet.go @@ -1,579 +1,579 @@ -package cmd - -// DONTCOVER - -import ( - "bufio" - "encoding/json" - "fmt" - "net" - "os" - "path/filepath" - "time" - - "github.com/CosmWasm/wasmd/app" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - - tmconfig "github.com/cometbft/cometbft/config" - tmrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cometbft/cometbft/types" - tmtime "github.com/cometbft/cometbft/types/time" - - "cosmossdk.io/math" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/server" - srvconfig "github.com/cosmos/cosmos-sdk/server/config" - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/network" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/version" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -var ( - flagNodeDirPrefix = "node-dir-prefix" - flagNumValidators = "v" - flagOutputDir = "output-dir" - flagNodeDaemonHome = "node-daemon-home" - flagStartingIPAddress = "starting-ip-address" - flagEnableLogging = "enable-logging" - flagGRPCAddress = "grpc.address" - flagRPCAddress = "rpc.address" - flagAPIAddress = "api.address" - flagPrintMnemonic = "print-mnemonic" - // custom flags - flagCommitTimeout = "commit-timeout" - flagSingleHost = "single-host" -) - -type initArgs struct { - algo string - chainID string - keyringBackend string - minGasPrices string - nodeDaemonHome string - nodeDirPrefix string - numValidators int - outputDir string - startingIPAddress string - singleMachine bool -} - -type startArgs struct { - algo string - apiAddress string - chainID string - enableLogging bool - grpcAddress string - minGasPrices string - numValidators int - outputDir string - printMnemonic bool - rpcAddress string -} - -func addTestnetFlagsToCmd(cmd *cobra.Command) { - cmd.Flags().Int(flagNumValidators, 4, "Number of validators to initialize the testnet with") - cmd.Flags().StringP(flagOutputDir, "o", "./.testnets", "Directory to store initialization data for the testnet") - cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") - cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)") - cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") - - // support old flags name for backwards compatibility - cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { - if name == "algo" { - name = flags.FlagKeyType - } - - return pflag.NormalizedName(name) - }) -} - -// NewTestnetCmd creates a root testnet command with subcommands to run an in-process testnet or initialize -// validator configuration files for running a multi-validator testnet in a separate process -func NewTestnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command { - testnetCmd := &cobra.Command{ - Use: "testnet", - Short: "subcommands for starting or configuring local testnets", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - testnetCmd.AddCommand(testnetStartCmd()) - testnetCmd.AddCommand(testnetInitFilesCmd(mbm, genBalIterator)) - - return testnetCmd -} - -// testnetInitFilesCmd returns a cmd to initialize all files for tendermint testnet and application -func testnetInitFilesCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command { - cmd := &cobra.Command{ - Use: "init-files", - Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)", - Long: fmt.Sprintf(`init-files will setup "v" number of directories and populate each with -necessary files (private validator, genesis, config, etc.) for running "v" validator nodes. - -Booting up a network with these validator folders is intended to be used with Docker Compose, -or a similar setup where each node has a manually configurable IP address. - -Note, strict routability for addresses is turned off in the config file. - -Example: - %s testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2 - `, version.AppName), - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - serverCtx := server.GetServerContextFromCmd(cmd) - config := serverCtx.Config - - args := initArgs{} - args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) - args.keyringBackend, _ = cmd.Flags().GetString(flags.FlagKeyringBackend) - args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) - args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) - args.nodeDirPrefix, _ = cmd.Flags().GetString(flagNodeDirPrefix) - args.nodeDaemonHome, _ = cmd.Flags().GetString(flagNodeDaemonHome) - args.startingIPAddress, _ = cmd.Flags().GetString(flagStartingIPAddress) - args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) - args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) - - args.singleMachine, _ = cmd.Flags().GetBool(flagSingleHost) - config.Consensus.TimeoutCommit, err = cmd.Flags().GetDuration(flagCommitTimeout) - if err != nil { - return err - } - - return initTestnetFiles(clientCtx, cmd, config, mbm, genBalIterator, args) - }, - } - - addTestnetFlagsToCmd(cmd) - cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)") - cmd.Flags().String(flagNodeDaemonHome, "terpd", "Home directory of the node's daemon configuration") - cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().Duration(flagCommitTimeout, 5*time.Second, "Time to wait after a block commit before starting on the new height") - cmd.Flags().Bool(flagSingleHost, false, "Cluster runs on a single host machine with different ports") - - return cmd -} - -// testnetStartCmd returns a cmd to start multi validator in-process testnet -func testnetStartCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "start", - Short: "Launch an in-process multi-validator testnet", - Long: fmt.Sprintf(`testnet will launch an in-process multi-validator testnet, -and generate "v" directories, populated with necessary validator configuration files -(private validator, genesis, config, etc.). - -Example: - %s testnet --v 4 --output-dir ./.testnets - `, version.AppName), - RunE: func(cmd *cobra.Command, _ []string) error { - args := startArgs{} - args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) - args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) - args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) - args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) - args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) - args.enableLogging, _ = cmd.Flags().GetBool(flagEnableLogging) - args.rpcAddress, _ = cmd.Flags().GetString(flagRPCAddress) - args.apiAddress, _ = cmd.Flags().GetString(flagAPIAddress) - args.grpcAddress, _ = cmd.Flags().GetString(flagGRPCAddress) - args.printMnemonic, _ = cmd.Flags().GetBool(flagPrintMnemonic) - - return startTestnet(cmd, args) - }, - } - - addTestnetFlagsToCmd(cmd) - cmd.Flags().Bool(flagEnableLogging, false, "Enable INFO logging of tendermint validator nodes") - cmd.Flags().String(flagRPCAddress, "tcp://0.0.0.0:26657", "the RPC address to listen on") - cmd.Flags().String(flagAPIAddress, "tcp://0.0.0.0:1317", "the address to listen on for REST API") - cmd.Flags().String(flagGRPCAddress, "0.0.0.0:9090", "the gRPC server address to listen on") - cmd.Flags().Bool(flagPrintMnemonic, true, "print mnemonic of first validator to stdout for manual testing") - return cmd -} - -const nodeDirPerm = 0o755 - -// initTestnetFiles initializes testnet files for a testnet to be run in a separate process -func initTestnetFiles( - clientCtx client.Context, - cmd *cobra.Command, - nodeConfig *tmconfig.Config, - mbm module.BasicManager, - genBalIterator banktypes.GenesisBalancesIterator, - args initArgs, -) error { - if args.chainID == "" { - args.chainID = "chain-" + tmrand.Str(6) - } - nodeIDs := make([]string, args.numValidators) - valPubKeys := make([]cryptotypes.PubKey, args.numValidators) - - appConfig := srvconfig.DefaultConfig() - appConfig.MinGasPrices = args.minGasPrices - appConfig.API.Enable = true - appConfig.Telemetry.Enabled = true - appConfig.Telemetry.PrometheusRetentionTime = 60 - appConfig.Telemetry.EnableHostnameLabel = false - appConfig.Telemetry.GlobalLabels = [][]string{{"chain_id", args.chainID}} - - var ( - genAccounts []authtypes.GenesisAccount - genBalances []banktypes.Balance - genFiles []string - ) - const ( - rpcPort = 26657 - apiPort = 1317 - grpcPort = 9090 - grpcWebPort = 8090 - ) - p2pPortStart := 26656 - - inBuf := bufio.NewReader(cmd.InOrStdin()) - // generate private keys, node IDs, and initial transactions - for i := 0; i < args.numValidators; i++ { - var portOffset int - if args.singleMachine { - portOffset = i - p2pPortStart = 16656 // use different start point to not conflict with rpc port - nodeConfig.P2P.AddrBookStrict = false - nodeConfig.P2P.PexReactor = false - nodeConfig.P2P.AllowDuplicateIP = true - } - - nodeDirName := fmt.Sprintf("%s%d", args.nodeDirPrefix, i) - nodeDir := filepath.Join(args.outputDir, nodeDirName, args.nodeDaemonHome) - gentxsDir := filepath.Join(args.outputDir, "gentxs") - - nodeConfig.SetRoot(nodeDir) - nodeConfig.Moniker = nodeDirName - nodeConfig.RPC.ListenAddress = "tcp://0.0.0.0:26657" - - appConfig.API.Address = fmt.Sprintf("tcp://0.0.0.0:%d", apiPort+portOffset) - appConfig.GRPC.Address = fmt.Sprintf("0.0.0.0:%d", grpcPort+portOffset) - appConfig.GRPCWeb.Address = fmt.Sprintf("0.0.0.0:%d", grpcWebPort+portOffset) - - if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil { - _ = os.RemoveAll(args.outputDir) - return err - } - - ip, err := getIP(i, args.startingIPAddress) - if err != nil { - _ = os.RemoveAll(args.outputDir) - return err - } - - nodeIDs[i], valPubKeys[i], err = genutil.InitializeNodeValidatorFiles(nodeConfig) - if err != nil { - _ = os.RemoveAll(args.outputDir) - return err - } - - memo := fmt.Sprintf("%s@%s:%d", nodeIDs[i], ip, p2pPortStart+portOffset) - genFiles = append(genFiles, nodeConfig.GenesisFile()) - - kb, err := keyring.New(sdk.KeyringServiceName(), args.keyringBackend, nodeDir, inBuf, clientCtx.Codec) - if err != nil { - return err - } - - keyringAlgos, _ := kb.SupportedAlgorithms() - algo, err := keyring.NewSigningAlgoFromString(args.algo, keyringAlgos) - if err != nil { - return err - } - - addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo) - if err != nil { - _ = os.RemoveAll(args.outputDir) - return err - } - - info := map[string]string{"secret": secret} - - cliPrint, err := json.Marshal(info) - if err != nil { - return err - } - - // save private key seed words - if err := writeFile(fmt.Sprintf("%v.json", "key_seed"), nodeDir, cliPrint); err != nil { - return err - } - - accTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction) - accStakingTokens := sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction) - coins := sdk.Coins{ - sdk.NewCoin("testtoken", accTokens), - sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens), - } - - genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) - genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) - - valTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) - createValMsg, err := stakingtypes.NewMsgCreateValidator( - sdk.ValAddress(addr), - valPubKeys[i], - sdk.NewCoin(sdk.DefaultBondDenom, valTokens), - stakingtypes.NewDescription(nodeDirName, "", "", "", ""), - stakingtypes.NewCommissionRates(math.LegacyOneDec(), math.LegacyOneDec(), math.LegacyOneDec()), - math.OneInt(), - ) - if err != nil { - return err - } - - txBuilder := clientCtx.TxConfig.NewTxBuilder() - if err := txBuilder.SetMsgs(createValMsg); err != nil { - return err - } - - txBuilder.SetMemo(memo) - - txFactory := tx.Factory{} - txFactory = txFactory. - WithChainID(args.chainID). - WithMemo(memo). - WithKeybase(kb). - WithTxConfig(clientCtx.TxConfig) - - if err := tx.Sign(txFactory, nodeDirName, txBuilder, true); err != nil { - return err - } - - txBz, err := clientCtx.TxConfig.TxJSONEncoder()(txBuilder.GetTx()) - if err != nil { - return err - } - - if err := writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBz); err != nil { - return err - } - - srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig) - } - - if err := initGenFiles(clientCtx, mbm, args.chainID, genAccounts, genBalances, genFiles, args.numValidators); err != nil { - return err - } - - err := collectGenFiles( - clientCtx, nodeConfig, args.chainID, nodeIDs, valPubKeys, args.numValidators, - args.outputDir, args.nodeDirPrefix, args.nodeDaemonHome, genBalIterator, - rpcPort, p2pPortStart, args.singleMachine, - ) - if err != nil { - return err - } - - cmd.PrintErrf("Successfully initialized %d node directories\n", args.numValidators) - return nil -} - -func initGenFiles( - clientCtx client.Context, mbm module.BasicManager, chainID string, - genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, - genFiles []string, numValidators int, -) error { - appGenState := mbm.DefaultGenesis(clientCtx.Codec) - - // set the accounts in the genesis state - var authGenState authtypes.GenesisState - clientCtx.Codec.MustUnmarshalJSON(appGenState[authtypes.ModuleName], &authGenState) - - accounts, err := authtypes.PackAccounts(genAccounts) - if err != nil { - return err - } - - authGenState.Accounts = accounts - appGenState[authtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&authGenState) - - // set the balances in the genesis state - var bankGenState banktypes.GenesisState - clientCtx.Codec.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState) - - bankGenState.Balances = banktypes.SanitizeGenesisBalances(genBalances) - for _, bal := range bankGenState.Balances { - bankGenState.Supply = bankGenState.Supply.Add(bal.Coins...) - } - appGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenState) - - appGenStateJSON, err := json.MarshalIndent(appGenState, "", " ") - if err != nil { - return err - } - - genDoc := types.GenesisDoc{ - ChainID: chainID, - AppState: appGenStateJSON, - Validators: nil, - } - - // generate empty genesis files for each validator and save - for i := 0; i < numValidators; i++ { - if err := genDoc.SaveAs(genFiles[i]); err != nil { - return err - } - } - return nil -} - -func collectGenFiles( - clientCtx client.Context, nodeConfig *tmconfig.Config, chainID string, - nodeIDs []string, valPubKeys []cryptotypes.PubKey, numValidators int, - outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator, - rpcPortStart, p2pPortStart int, - singleMachine bool, -) error { - var appState json.RawMessage - genTime := tmtime.Now() - - for i := 0; i < numValidators; i++ { - var portOffset int - if singleMachine { - portOffset = i - } - - nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i) - nodeDir := filepath.Join(outputDir, nodeDirName, nodeDaemonHome) - gentxsDir := filepath.Join(outputDir, "gentxs") - nodeConfig.Moniker = nodeDirName - nodeConfig.RPC.ListenAddress = fmt.Sprintf("tcp://0.0.0.0:%d", rpcPortStart+portOffset) - nodeConfig.P2P.ListenAddress = fmt.Sprintf("tcp://0.0.0.0:%d", p2pPortStart+portOffset) - - nodeConfig.SetRoot(nodeDir) - - nodeID, valPubKey := nodeIDs[i], valPubKeys[i] - initCfg := genutiltypes.NewInitConfig(chainID, gentxsDir, nodeID, valPubKey) - - genDoc, err := types.GenesisDocFromFile(nodeConfig.GenesisFile()) - if err != nil { - return err - } - - nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator, genutiltypes.DefaultMessageValidator) - if err != nil { - return err - } - - if appState == nil { - // set the canonical application state (they should not differ) - appState = nodeAppState - } - - genFile := nodeConfig.GenesisFile() - - // overwrite each validator's genesis file to have a canonical genesis time - if err := genutil.ExportGenesisFileWithTime(genFile, chainID, nil, appState, genTime); err != nil { - return err - } - } - - return nil -} - -func getIP(i int, startingIPAddr string) (ip string, err error) { - if len(startingIPAddr) == 0 { - ip, err = server.ExternalIP() - if err != nil { - return "", err - } - return ip, nil - } - return calculateIP(startingIPAddr, i) -} - -func calculateIP(ip string, i int) (string, error) { - ipv4 := net.ParseIP(ip).To4() - if ipv4 == nil { - return "", fmt.Errorf("%v: non ipv4 address", ip) - } - - for j := 0; j < i; j++ { - ipv4[3]++ - } - - return ipv4.String(), nil -} - -func writeFile(name string, dir string, contents []byte) error { - file := filepath.Join(dir, name) - - if err := os.MkdirAll(dir, 0o755); err != nil { - return fmt.Errorf("could not create directory %q: %w", dir, err) - } - - if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec - return err - } - - return nil -} - -// startTestnet starts an in-process testnet -func startTestnet(cmd *cobra.Command, args startArgs) error { - networkConfig := network.DefaultConfig(app.NewTestNetworkFixture) - - // Default networkConfig.ChainID is random, and we should only override it if chainID provided - // is non-empty - if args.chainID != "" { - networkConfig.ChainID = args.chainID - } - networkConfig.SigningAlgo = args.algo - networkConfig.MinGasPrices = args.minGasPrices - networkConfig.NumValidators = args.numValidators - networkConfig.EnableTMLogging = args.enableLogging - networkConfig.RPCAddress = args.rpcAddress - networkConfig.APIAddress = args.apiAddress - networkConfig.GRPCAddress = args.grpcAddress - networkConfig.PrintMnemonic = args.printMnemonic - networkLogger := network.NewCLILogger(cmd) - - baseDir := fmt.Sprintf("%s/%s", args.outputDir, networkConfig.ChainID) - if _, err := os.Stat(baseDir); !os.IsNotExist(err) { - return fmt.Errorf( - "testnests directory already exists for chain-id '%s': %s, please remove or select a new --chain-id", - networkConfig.ChainID, baseDir) - } - - testnet, err := network.New(networkLogger, baseDir, networkConfig) - if err != nil { - return err - } - - if _, err := testnet.WaitForHeight(1); err != nil { - return err - } - cmd.Println("press the Enter Key to terminate") - if _, err := fmt.Scanln(); err != nil { // wait for Enter Key - return err - } - testnet.Cleanup() - - return nil -} +package cmd + +// DONTCOVER + +import ( + "bufio" + "encoding/json" + "fmt" + "net" + "os" + "path/filepath" + "time" + + "github.com/CosmWasm/wasmd/app" + "github.com/spf13/cobra" + "github.com/spf13/pflag" + + tmconfig "github.com/cometbft/cometbft/config" + tmrand "github.com/cometbft/cometbft/libs/rand" + "github.com/cometbft/cometbft/types" + tmtime "github.com/cometbft/cometbft/types/time" + + "cosmossdk.io/math" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + "github.com/cosmos/cosmos-sdk/server" + srvconfig "github.com/cosmos/cosmos-sdk/server/config" + "github.com/cosmos/cosmos-sdk/testutil" + "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/version" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +var ( + flagNodeDirPrefix = "node-dir-prefix" + flagNumValidators = "v" + flagOutputDir = "output-dir" + flagNodeDaemonHome = "node-daemon-home" + flagStartingIPAddress = "starting-ip-address" + flagEnableLogging = "enable-logging" + flagGRPCAddress = "grpc.address" + flagRPCAddress = "rpc.address" + flagAPIAddress = "api.address" + flagPrintMnemonic = "print-mnemonic" + // custom flags + flagCommitTimeout = "commit-timeout" + flagSingleHost = "single-host" +) + +type initArgs struct { + algo string + chainID string + keyringBackend string + minGasPrices string + nodeDaemonHome string + nodeDirPrefix string + numValidators int + outputDir string + startingIPAddress string + singleMachine bool +} + +type startArgs struct { + algo string + apiAddress string + chainID string + enableLogging bool + grpcAddress string + minGasPrices string + numValidators int + outputDir string + printMnemonic bool + rpcAddress string +} + +func addTestnetFlagsToCmd(cmd *cobra.Command) { + cmd.Flags().Int(flagNumValidators, 4, "Number of validators to initialize the testnet with") + cmd.Flags().StringP(flagOutputDir, "o", "./.testnets", "Directory to store initialization data for the testnet") + cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") + cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)") + cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") + + // support old flags name for backwards compatibility + cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName { + if name == "algo" { + name = flags.FlagKeyType + } + + return pflag.NormalizedName(name) + }) +} + +// NewTestnetCmd creates a root testnet command with subcommands to run an in-process testnet or initialize +// validator configuration files for running a multi-validator testnet in a separate process +func NewTestnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command { + testnetCmd := &cobra.Command{ + Use: "testnet", + Short: "subcommands for starting or configuring local testnets", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + testnetCmd.AddCommand(testnetStartCmd()) + testnetCmd.AddCommand(testnetInitFilesCmd(mbm, genBalIterator)) + + return testnetCmd +} + +// testnetInitFilesCmd returns a cmd to initialize all files for tendermint testnet and application +func testnetInitFilesCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command { + cmd := &cobra.Command{ + Use: "init-files", + Short: "Initialize config directories & files for a multi-validator testnet running locally via separate processes (e.g. Docker Compose or similar)", + Long: fmt.Sprintf(`init-files will setup "v" number of directories and populate each with +necessary files (private validator, genesis, config, etc.) for running "v" validator nodes. + +Booting up a network with these validator folders is intended to be used with Docker Compose, +or a similar setup where each node has a manually configurable IP address. + +Note, strict routability for addresses is turned off in the config file. + +Example: + %s testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2 + `, version.AppName), + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + serverCtx := server.GetServerContextFromCmd(cmd) + config := serverCtx.Config + + args := initArgs{} + args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) + args.keyringBackend, _ = cmd.Flags().GetString(flags.FlagKeyringBackend) + args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) + args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) + args.nodeDirPrefix, _ = cmd.Flags().GetString(flagNodeDirPrefix) + args.nodeDaemonHome, _ = cmd.Flags().GetString(flagNodeDaemonHome) + args.startingIPAddress, _ = cmd.Flags().GetString(flagStartingIPAddress) + args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) + args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) + + args.singleMachine, _ = cmd.Flags().GetBool(flagSingleHost) + config.Consensus.TimeoutCommit, err = cmd.Flags().GetDuration(flagCommitTimeout) + if err != nil { + return err + } + + return initTestnetFiles(clientCtx, cmd, config, mbm, genBalIterator, args) + }, + } + + addTestnetFlagsToCmd(cmd) + cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)") + cmd.Flags().String(flagNodeDaemonHome, "terpd", "Home directory of the node's daemon configuration") + cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") + cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") + cmd.Flags().Duration(flagCommitTimeout, 5*time.Second, "Time to wait after a block commit before starting on the new height") + cmd.Flags().Bool(flagSingleHost, false, "Cluster runs on a single host machine with different ports") + + return cmd +} + +// testnetStartCmd returns a cmd to start multi validator in-process testnet +func testnetStartCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "start", + Short: "Launch an in-process multi-validator testnet", + Long: fmt.Sprintf(`testnet will launch an in-process multi-validator testnet, +and generate "v" directories, populated with necessary validator configuration files +(private validator, genesis, config, etc.). + +Example: + %s testnet --v 4 --output-dir ./.testnets + `, version.AppName), + RunE: func(cmd *cobra.Command, _ []string) error { + args := startArgs{} + args.outputDir, _ = cmd.Flags().GetString(flagOutputDir) + args.chainID, _ = cmd.Flags().GetString(flags.FlagChainID) + args.minGasPrices, _ = cmd.Flags().GetString(server.FlagMinGasPrices) + args.numValidators, _ = cmd.Flags().GetInt(flagNumValidators) + args.algo, _ = cmd.Flags().GetString(flags.FlagKeyType) + args.enableLogging, _ = cmd.Flags().GetBool(flagEnableLogging) + args.rpcAddress, _ = cmd.Flags().GetString(flagRPCAddress) + args.apiAddress, _ = cmd.Flags().GetString(flagAPIAddress) + args.grpcAddress, _ = cmd.Flags().GetString(flagGRPCAddress) + args.printMnemonic, _ = cmd.Flags().GetBool(flagPrintMnemonic) + + return startTestnet(cmd, args) + }, + } + + addTestnetFlagsToCmd(cmd) + cmd.Flags().Bool(flagEnableLogging, false, "Enable INFO logging of tendermint validator nodes") + cmd.Flags().String(flagRPCAddress, "tcp://0.0.0.0:26657", "the RPC address to listen on") + cmd.Flags().String(flagAPIAddress, "tcp://0.0.0.0:1317", "the address to listen on for REST API") + cmd.Flags().String(flagGRPCAddress, "0.0.0.0:9090", "the gRPC server address to listen on") + cmd.Flags().Bool(flagPrintMnemonic, true, "print mnemonic of first validator to stdout for manual testing") + return cmd +} + +const nodeDirPerm = 0o755 + +// initTestnetFiles initializes testnet files for a testnet to be run in a separate process +func initTestnetFiles( + clientCtx client.Context, + cmd *cobra.Command, + nodeConfig *tmconfig.Config, + mbm module.BasicManager, + genBalIterator banktypes.GenesisBalancesIterator, + args initArgs, +) error { + if args.chainID == "" { + args.chainID = "chain-" + tmrand.Str(6) + } + nodeIDs := make([]string, args.numValidators) + valPubKeys := make([]cryptotypes.PubKey, args.numValidators) + + appConfig := srvconfig.DefaultConfig() + appConfig.MinGasPrices = args.minGasPrices + appConfig.API.Enable = true + appConfig.Telemetry.Enabled = true + appConfig.Telemetry.PrometheusRetentionTime = 60 + appConfig.Telemetry.EnableHostnameLabel = false + appConfig.Telemetry.GlobalLabels = [][]string{{"chain_id", args.chainID}} + + var ( + genAccounts []authtypes.GenesisAccount + genBalances []banktypes.Balance + genFiles []string + ) + const ( + rpcPort = 26657 + apiPort = 1317 + grpcPort = 9090 + grpcWebPort = 8090 + ) + p2pPortStart := 26656 + + inBuf := bufio.NewReader(cmd.InOrStdin()) + // generate private keys, node IDs, and initial transactions + for i := 0; i < args.numValidators; i++ { + var portOffset int + if args.singleMachine { + portOffset = i + p2pPortStart = 16656 // use different start point to not conflict with rpc port + nodeConfig.P2P.AddrBookStrict = false + nodeConfig.P2P.PexReactor = false + nodeConfig.P2P.AllowDuplicateIP = true + } + + nodeDirName := fmt.Sprintf("%s%d", args.nodeDirPrefix, i) + nodeDir := filepath.Join(args.outputDir, nodeDirName, args.nodeDaemonHome) + gentxsDir := filepath.Join(args.outputDir, "gentxs") + + nodeConfig.SetRoot(nodeDir) + nodeConfig.Moniker = nodeDirName + nodeConfig.RPC.ListenAddress = "tcp://0.0.0.0:26657" + + appConfig.API.Address = fmt.Sprintf("tcp://0.0.0.0:%d", apiPort+portOffset) + appConfig.GRPC.Address = fmt.Sprintf("0.0.0.0:%d", grpcPort+portOffset) + appConfig.GRPCWeb.Address = fmt.Sprintf("0.0.0.0:%d", grpcWebPort+portOffset) + + if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + ip, err := getIP(i, args.startingIPAddress) + if err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + nodeIDs[i], valPubKeys[i], err = genutil.InitializeNodeValidatorFiles(nodeConfig) + if err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + memo := fmt.Sprintf("%s@%s:%d", nodeIDs[i], ip, p2pPortStart+portOffset) + genFiles = append(genFiles, nodeConfig.GenesisFile()) + + kb, err := keyring.New(sdk.KeyringServiceName(), args.keyringBackend, nodeDir, inBuf, clientCtx.Codec) + if err != nil { + return err + } + + keyringAlgos, _ := kb.SupportedAlgorithms() + algo, err := keyring.NewSigningAlgoFromString(args.algo, keyringAlgos) + if err != nil { + return err + } + + addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, "", true, algo) + if err != nil { + _ = os.RemoveAll(args.outputDir) + return err + } + + info := map[string]string{"secret": secret} + + cliPrint, err := json.Marshal(info) + if err != nil { + return err + } + + // save private key seed words + if err := writeFile(fmt.Sprintf("%v.json", "key_seed"), nodeDir, cliPrint); err != nil { + return err + } + + accTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction) + accStakingTokens := sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction) + coins := sdk.Coins{ + sdk.NewCoin("testtoken", accTokens), + sdk.NewCoin(sdk.DefaultBondDenom, accStakingTokens), + } + + genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) + genAccounts = append(genAccounts, authtypes.NewBaseAccount(addr, nil, 0, 0)) + + valTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) + createValMsg, err := stakingtypes.NewMsgCreateValidator( + sdk.ValAddress(addr), + valPubKeys[i], + sdk.NewCoin(sdk.DefaultBondDenom, valTokens), + stakingtypes.NewDescription(nodeDirName, "", "", "", ""), + stakingtypes.NewCommissionRates(math.LegacyOneDec(), math.LegacyOneDec(), math.LegacyOneDec()), + math.OneInt(), + ) + if err != nil { + return err + } + + txBuilder := clientCtx.TxConfig.NewTxBuilder() + if err := txBuilder.SetMsgs(createValMsg); err != nil { + return err + } + + txBuilder.SetMemo(memo) + + txFactory := tx.Factory{} + txFactory = txFactory. + WithChainID(args.chainID). + WithMemo(memo). + WithKeybase(kb). + WithTxConfig(clientCtx.TxConfig) + + if err := tx.Sign(txFactory, nodeDirName, txBuilder, true); err != nil { + return err + } + + txBz, err := clientCtx.TxConfig.TxJSONEncoder()(txBuilder.GetTx()) + if err != nil { + return err + } + + if err := writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBz); err != nil { + return err + } + + srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig) + } + + if err := initGenFiles(clientCtx, mbm, args.chainID, genAccounts, genBalances, genFiles, args.numValidators); err != nil { + return err + } + + err := collectGenFiles( + clientCtx, nodeConfig, args.chainID, nodeIDs, valPubKeys, args.numValidators, + args.outputDir, args.nodeDirPrefix, args.nodeDaemonHome, genBalIterator, + rpcPort, p2pPortStart, args.singleMachine, + ) + if err != nil { + return err + } + + cmd.PrintErrf("Successfully initialized %d node directories\n", args.numValidators) + return nil +} + +func initGenFiles( + clientCtx client.Context, mbm module.BasicManager, chainID string, + genAccounts []authtypes.GenesisAccount, genBalances []banktypes.Balance, + genFiles []string, numValidators int, +) error { + appGenState := mbm.DefaultGenesis(clientCtx.Codec) + + // set the accounts in the genesis state + var authGenState authtypes.GenesisState + clientCtx.Codec.MustUnmarshalJSON(appGenState[authtypes.ModuleName], &authGenState) + + accounts, err := authtypes.PackAccounts(genAccounts) + if err != nil { + return err + } + + authGenState.Accounts = accounts + appGenState[authtypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&authGenState) + + // set the balances in the genesis state + var bankGenState banktypes.GenesisState + clientCtx.Codec.MustUnmarshalJSON(appGenState[banktypes.ModuleName], &bankGenState) + + bankGenState.Balances = banktypes.SanitizeGenesisBalances(genBalances) + for _, bal := range bankGenState.Balances { + bankGenState.Supply = bankGenState.Supply.Add(bal.Coins...) + } + appGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenState) + + appGenStateJSON, err := json.MarshalIndent(appGenState, "", " ") + if err != nil { + return err + } + + genDoc := types.GenesisDoc{ + ChainID: chainID, + AppState: appGenStateJSON, + Validators: nil, + } + + // generate empty genesis files for each validator and save + for i := 0; i < numValidators; i++ { + if err := genDoc.SaveAs(genFiles[i]); err != nil { + return err + } + } + return nil +} + +func collectGenFiles( + clientCtx client.Context, nodeConfig *tmconfig.Config, chainID string, + nodeIDs []string, valPubKeys []cryptotypes.PubKey, numValidators int, + outputDir, nodeDirPrefix, nodeDaemonHome string, genBalIterator banktypes.GenesisBalancesIterator, + rpcPortStart, p2pPortStart int, + singleMachine bool, +) error { + var appState json.RawMessage + genTime := tmtime.Now() + + for i := 0; i < numValidators; i++ { + var portOffset int + if singleMachine { + portOffset = i + } + + nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i) + nodeDir := filepath.Join(outputDir, nodeDirName, nodeDaemonHome) + gentxsDir := filepath.Join(outputDir, "gentxs") + nodeConfig.Moniker = nodeDirName + nodeConfig.RPC.ListenAddress = fmt.Sprintf("tcp://0.0.0.0:%d", rpcPortStart+portOffset) + nodeConfig.P2P.ListenAddress = fmt.Sprintf("tcp://0.0.0.0:%d", p2pPortStart+portOffset) + + nodeConfig.SetRoot(nodeDir) + + nodeID, valPubKey := nodeIDs[i], valPubKeys[i] + initCfg := genutiltypes.NewInitConfig(chainID, gentxsDir, nodeID, valPubKey) + + genDoc, err := types.GenesisDocFromFile(nodeConfig.GenesisFile()) + if err != nil { + return err + } + + nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator, genutiltypes.DefaultMessageValidator) + if err != nil { + return err + } + + if appState == nil { + // set the canonical application state (they should not differ) + appState = nodeAppState + } + + genFile := nodeConfig.GenesisFile() + + // overwrite each validator's genesis file to have a canonical genesis time + if err := genutil.ExportGenesisFileWithTime(genFile, chainID, nil, appState, genTime); err != nil { + return err + } + } + + return nil +} + +func getIP(i int, startingIPAddr string) (ip string, err error) { + if len(startingIPAddr) == 0 { + ip, err = server.ExternalIP() + if err != nil { + return "", err + } + return ip, nil + } + return calculateIP(startingIPAddr, i) +} + +func calculateIP(ip string, i int) (string, error) { + ipv4 := net.ParseIP(ip).To4() + if ipv4 == nil { + return "", fmt.Errorf("%v: non ipv4 address", ip) + } + + for j := 0; j < i; j++ { + ipv4[3]++ + } + + return ipv4.String(), nil +} + +func writeFile(name string, dir string, contents []byte) error { + file := filepath.Join(dir, name) + + if err := os.MkdirAll(dir, 0o755); err != nil { + return fmt.Errorf("could not create directory %q: %w", dir, err) + } + + if err := os.WriteFile(file, contents, 0o644); err != nil { //nolint: gosec + return err + } + + return nil +} + +// startTestnet starts an in-process testnet +func startTestnet(cmd *cobra.Command, args startArgs) error { + networkConfig := network.DefaultConfig(app.NewTestNetworkFixture) + + // Default networkConfig.ChainID is random, and we should only override it if chainID provided + // is non-empty + if args.chainID != "" { + networkConfig.ChainID = args.chainID + } + networkConfig.SigningAlgo = args.algo + networkConfig.MinGasPrices = args.minGasPrices + networkConfig.NumValidators = args.numValidators + networkConfig.EnableTMLogging = args.enableLogging + networkConfig.RPCAddress = args.rpcAddress + networkConfig.APIAddress = args.apiAddress + networkConfig.GRPCAddress = args.grpcAddress + networkConfig.PrintMnemonic = args.printMnemonic + networkLogger := network.NewCLILogger(cmd) + + baseDir := fmt.Sprintf("%s/%s", args.outputDir, networkConfig.ChainID) + if _, err := os.Stat(baseDir); !os.IsNotExist(err) { + return fmt.Errorf( + "testnests directory already exists for chain-id '%s': %s, please remove or select a new --chain-id", + networkConfig.ChainID, baseDir) + } + + testnet, err := network.New(networkLogger, baseDir, networkConfig) + if err != nil { + return err + } + + if _, err := testnet.WaitForHeight(1); err != nil { + return err + } + cmd.Println("press the Enter Key to terminate") + if _, err := fmt.Scanln(); err != nil { // wait for Enter Key + return err + } + testnet.Cleanup() + + return nil +} diff --git a/cmd/terpd/main.go b/cmd/terpd/main.go index 05a0243..846d63b 100644 --- a/cmd/terpd/main.go +++ b/cmd/terpd/main.go @@ -7,11 +7,10 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" - "github.com/terpnetwork/terp-core/app" - "github.com/terpnetwork/terp-core/cmd/terpd/cmd" + "github.com/terpnetwork/terp-core/v2/app" + "github.com/terpnetwork/terp-core/v2/cmd/terpd/cmd" ) - func main() { app.SetAddressPrefixes() rootCmd, _ := cmd.NewRootCmd() diff --git a/contrib/devtools/DockerFile b/contrib/devtools/DockerFile new file mode 100644 index 0000000..a2d91ad --- /dev/null +++ b/contrib/devtools/DockerFile @@ -0,0 +1,36 @@ +## To test locally: +# docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools" +# docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh + +FROM bufbuild/buf:1.9.0 as BUILDER +FROM golang:1.20-alpine + +RUN apk add --no-cache \ + nodejs \ + npm \ + git \ + make \ + clang-extra-tools + +RUN npm install -g swagger-combine + +ARG UNAME=protobuild +ARG UID=1000 +RUN adduser -u $UID -s /bin/sh $UNAME -D +USER $UNAME + +ENV GOLANG_PROTOBUF_VERSION=1.28.1 \ + GRPC_GATEWAY_VERSION=1.16.0 + +RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest && \ + go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} && \ + go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} + +# install all gogo protobuf binaries +RUN git clone https://github.com/cosmos/gogoproto.git; \ + cd gogoproto; \ + go mod download; \ + make install + +COPY --from=BUILDER /usr/local/bin /usr/local/bin \ No newline at end of file diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index 1f2c3a5..f8a5de4 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -49,37 +49,28 @@ BUF_VERSION ?= 0.11.0 TOOLS_DESTDIR ?= $(GOPATH)/bin STATIK = $(TOOLS_DESTDIR)/statik RUNSIM = $(TOOLS_DESTDIR)/runsim -GOLANGCI_LINT = $(TOOLS_DESTDIR)/golangci-lint tools: tools-stamp -tools-stamp: statik runsim golangci-lint +tools-stamp: statik runsim # Create dummy file to satisfy dependency and avoid # rebuilding when this Makefile target is hit twice # in a row. touch $@ +# Install the runsim binary statik: $(STATIK) $(STATIK): @echo "Installing statik..." - @(cd /tmp && go install github.com/rakyll/statik@v0.1.6) + @go install github.com/rakyll/statik@v0.1.6 -# Install the runsim binary with a temporary workaround of entering an outside -# directory as the "go get" command ignores the -mod option and will polute the -# go.{mod, sum} files. -# -# ref: https://github.com/golang/go/issues/30515 +# Install the runsim binary runsim: $(RUNSIM) $(RUNSIM): @echo "Installing runsim..." - @(cd /tmp && go install github.com/cosmos/tools/cmd/runsim@v1.0.0) - -golangci-lint: $(GOLANGCI_LINT) -$(GOLANGCI_LINT): - @echo "Installing golangci-lint..." - @(cd /tmp && go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47) + @go install github.com/cosmos/tools/cmd/runsim@v1.0.0 tools-clean: rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM) rm -f tools-stamp -.PHONY: tools-clean statik runsim +.PHONY: tools-clean statik runsim \ No newline at end of file diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md index 6cd3450..b005dc2 100644 --- a/contrib/devtools/README.md +++ b/contrib/devtools/README.md @@ -1,6 +1,6 @@ -## Contributors +# Contributors Thanks to the entire Cosmos SDK team and the contributors who put their efforts into making simulation testing easier to implement. 🤗 -https://github.com/cosmos/cosmos-sdk/blob/masSSter/contrib/devtools/Makefile \ No newline at end of file + \ No newline at end of file diff --git a/contrib/local/01-accounts.sh b/contrib/local/01-accounts.sh deleted file mode 100755 index c58e467..0000000 --- a/contrib/local/01-accounts.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -o errexit -o nounset -o pipefail - -BASE_ACCOUNT=$(terpd keys show validator -a --keyring-backend=test) -terpd q account "$BASE_ACCOUNT" -o json | jq - -echo "## Add new account" -terpd keys add fred --keyring-backend=test - -echo "## Check balance" -NEW_ACCOUNT=$(terpd keys show fred -a --keyring-backend=test ) -terpd q bank balances "$NEW_ACCOUNT" -o json || true - -echo "## Transfer tokens" -terpd tx bank send validator "$NEW_ACCOUNT" 1ustake --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json | jq --keyring-backend=test - -echo "## Check balance again" -terpd q bank balances "$NEW_ACCOUNT" -o json | jq diff --git a/contrib/local/02-contracts.sh b/contrib/local/02-contracts.sh deleted file mode 100755 index 4544d0b..0000000 --- a/contrib/local/02-contracts.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash -set -o errexit -o nounset -o pipefail -x - -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" - -echo "-----------------------" -echo "## Add new CosmWasm contract" -RESP=$(terpd tx wasm store "$DIR/../../x/wasm/keeper/testdata/hackatom.wasm" \ - --from validator --gas 1500000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test) -sleep 6 -RESP=$(terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json) -CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') -CODE_HASH=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_checksum").value') -echo "* Code id: $CODE_ID" -echo "* Code checksum: $CODE_HASH" - -echo "* Download code" -TMPDIR=$(mktemp -t terpdXXXXXX) -terpd q wasm code "$CODE_ID" "$TMPDIR" -rm -f "$TMPDIR" -echo "-----------------------" -echo "## List code" -terpd query wasm list-code --node=http://localhost:26657 -o json | jq - -echo "-----------------------" -echo "## Create new contract instance" -INIT="{\"verifier\":\"$(terpd keys show validator -a --keyring-backend=test)\", \"beneficiary\":\"$(terpd keys show fred -a --keyring-backend=test)\"}" -RESP=$(terpd tx wasm instantiate "$CODE_ID" "$INIT" --admin="$(terpd keys show validator -a --keyring-backend=test)" \ - --from validator --amount="100ustake" --label "local0.1.0" \ - --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - -CONTRACT=$(terpd query wasm list-contract-by-code "$CODE_ID" -o json | jq -r '.contracts[-1]') -echo "* Contract address: $CONTRACT" - -echo "## Create new contract instance with predictable address" -RESP=$(terpd tx wasm instantiate2 "$CODE_ID" "$INIT" $(echo -n "testing" | xxd -ps) \ - --admin="$(terpd keys show validator -a --keyring-backend=test)" \ - --from validator --amount="100ustake" --label "local0.1.0" \ - --fix-msg \ - --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - - -predictedAdress=$(terpd q wasm build-address "$CODE_HASH" $(terpd keys show validator -a --keyring-backend=test) $(echo -n "testing" | xxd -ps) "$INIT") -terpd q wasm contract "$predictedAdress" -o json | jq - -echo "### Query all" -RESP=$(terpd query wasm contract-state all "$CONTRACT" -o json) -echo "$RESP" | jq -echo "### Query smart" -terpd query wasm contract-state smart "$CONTRACT" '{"verifier":{}}' -o json | jq -echo "### Query raw" -KEY=$(echo "$RESP" | jq -r ".models[0].key") -terpd query wasm contract-state raw "$CONTRACT" "$KEY" -o json | jq - -echo "-----------------------" -echo "## Execute contract $CONTRACT" -MSG='{"release":{}}' -RESP=$(terpd tx wasm execute "$CONTRACT" "$MSG" \ - --from validator \ - --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - - -echo "-----------------------" -echo "## Set new admin" -echo "### Query old admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" -echo "### Update contract" -RESP=$(terpd tx wasm set-contract-admin "$CONTRACT" "$(terpd keys show fred -a --keyring-backend=test)" \ - --from validator -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - -echo "### Query new admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" - -echo "-----------------------" -echo "## Migrate contract" -echo "### Upload new code" -RESP=$(terpd tx wasm store "$DIR/../../x/wasm/keeper/testdata/burner.wasm" \ - --from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test) -sleep 6 -RESP=$(terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json) -BURNER_CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') -echo "### Migrate to code id: $BURNER_CODE_ID" - -DEST_ACCOUNT=$(terpd keys show fred -a --keyring-backend=test) -RESP=$(terpd tx wasm migrate "$CONTRACT" "$BURNER_CODE_ID" "{\"payout\": \"$DEST_ACCOUNT\"}" --from fred \ - --chain-id=testing -b sync -y -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - -echo "### Query destination account: $BURNER_CODE_ID" -terpd q bank balances "$DEST_ACCOUNT" -o json | jq -echo "### Query contract meta data: $CONTRACT" -terpd q wasm contract "$CONTRACT" -o json | jq - -echo "### Query contract meta history: $CONTRACT" -terpd q wasm contract-history "$CONTRACT" -o json | jq - -echo "-----------------------" -echo "## Clear contract admin" -echo "### Query old admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" -echo "### Update contract" -RESP=$(terpd tx wasm clear-contract-admin "$CONTRACT" \ - --from fred -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq -echo "### Query new admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" \ No newline at end of file diff --git a/contrib/local/03-grpc-queries.sh b/contrib/local/03-grpc-queries.sh deleted file mode 100755 index 4544d0b..0000000 --- a/contrib/local/03-grpc-queries.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash -set -o errexit -o nounset -o pipefail -x - -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" - -echo "-----------------------" -echo "## Add new CosmWasm contract" -RESP=$(terpd tx wasm store "$DIR/../../x/wasm/keeper/testdata/hackatom.wasm" \ - --from validator --gas 1500000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test) -sleep 6 -RESP=$(terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json) -CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') -CODE_HASH=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_checksum").value') -echo "* Code id: $CODE_ID" -echo "* Code checksum: $CODE_HASH" - -echo "* Download code" -TMPDIR=$(mktemp -t terpdXXXXXX) -terpd q wasm code "$CODE_ID" "$TMPDIR" -rm -f "$TMPDIR" -echo "-----------------------" -echo "## List code" -terpd query wasm list-code --node=http://localhost:26657 -o json | jq - -echo "-----------------------" -echo "## Create new contract instance" -INIT="{\"verifier\":\"$(terpd keys show validator -a --keyring-backend=test)\", \"beneficiary\":\"$(terpd keys show fred -a --keyring-backend=test)\"}" -RESP=$(terpd tx wasm instantiate "$CODE_ID" "$INIT" --admin="$(terpd keys show validator -a --keyring-backend=test)" \ - --from validator --amount="100ustake" --label "local0.1.0" \ - --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - -CONTRACT=$(terpd query wasm list-contract-by-code "$CODE_ID" -o json | jq -r '.contracts[-1]') -echo "* Contract address: $CONTRACT" - -echo "## Create new contract instance with predictable address" -RESP=$(terpd tx wasm instantiate2 "$CODE_ID" "$INIT" $(echo -n "testing" | xxd -ps) \ - --admin="$(terpd keys show validator -a --keyring-backend=test)" \ - --from validator --amount="100ustake" --label "local0.1.0" \ - --fix-msg \ - --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - - -predictedAdress=$(terpd q wasm build-address "$CODE_HASH" $(terpd keys show validator -a --keyring-backend=test) $(echo -n "testing" | xxd -ps) "$INIT") -terpd q wasm contract "$predictedAdress" -o json | jq - -echo "### Query all" -RESP=$(terpd query wasm contract-state all "$CONTRACT" -o json) -echo "$RESP" | jq -echo "### Query smart" -terpd query wasm contract-state smart "$CONTRACT" '{"verifier":{}}' -o json | jq -echo "### Query raw" -KEY=$(echo "$RESP" | jq -r ".models[0].key") -terpd query wasm contract-state raw "$CONTRACT" "$KEY" -o json | jq - -echo "-----------------------" -echo "## Execute contract $CONTRACT" -MSG='{"release":{}}' -RESP=$(terpd tx wasm execute "$CONTRACT" "$MSG" \ - --from validator \ - --gas 1000000 -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - - -echo "-----------------------" -echo "## Set new admin" -echo "### Query old admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" -echo "### Update contract" -RESP=$(terpd tx wasm set-contract-admin "$CONTRACT" "$(terpd keys show fred -a --keyring-backend=test)" \ - --from validator -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - -echo "### Query new admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" - -echo "-----------------------" -echo "## Migrate contract" -echo "### Upload new code" -RESP=$(terpd tx wasm store "$DIR/../../x/wasm/keeper/testdata/burner.wasm" \ - --from validator --gas 1000000 -y --chain-id=testing --node=http://localhost:26657 -b sync -o json --keyring-backend=test) -sleep 6 -RESP=$(terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json) -BURNER_CODE_ID=$(echo "$RESP" | jq -r '.logs[0].events[]| select(.type=="store_code").attributes[]| select(.key=="code_id").value') -echo "### Migrate to code id: $BURNER_CODE_ID" - -DEST_ACCOUNT=$(terpd keys show fred -a --keyring-backend=test) -RESP=$(terpd tx wasm migrate "$CONTRACT" "$BURNER_CODE_ID" "{\"payout\": \"$DEST_ACCOUNT\"}" --from fred \ - --chain-id=testing -b sync -y -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq - -echo "### Query destination account: $BURNER_CODE_ID" -terpd q bank balances "$DEST_ACCOUNT" -o json | jq -echo "### Query contract meta data: $CONTRACT" -terpd q wasm contract "$CONTRACT" -o json | jq - -echo "### Query contract meta history: $CONTRACT" -terpd q wasm contract-history "$CONTRACT" -o json | jq - -echo "-----------------------" -echo "## Clear contract admin" -echo "### Query old admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" -echo "### Update contract" -RESP=$(terpd tx wasm clear-contract-admin "$CONTRACT" \ - --from fred -y --chain-id=testing -b sync -o json --keyring-backend=test) -sleep 6 -terpd q tx $(echo "$RESP"| jq -r '.txhash') -o json | jq -echo "### Query new admin: $(terpd q wasm contract "$CONTRACT" -o json | jq -r '.contract_info.admin')" \ No newline at end of file diff --git a/contrib/local/README.md b/contrib/local/README.md deleted file mode 100644 index 234e442..0000000 --- a/contrib/local/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Dev scripts -For manual testing. Works on my box(*) ... - - -*) OSX - -``` -make install -cd contrib/local -rm -rf /tmp/trash -HOME=/tmp/trash bash setup_wasmd.sh -HOME=/tmp/trash bash start_node.sh -``` - -Next shell: - -``` -cd contrib/local -./01-accounts.sh -./02-contracts.sh -``` - -## Shell script development - -[Use `shellcheck`](https://www.shellcheck.net/) to avoid common mistakes in shell scripts. -[Use `shfmt`](https://github.com/mvdan/sh) to ensure a consistent code formatting. diff --git a/contrib/local/setup_terpd.sh b/contrib/local/setup_terpd.sh deleted file mode 100755 index 8c25e0b..0000000 --- a/contrib/local/setup_terpd.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -set -o errexit -o nounset -o pipefail - -PASSWORD=${PASSWORD:-1234567890} -STAKE=${STAKE_TOKEN:-ustake} -FEE=${FEE_TOKEN:-ucosm} -CHAIN_ID=${CHAIN_ID:-testing} -MONIKER=${MONIKER:-node001} - -terpd init --chain-id "$CHAIN_ID" "$MONIKER" -# staking/governance token is hardcoded in config, change this -## OSX requires: -i. -sed -i. "s/\"stake\"/\"$STAKE\"/" "$HOME"/.terp/config/genesis.json -if ! terpd keys show validator --keyring-backend=test; then - ( - echo "$PASSWORD" - echo "$PASSWORD" - ) | terpd keys add validator --keyring-backend=test -fi -# hardcode the validator account for this instance -echo "$PASSWORD" | terpd genesis add-genesis-account validator "1000000000$STAKE,1000000000$FEE" --keyring-backend=test -# (optionally) add a few more genesis accounts -for addr in "$@"; do - echo "$addr" - terpd genesis add-genesis-account "$addr" "1000000000$STAKE,1000000000$FEE" --keyring-backend=test -done -# submit a genesis validator tx -## Workraround for https://github.com/cosmos/cosmos-sdk/issues/8251 -( - echo "$PASSWORD" - echo "$PASSWORD" - echo "$PASSWORD" -) | terpd genesis gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" --amount="250000000$STAKE" -## should be: -# (echo "$PASSWORD"; echo "$PASSWORD"; echo "$PASSWORD") | terpd gentx validator "250000000$STAKE" --chain-id="$CHAIN_ID" -terpd genesis collect-gentxs diff --git a/contrib/local/start_node.sh b/contrib/local/start_node.sh deleted file mode 100755 index 8bd2a2c..0000000 --- a/contrib/local/start_node.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -set -eu - -terpd start --rpc.laddr tcp://0.0.0.0:26657 --log_level=info --trace #remove trace flag if you don't wantg the stack trace to be printed diff --git a/contrib/prometheus/README.md b/contrib/prometheus/README.md deleted file mode 100644 index c3864e5..0000000 --- a/contrib/prometheus/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Setup -Enable prometheus metrics in terpd: - -* Edit `$HOME/config/app.toml` -```toml -[telemetry] - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled =true -# ... - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 15 -``` - -`retention-time` must be >0 (see prometheus scrape config) - - -* Edit `$HOME/config/config.toml` -```toml -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = true -``` - -Test manually at: -`http://localhost:1317/metrics?format=prometheus` - -Note the `format` parameter in the request for the endpoint: - - -# Local testing -## Run Prometheus -```sh -# port 9090 is used by terpd already -docker run -it -v $(pwd)/contrib/prometheus:/prometheus -p9091:9090 prom/prometheus --config.file=/prometheus/prometheus.yaml -``` -* Open [console](http://localhost:9091) and find `wasm_`service metrics - -## Run Grafana - -```shell -docker run -it -p 3000:3000 grafana/grafana -``` -* Add Prometheus data source -`http://host.docker.internal:9091` -### Labels -* `wasm_contract_create` = nanosec \ No newline at end of file diff --git a/contrib/prometheus/prometheus.yaml b/contrib/prometheus/prometheus.yaml deleted file mode 100644 index e4c7f4d..0000000 --- a/contrib/prometheus/prometheus.yaml +++ /dev/null @@ -1,11 +0,0 @@ -global: - scrape_interval: 15s # By default, scrape targets every 15 seconds. - evaluation_interval: 15s # By default, scrape targets every 15 seconds. -rule_files: - -scrape_configs: -- job_name: terpd - - scrape_interval: 5s - static_configs: - - targets: ['host.docker.internal:26660'] \ No newline at end of file diff --git a/contrib/prototools-docker/Dockerfile b/contrib/prototools-docker/Dockerfile deleted file mode 100644 index 45cd04b..0000000 --- a/contrib/prototools-docker/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -FROM golang:1.16.8-alpine3.13 AS build - -#ARG PROTOTOOL_VERSION=1.10.0 -ARG PROTODOC_VERSION=1.3.2 -ARG GRPC_GATEWAY_VERSION=1.16.0 -ARG REGEN_GOGOPROTO_VERSION=0.3.0 -ARG REGEN_PROTOBUF_VERSION=1.3.2-alpha.regen.4 -ARG BUF_VERSION=0.30.0 - -RUN apk --no-cache add --update curl git libc6-compat make upx - -RUN go get -d \ - github.com/gogo/protobuf/gogoproto && \ - mkdir -p /usr/include/google/protobuf/ && \ - mv /go/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto /usr/include/google/protobuf/ && \ - mv /go/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto /usr/include/google/protobuf/ - -RUN GO111MODULE=on go get \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} && \ - mv /go/bin/protoc-gen-grpc-gateway /usr/local/bin/ && \ - mv /go/bin/protoc-gen-swagger /usr/local/bin/ - -# Install regen fork of gogo proto -# To install a fix version this can only be done via this go.mod workaround -WORKDIR /work -RUN GO111MODULE=on go mod init foobar && \ - go mod edit -replace github.com/gogo/protobuf=github.com/regen-network/protobuf@v${REGEN_PROTOBUF_VERSION} && \ - go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@v${REGEN_GOGOPROTO_VERSION} && \ - mv /go/bin/protoc-gen-gocosmos* /usr/local/bin/ - -RUN GO111MODULE=on go get \ - github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v${PROTODOC_VERSION} && \ - mv /go/bin/protoc-gen-doc /usr/local/bin/ - -RUN GO111MODULE=on go get \ - github.com/bufbuild/buf/cmd/buf@v${BUF_VERSION} && \ - mv /go/bin/buf /usr/local/bin/ - -RUN upx --lzma /usr/local/bin/* - -FROM golang:1.19-alpine -ENV LD_LIBRARY_PATH=/lib64:/lib - -WORKDIR /work -RUN apk --no-cache add --update curl git libc6-compat make -RUN apk --no-cache add --update ca-certificates libc6-compat protoc - -COPY --from=build /usr/local/bin /usr/local/bin -COPY --from=build /usr/include /usr/include -RUN chmod -R 755 /usr/include diff --git a/contrib/prototools-docker/README.md b/contrib/prototools-docker/README.md deleted file mode 100644 index 600c702..0000000 --- a/contrib/prototools-docker/README.md +++ /dev/null @@ -1,21 +0,0 @@ -Prototool Docker Helper -======================= -Docker container for all the protobuf generation... - -Based on the work by @pseudomuto [prototool-docker](https://github.com/charithe/prototool-docker) project: - -Installs generators and tools from: - -* https://github.com/bufbuild/buf -* https://github.com/grpc-ecosystem -* https://github.com/regen-network/cosmos-proto -* https://github.com/pseudomuto/protoc-gen-doc - -### Build -```shell script -docker build -t cosmwasm/prototools-docker -f ./contrib/prototools-docker/Dockerfile . -``` - -```shell script -docker run -it -v $(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk):/workspace/cosmos_sdk_dir -v $(pwd):/workspace --workdir /workspace --env COSMOS_SDK_DIR=/cosmos_sdk_dir cosmwasm/prototool-docker sh -``` diff --git a/go.mod b/go.mod index e8f7af3..3f2c36e 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/terpnetwork/terp-core +module github.com/terpnetwork/terp-core/v2 go 1.19 diff --git a/interchaintest/go.mod b/interchaintest/go.mod index 086e339..913d313 100644 --- a/interchaintest/go.mod +++ b/interchaintest/go.mod @@ -10,7 +10,7 @@ replace ( github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.2 //indirect github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 // For this nested module, you always want to replace the parent reference with the current worktree. - github.com/terpnetwork/terp-core => ../ + github.com/terpnetwork/terp-core/v2 => ../ github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7 ) @@ -23,7 +23,7 @@ require ( github.com/docker/docker v24.0.4+incompatible github.com/strangelove-ventures/interchaintest/v7 v7.0.0-20230721183422-fb937bb0e165 github.com/stretchr/testify v1.8.4 - github.com/terpnetwork/terp-core v1.0.0 + github.com/terpnetwork/terp-core/v2 v2.0.0-00010101000000-000000000000 go.uber.org/zap v1.24.0 ) diff --git a/interchaintest/helpers/tokenfactory.go b/interchaintest/helpers/tokenfactory.go index 187d09c..a7723e8 100644 --- a/interchaintest/helpers/tokenfactory.go +++ b/interchaintest/helpers/tokenfactory.go @@ -9,7 +9,7 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - tokenfactorytypes "github.com/terpnetwork/terp-core/x/tokenfactory/types" + tokenfactorytypes "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/strangelove-ventures/interchaintest/v7/chain/cosmos" diff --git a/proto/Dockerfile b/proto/Dockerfile deleted file mode 100644 index f5e6f16..0000000 --- a/proto/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -# This Dockerfile is used for proto generation -# To build, run `make proto-image-build` - -FROM bufbuild/buf:1.7.0 as BUILDER - -FROM golang:1.19-alpine - - -RUN apk add --no-cache \ - nodejs \ - npm \ - git \ - make - -ENV GOLANG_PROTOBUF_VERSION=1.28.0 \ - GOGO_PROTOBUF_VERSION=1.3.2 \ - GRPC_GATEWAY_VERSION=1.16.0 - - -RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest -RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} -RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \ - github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} - -# install all gogo protobuf binaries -RUN git clone https://github.com/regen-network/protobuf.git; \ - cd protobuf; \ - go mod download; \ - make install - -# we need to use git clone because we use 'replace' directive in go.mod -# protoc-gen-gocosmos was moved to to in cosmos/gogoproto but pending a migration there. -RUN git clone https://github.com/regen-network/cosmos-proto.git; \ - cd cosmos-proto/protoc-gen-gocosmos; \ - go install . - -RUN npm install -g swagger-combine - -COPY --from=BUILDER /usr/local/bin /usr/local/bin diff --git a/proto/buf.lock b/proto/buf.lock index c26fa3c..f802501 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -19,5 +19,5 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 711e289f6a384c4caeebaff7c6931ade - digest: shake256:e08fb55dad7469f69df00304eed31427d2d1576e9aab31e6bf86642688e04caaf0372f15fe6974cf79432779a635b3ea401ca69c943976dc42749524e4c25d94 + commit: 28151c0d0a1641bf938a7672c500e01d + digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de diff --git a/proto/buf.md b/proto/buf.md deleted file mode 100644 index d81eb01..0000000 --- a/proto/buf.md +++ /dev/null @@ -1,18 +0,0 @@ -# Protobufs - -This is the public protocol buffers API for [Terpd](https://github.com/terpnetwork/terp-core). -## Download - -The `buf` CLI comes with an export command. Use `buf export -h` for details - -#### Examples: - -Download cosmwasm protos for a commit: -```bash -buf export buf.build/terpnetwork/terpd:${commit} --output ./tmp -``` - -Download all project protos: -```bash -buf export . --output ./tmp -``` \ No newline at end of file diff --git a/proto/gaia/globalfee/v1beta1/query.proto b/proto/gaia/globalfee/v1beta1/query.proto index 81f587c..6d2cc11 100644 --- a/proto/gaia/globalfee/v1beta1/query.proto +++ b/proto/gaia/globalfee/v1beta1/query.proto @@ -9,6 +9,7 @@ option go_package = "github.com/cosmos/gaia/x/globalfee/types"; // Query defines the gRPC querier service. service Query { + // MinimumGasPrices returns the minimum gas prices. rpc MinimumGasPrices(QueryMinimumGasPricesRequest) returns (QueryMinimumGasPricesResponse) { option (google.api.http).get = diff --git a/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto b/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto index 019152a..347e53c 100644 --- a/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto +++ b/proto/osmosis/tokenfactory/v1beta1/authorityMetadata.proto @@ -4,7 +4,7 @@ package osmosis.tokenfactory.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/tokenfactory/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types"; // DenomAuthorityMetadata specifies metadata for addresses that have specific // capabilities over a token factory denom. Right now there is only one Admin diff --git a/proto/osmosis/tokenfactory/v1beta1/genesis.proto b/proto/osmosis/tokenfactory/v1beta1/genesis.proto index 0917870..39147b1 100644 --- a/proto/osmosis/tokenfactory/v1beta1/genesis.proto +++ b/proto/osmosis/tokenfactory/v1beta1/genesis.proto @@ -5,7 +5,7 @@ import "gogoproto/gogo.proto"; import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; import "osmosis/tokenfactory/v1beta1/params.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/tokenfactory/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types"; // GenesisState defines the tokenfactory module's genesis state. message GenesisState { diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto index 09fe921..1eef2b7 100644 --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -6,7 +6,7 @@ import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/tokenfactory/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types"; // Params defines the parameters for the tokenfactory module. message Params { diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index 1e87876..d4e93bf 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -7,7 +7,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; import "osmosis/tokenfactory/v1beta1/params.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/tokenfactory/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types"; // Query defines the gRPC querier service. service Query { diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto index 8c01724..7f40114 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -8,7 +8,7 @@ import "osmosis/tokenfactory/v1beta1/params.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/tokenfactory/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types"; // Msg defines the tokefactory module's gRPC message service. service Msg { diff --git a/proto/terp/feeshare/v1/feeshare.proto b/proto/terp/feeshare/v1/feeshare.proto index 2bf1245..1d7f9a8 100644 --- a/proto/terp/feeshare/v1/feeshare.proto +++ b/proto/terp/feeshare/v1/feeshare.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package terp.feeshare.v1; -option go_package = "github.com/terpnetwork/terp-core/x/feeshare/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/feeshare/types"; // FeeShare defines an instance that organizes fee distribution conditions for // the owner of a given smart contract diff --git a/proto/terp/feeshare/v1/genesis.proto b/proto/terp/feeshare/v1/genesis.proto index 8a148b8..da635c4 100644 --- a/proto/terp/feeshare/v1/genesis.proto +++ b/proto/terp/feeshare/v1/genesis.proto @@ -3,7 +3,7 @@ package terp.feeshare.v1; import "terp/feeshare/v1/feeshare.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/feeshare/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/feeshare/types"; // GenesisState defines the module's genesis state. message GenesisState { diff --git a/proto/terp/feeshare/v1/query.proto b/proto/terp/feeshare/v1/query.proto index f088611..7200378 100644 --- a/proto/terp/feeshare/v1/query.proto +++ b/proto/terp/feeshare/v1/query.proto @@ -7,7 +7,7 @@ import "terp/feeshare/v1/feeshare.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/feeshare/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/feeshare/types"; // Query defines the gRPC querier service. service Query { diff --git a/proto/terp/feeshare/v1/tx.proto b/proto/terp/feeshare/v1/tx.proto index b9ec716..af279bb 100644 --- a/proto/terp/feeshare/v1/tx.proto +++ b/proto/terp/feeshare/v1/tx.proto @@ -7,7 +7,7 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "terp/feeshare/v1/genesis.proto"; -option go_package = "github.com/terpnetwork/terp-core/x/feeshare/types"; +option go_package = "github.com/terpnetwork/terp-core/v2/x/feeshare/types"; // Msg defines the fees Msg service. service Msg { diff --git a/x/feeshare/ante/ante.go b/x/feeshare/ante/ante.go index 1b975b9..e871059 100644 --- a/x/feeshare/ante/ante.go +++ b/x/feeshare/ante/ante.go @@ -9,7 +9,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - feeshare "github.com/terpnetwork/terp-core/x/feeshare/types" + feeshare "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // FeeSharePayoutDecorator Run his after we already deduct the fee from the account with diff --git a/x/feeshare/ante/ante_test.go b/x/feeshare/ante/ante_test.go index eb8f104..321110a 100644 --- a/x/feeshare/ante/ante_test.go +++ b/x/feeshare/ante/ante_test.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - ante "github.com/terpnetwork/terp-core/x/feeshare/ante" + ante "github.com/terpnetwork/terp-core/v2/x/feeshare/ante" ) type AnteTestSuite struct { diff --git a/x/feeshare/ante/expected_keepers.go b/x/feeshare/ante/expected_keepers.go index d23ca87..438c33b 100644 --- a/x/feeshare/ante/expected_keepers.go +++ b/x/feeshare/ante/expected_keepers.go @@ -5,7 +5,7 @@ package ante import ( sdk "github.com/cosmos/cosmos-sdk/types" - revtypes "github.com/terpnetwork/terp-core/x/feeshare/types" + revtypes "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) type BankKeeper interface { diff --git a/x/feeshare/client/cli/query.go b/x/feeshare/client/cli/query.go index 43ad3ff..fb5dc3c 100644 --- a/x/feeshare/client/cli/query.go +++ b/x/feeshare/client/cli/query.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/feeshare/client/cli/tx.go b/x/feeshare/client/cli/tx.go index 40926db..e0b4dbd 100644 --- a/x/feeshare/client/cli/tx.go +++ b/x/feeshare/client/cli/tx.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // NewTxCmd returns a root CLI command handler for certain modules/FeeShare diff --git a/x/feeshare/genesis.go b/x/feeshare/genesis.go index 062f0dc..bae421b 100644 --- a/x/feeshare/genesis.go +++ b/x/feeshare/genesis.go @@ -3,8 +3,8 @@ package feeshare import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/feeshare/keeper" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/keeper" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // InitGenesis import module genesis diff --git a/x/feeshare/genesis_test.go b/x/feeshare/genesis_test.go index 04d8eaf..33413ef 100644 --- a/x/feeshare/genesis_test.go +++ b/x/feeshare/genesis_test.go @@ -10,9 +10,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/app" - "github.com/terpnetwork/terp-core/x/feeshare" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/app" + "github.com/terpnetwork/terp-core/v2/x/feeshare" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) type GenesisTestSuite struct { diff --git a/x/feeshare/integration_test.go b/x/feeshare/integration_test.go index f4e792c..8e8a8cd 100644 --- a/x/feeshare/integration_test.go +++ b/x/feeshare/integration_test.go @@ -21,7 +21,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/mint/types" - terpapp "github.com/terpnetwork/terp-core/app" + terpapp "github.com/terpnetwork/terp-core/v2/app" ) // returns context and an app with updated mint keeper diff --git a/x/feeshare/keeper/feeshare.go b/x/feeshare/keeper/feeshare.go index 80cf0bc..0ccbe9a 100644 --- a/x/feeshare/keeper/feeshare.go +++ b/x/feeshare/keeper/feeshare.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // GetFeeShares returns all registered FeeShares. diff --git a/x/feeshare/keeper/grpc_query.go b/x/feeshare/keeper/grpc_query.go index 96fcb4a..67be214 100644 --- a/x/feeshare/keeper/grpc_query.go +++ b/x/feeshare/keeper/grpc_query.go @@ -10,7 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) var _ types.QueryServer = Querier{} diff --git a/x/feeshare/keeper/grpc_query_test.go b/x/feeshare/keeper/grpc_query_test.go index 39a5d4b..9cc2183 100644 --- a/x/feeshare/keeper/grpc_query_test.go +++ b/x/feeshare/keeper/grpc_query_test.go @@ -5,8 +5,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/terpnetwork/terp-core/testutil/nullify" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/testutil/nullify" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) func (s *IntegrationTestSuite) TestFeeShares() { diff --git a/x/feeshare/keeper/keeper.go b/x/feeshare/keeper/keeper.go index ea65035..04e3df6 100644 --- a/x/feeshare/keeper/keeper.go +++ b/x/feeshare/keeper/keeper.go @@ -11,7 +11,7 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - revtypes "github.com/terpnetwork/terp-core/x/feeshare/types" + revtypes "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // Keeper of this module maintains collections of feeshares for contracts diff --git a/x/feeshare/keeper/keeper_test.go b/x/feeshare/keeper/keeper_test.go index 2bbc16e..9144caa 100644 --- a/x/feeshare/keeper/keeper_test.go +++ b/x/feeshare/keeper/keeper_test.go @@ -14,9 +14,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - "github.com/terpnetwork/terp-core/app" - "github.com/terpnetwork/terp-core/x/feeshare/keeper" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/app" + "github.com/terpnetwork/terp-core/v2/x/feeshare/keeper" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // BankKeeper defines the expected interface needed to retrieve account balances. diff --git a/x/feeshare/keeper/migrator.go b/x/feeshare/keeper/migrator.go index 4792a30..77b9e72 100644 --- a/x/feeshare/keeper/migrator.go +++ b/x/feeshare/keeper/migrator.go @@ -3,8 +3,8 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/feeshare/exported" - v2 "github.com/terpnetwork/terp-core/x/feeshare/migrations/v2" + "github.com/terpnetwork/terp-core/v2/x/feeshare/exported" + v2 "github.com/terpnetwork/terp-core/v2/x/feeshare/migrations/v2" ) // Migrator is a struct for handling in-place state migrations. diff --git a/x/feeshare/keeper/msg_server.go b/x/feeshare/keeper/msg_server.go index fe29a05..c5d8474 100644 --- a/x/feeshare/keeper/msg_server.go +++ b/x/feeshare/keeper/msg_server.go @@ -11,7 +11,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) var _ types.MsgServer = &Keeper{} diff --git a/x/feeshare/keeper/msg_server_test.go b/x/feeshare/keeper/msg_server_test.go index ac176d3..7fa8116 100644 --- a/x/feeshare/keeper/msg_server_test.go +++ b/x/feeshare/keeper/msg_server_test.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) //go:embed testdata/reflect.wasm diff --git a/x/feeshare/keeper/params.go b/x/feeshare/keeper/params.go index 608d1a0..3b6f3c5 100644 --- a/x/feeshare/keeper/params.go +++ b/x/feeshare/keeper/params.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // GetParams returns the total set of fees parameters. diff --git a/x/feeshare/migrations/v2/migrate.go b/x/feeshare/migrations/v2/migrate.go index 83d0343..3aa51cc 100644 --- a/x/feeshare/migrations/v2/migrate.go +++ b/x/feeshare/migrations/v2/migrate.go @@ -4,8 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/feeshare/exported" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/exported" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) const ( diff --git a/x/feeshare/migrations/v2/migrate_test.go b/x/feeshare/migrations/v2/migrate_test.go index b3a045b..18095a4 100644 --- a/x/feeshare/migrations/v2/migrate_test.go +++ b/x/feeshare/migrations/v2/migrate_test.go @@ -9,10 +9,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/terpnetwork/terp-core/x/feeshare" - "github.com/terpnetwork/terp-core/x/feeshare/exported" - v2 "github.com/terpnetwork/terp-core/x/feeshare/migrations/v2" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare" + "github.com/terpnetwork/terp-core/v2/x/feeshare/exported" + v2 "github.com/terpnetwork/terp-core/v2/x/feeshare/migrations/v2" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) type mockSubspace struct { diff --git a/x/feeshare/module.go b/x/feeshare/module.go index 02a2d22..b9735a0 100644 --- a/x/feeshare/module.go +++ b/x/feeshare/module.go @@ -19,10 +19,10 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - "github.com/terpnetwork/terp-core/x/feeshare/client/cli" - "github.com/terpnetwork/terp-core/x/feeshare/exported" - "github.com/terpnetwork/terp-core/x/feeshare/keeper" - "github.com/terpnetwork/terp-core/x/feeshare/types" + "github.com/terpnetwork/terp-core/v2/x/feeshare/client/cli" + "github.com/terpnetwork/terp-core/v2/x/feeshare/exported" + "github.com/terpnetwork/terp-core/v2/x/feeshare/keeper" + "github.com/terpnetwork/terp-core/v2/x/feeshare/types" ) // type check to ensure the interface is properly implemented diff --git a/x/feeshare/types/feeshare.pb.go b/x/feeshare/types/feeshare.pb.go index 2672f7c..5182b93 100644 --- a/x/feeshare/types/feeshare.pb.go +++ b/x/feeshare/types/feeshare.pb.go @@ -5,19 +5,16 @@ package types import ( fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" - - proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,11 +42,9 @@ func (*FeeShare) ProtoMessage() {} func (*FeeShare) Descriptor() ([]byte, []int) { return fileDescriptor_3fd5d33ef9423a38, []int{0} } - func (m *FeeShare) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *FeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_FeeShare.Marshal(b, m, deterministic) @@ -62,15 +57,12 @@ func (m *FeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *FeeShare) XXX_Merge(src proto.Message) { xxx_messageInfo_FeeShare.Merge(m, src) } - func (m *FeeShare) XXX_Size() int { return m.Size() } - func (m *FeeShare) XXX_DiscardUnknown() { xxx_messageInfo_FeeShare.DiscardUnknown(m) } @@ -177,7 +169,6 @@ func encodeVarintFeeshare(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *FeeShare) Size() (n int) { if m == nil { return 0 @@ -202,11 +193,9 @@ func (m *FeeShare) Size() (n int) { func sovFeeshare(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozFeeshare(x uint64) (n int) { return sovFeeshare(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *FeeShare) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -353,7 +342,6 @@ func (m *FeeShare) Unmarshal(dAtA []byte) error { } return nil } - func skipFeeshare(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feeshare/types/genesis.pb.go b/x/feeshare/types/genesis.pb.go index 25f796f..753938b 100644 --- a/x/feeshare/types/genesis.pb.go +++ b/x/feeshare/types/genesis.pb.go @@ -5,21 +5,18 @@ package types import ( fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -41,11 +38,9 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_7f942c377ec7c32d, []int{0} } - func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -58,15 +53,12 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } - func (m *GenesisState) XXX_Size() int { return m.Size() } - func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -107,11 +99,9 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_7f942c377ec7c32d, []int{1} } - func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -124,15 +114,12 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } - func (m *Params) XXX_Size() int { return m.Size() } - func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -296,7 +283,6 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -337,11 +323,9 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -459,7 +443,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } - func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -596,7 +579,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } - func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feeshare/types/query.pb.go b/x/feeshare/types/query.pb.go index 6c55c74..eaea051 100644 --- a/x/feeshare/types/query.pb.go +++ b/x/feeshare/types/query.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -18,14 +14,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -45,11 +42,9 @@ func (*QueryFeeSharesRequest) ProtoMessage() {} func (*QueryFeeSharesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{0} } - func (m *QueryFeeSharesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryFeeSharesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryFeeSharesRequest.Marshal(b, m, deterministic) @@ -62,15 +57,12 @@ func (m *QueryFeeSharesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } - func (m *QueryFeeSharesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryFeeSharesRequest.Merge(m, src) } - func (m *QueryFeeSharesRequest) XXX_Size() int { return m.Size() } - func (m *QueryFeeSharesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryFeeSharesRequest.DiscardUnknown(m) } @@ -99,11 +91,9 @@ func (*QueryFeeSharesResponse) ProtoMessage() {} func (*QueryFeeSharesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{1} } - func (m *QueryFeeSharesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryFeeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryFeeSharesResponse.Marshal(b, m, deterministic) @@ -116,15 +106,12 @@ func (m *QueryFeeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *QueryFeeSharesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryFeeSharesResponse.Merge(m, src) } - func (m *QueryFeeSharesResponse) XXX_Size() int { return m.Size() } - func (m *QueryFeeSharesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryFeeSharesResponse.DiscardUnknown(m) } @@ -157,11 +144,9 @@ func (*QueryFeeShareRequest) ProtoMessage() {} func (*QueryFeeShareRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{2} } - func (m *QueryFeeShareRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryFeeShareRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryFeeShareRequest.Marshal(b, m, deterministic) @@ -174,15 +159,12 @@ func (m *QueryFeeShareRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } - func (m *QueryFeeShareRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryFeeShareRequest.Merge(m, src) } - func (m *QueryFeeShareRequest) XXX_Size() int { return m.Size() } - func (m *QueryFeeShareRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryFeeShareRequest.DiscardUnknown(m) } @@ -208,11 +190,9 @@ func (*QueryFeeShareResponse) ProtoMessage() {} func (*QueryFeeShareResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{3} } - func (m *QueryFeeShareResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryFeeShareResponse.Marshal(b, m, deterministic) @@ -225,15 +205,12 @@ func (m *QueryFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } - func (m *QueryFeeShareResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryFeeShareResponse.Merge(m, src) } - func (m *QueryFeeShareResponse) XXX_Size() int { return m.Size() } - func (m *QueryFeeShareResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryFeeShareResponse.DiscardUnknown(m) } @@ -248,7 +225,8 @@ func (m *QueryFeeShareResponse) GetFeeshare() FeeShare { } // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct{} +type QueryParamsRequest struct { +} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -256,11 +234,9 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{4} } - func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -273,15 +249,12 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } - func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } - func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -300,11 +273,9 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{5} } - func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -317,15 +288,12 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } - func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } - func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -354,11 +322,9 @@ func (*QueryDeployerFeeSharesRequest) ProtoMessage() {} func (*QueryDeployerFeeSharesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{6} } - func (m *QueryDeployerFeeSharesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryDeployerFeeSharesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDeployerFeeSharesRequest.Marshal(b, m, deterministic) @@ -371,15 +337,12 @@ func (m *QueryDeployerFeeSharesRequest) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } - func (m *QueryDeployerFeeSharesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDeployerFeeSharesRequest.Merge(m, src) } - func (m *QueryDeployerFeeSharesRequest) XXX_Size() int { return m.Size() } - func (m *QueryDeployerFeeSharesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryDeployerFeeSharesRequest.DiscardUnknown(m) } @@ -416,11 +379,9 @@ func (*QueryDeployerFeeSharesResponse) ProtoMessage() {} func (*QueryDeployerFeeSharesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{7} } - func (m *QueryDeployerFeeSharesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryDeployerFeeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDeployerFeeSharesResponse.Marshal(b, m, deterministic) @@ -433,15 +394,12 @@ func (m *QueryDeployerFeeSharesResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } - func (m *QueryDeployerFeeSharesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDeployerFeeSharesResponse.Merge(m, src) } - func (m *QueryDeployerFeeSharesResponse) XXX_Size() int { return m.Size() } - func (m *QueryDeployerFeeSharesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryDeployerFeeSharesResponse.DiscardUnknown(m) } @@ -477,11 +435,9 @@ func (*QueryWithdrawerFeeSharesRequest) ProtoMessage() {} func (*QueryWithdrawerFeeSharesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{8} } - func (m *QueryWithdrawerFeeSharesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryWithdrawerFeeSharesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryWithdrawerFeeSharesRequest.Marshal(b, m, deterministic) @@ -494,15 +450,12 @@ func (m *QueryWithdrawerFeeSharesRequest) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } - func (m *QueryWithdrawerFeeSharesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryWithdrawerFeeSharesRequest.Merge(m, src) } - func (m *QueryWithdrawerFeeSharesRequest) XXX_Size() int { return m.Size() } - func (m *QueryWithdrawerFeeSharesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryWithdrawerFeeSharesRequest.DiscardUnknown(m) } @@ -539,11 +492,9 @@ func (*QueryWithdrawerFeeSharesResponse) ProtoMessage() {} func (*QueryWithdrawerFeeSharesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_e972f6890c795a75, []int{9} } - func (m *QueryWithdrawerFeeSharesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryWithdrawerFeeSharesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryWithdrawerFeeSharesResponse.Marshal(b, m, deterministic) @@ -556,15 +507,12 @@ func (m *QueryWithdrawerFeeSharesResponse) XXX_Marshal(b []byte, deterministic b return b[:n], nil } } - func (m *QueryWithdrawerFeeSharesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryWithdrawerFeeSharesResponse.Merge(m, src) } - func (m *QueryWithdrawerFeeSharesResponse) XXX_Size() int { return m.Size() } - func (m *QueryWithdrawerFeeSharesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryWithdrawerFeeSharesResponse.DiscardUnknown(m) } @@ -648,10 +596,8 @@ var fileDescriptor_e972f6890c795a75 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var ( - _ context.Context - _ grpc.ClientConn -) +var _ context.Context +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -745,24 +691,21 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct{} +type UnimplementedQueryServer struct { +} func (*UnimplementedQueryServer) FeeShares(ctx context.Context, req *QueryFeeSharesRequest) (*QueryFeeSharesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FeeShares not implemented") } - func (*UnimplementedQueryServer) FeeShare(ctx context.Context, req *QueryFeeShareRequest) (*QueryFeeShareResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FeeShare not implemented") } - func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } - func (*UnimplementedQueryServer) DeployerFeeShares(ctx context.Context, req *QueryDeployerFeeSharesRequest) (*QueryDeployerFeeSharesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DeployerFeeShares not implemented") } - func (*UnimplementedQueryServer) WithdrawerFeeShares(ctx context.Context, req *QueryWithdrawerFeeSharesRequest) (*QueryWithdrawerFeeSharesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawerFeeShares not implemented") } @@ -1276,7 +1219,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *QueryFeeSharesRequest) Size() (n int) { if m == nil { return 0 @@ -1428,11 +1370,9 @@ func (m *QueryWithdrawerFeeSharesResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *QueryFeeSharesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1519,7 +1459,6 @@ func (m *QueryFeeSharesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryFeeSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1640,7 +1579,6 @@ func (m *QueryFeeSharesResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryFeeShareRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1723,7 +1661,6 @@ func (m *QueryFeeShareRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryFeeShareResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1807,7 +1744,6 @@ func (m *QueryFeeShareResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1858,7 +1794,6 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1942,7 +1877,6 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryDeployerFeeSharesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2061,7 +1995,6 @@ func (m *QueryDeployerFeeSharesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryDeployerFeeSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2180,7 +2113,6 @@ func (m *QueryDeployerFeeSharesResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryWithdrawerFeeSharesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2299,7 +2231,6 @@ func (m *QueryWithdrawerFeeSharesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryWithdrawerFeeSharesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2418,7 +2349,6 @@ func (m *QueryWithdrawerFeeSharesResponse) Unmarshal(dAtA []byte) error { } return nil } - func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feeshare/types/query.pb.gw.go b/x/feeshare/types/query.pb.gw.go index 15f2142..0db12fa 100644 --- a/x/feeshare/types/query.pb.gw.go +++ b/x/feeshare/types/query.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = descriptor.ForMessage - _ = metadata.Join + filter_Query_FeeShares_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -var filter_Query_FeeShares_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} - func request_Query_FeeShares_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryFeeSharesRequest var metadata runtime.ServerMetadata @@ -50,6 +50,7 @@ func request_Query_FeeShares_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.FeeShares(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_FeeShares_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -65,6 +66,7 @@ func local_request_Query_FeeShares_0(ctx context.Context, marshaler runtime.Mars msg, err := server.FeeShares(ctx, &protoReq) return msg, metadata, err + } func request_Query_FeeShare_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -91,6 +93,7 @@ func request_Query_FeeShare_0(ctx context.Context, marshaler runtime.Marshaler, msg, err := client.FeeShare(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_FeeShare_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -117,6 +120,7 @@ func local_request_Query_FeeShare_0(ctx context.Context, marshaler runtime.Marsh msg, err := server.FeeShare(ctx, &protoReq) return msg, metadata, err + } func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -125,6 +129,7 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -133,9 +138,12 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_DeployerFeeShares_0 = &utilities.DoubleArray{Encoding: map[string]int{"deployer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_DeployerFeeShares_0 = &utilities.DoubleArray{Encoding: map[string]int{"deployer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_DeployerFeeShares_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDeployerFeeSharesRequest @@ -168,6 +176,7 @@ func request_Query_DeployerFeeShares_0(ctx context.Context, marshaler runtime.Ma msg, err := client.DeployerFeeShares(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_DeployerFeeShares_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -201,9 +210,12 @@ func local_request_Query_DeployerFeeShares_0(ctx context.Context, marshaler runt msg, err := server.DeployerFeeShares(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_WithdrawerFeeShares_0 = &utilities.DoubleArray{Encoding: map[string]int{"withdrawer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_WithdrawerFeeShares_0 = &utilities.DoubleArray{Encoding: map[string]int{"withdrawer_address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_WithdrawerFeeShares_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryWithdrawerFeeSharesRequest @@ -236,6 +248,7 @@ func request_Query_WithdrawerFeeShares_0(ctx context.Context, marshaler runtime. msg, err := client.WithdrawerFeeShares(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_WithdrawerFeeShares_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -269,6 +282,7 @@ func local_request_Query_WithdrawerFeeShares_0(ctx context.Context, marshaler ru msg, err := server.WithdrawerFeeShares(ctx, &protoReq) return msg, metadata, err + } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -276,6 +290,7 @@ func local_request_Query_WithdrawerFeeShares_0(ctx context.Context, marshaler ru // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_FeeShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -296,6 +311,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_FeeShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_FeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -318,6 +334,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_FeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -340,6 +357,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_DeployerFeeShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -362,6 +380,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_DeployerFeeShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_WithdrawerFeeShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -384,6 +403,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_WithdrawerFeeShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -426,6 +446,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_FeeShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -443,6 +464,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_FeeShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_FeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -462,6 +484,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_FeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -481,6 +504,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_DeployerFeeShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -500,6 +524,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_DeployerFeeShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_WithdrawerFeeShares_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -519,6 +544,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_WithdrawerFeeShares_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil diff --git a/x/feeshare/types/tx.pb.go b/x/feeshare/types/tx.pb.go index 6c6d1ee..7279250 100644 --- a/x/feeshare/types/tx.pb.go +++ b/x/feeshare/types/tx.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -19,14 +15,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -52,11 +49,9 @@ func (*MsgRegisterFeeShare) ProtoMessage() {} func (*MsgRegisterFeeShare) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{0} } - func (m *MsgRegisterFeeShare) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgRegisterFeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgRegisterFeeShare.Marshal(b, m, deterministic) @@ -69,15 +64,12 @@ func (m *MsgRegisterFeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *MsgRegisterFeeShare) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgRegisterFeeShare.Merge(m, src) } - func (m *MsgRegisterFeeShare) XXX_Size() int { return m.Size() } - func (m *MsgRegisterFeeShare) XXX_DiscardUnknown() { xxx_messageInfo_MsgRegisterFeeShare.DiscardUnknown(m) } @@ -106,7 +98,8 @@ func (m *MsgRegisterFeeShare) GetWithdrawerAddress() string { } // MsgRegisterFeeShareResponse defines the MsgRegisterFeeShare response type -type MsgRegisterFeeShareResponse struct{} +type MsgRegisterFeeShareResponse struct { +} func (m *MsgRegisterFeeShareResponse) Reset() { *m = MsgRegisterFeeShareResponse{} } func (m *MsgRegisterFeeShareResponse) String() string { return proto.CompactTextString(m) } @@ -114,11 +107,9 @@ func (*MsgRegisterFeeShareResponse) ProtoMessage() {} func (*MsgRegisterFeeShareResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{1} } - func (m *MsgRegisterFeeShareResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgRegisterFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgRegisterFeeShareResponse.Marshal(b, m, deterministic) @@ -131,15 +122,12 @@ func (m *MsgRegisterFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *MsgRegisterFeeShareResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgRegisterFeeShareResponse.Merge(m, src) } - func (m *MsgRegisterFeeShareResponse) XXX_Size() int { return m.Size() } - func (m *MsgRegisterFeeShareResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgRegisterFeeShareResponse.DiscardUnknown(m) } @@ -165,11 +153,9 @@ func (*MsgUpdateFeeShare) ProtoMessage() {} func (*MsgUpdateFeeShare) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{2} } - func (m *MsgUpdateFeeShare) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateFeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateFeeShare.Marshal(b, m, deterministic) @@ -182,15 +168,12 @@ func (m *MsgUpdateFeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *MsgUpdateFeeShare) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateFeeShare.Merge(m, src) } - func (m *MsgUpdateFeeShare) XXX_Size() int { return m.Size() } - func (m *MsgUpdateFeeShare) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateFeeShare.DiscardUnknown(m) } @@ -219,7 +202,8 @@ func (m *MsgUpdateFeeShare) GetWithdrawerAddress() string { } // MsgUpdateFeeShareResponse defines the MsgUpdateFeeShare response type -type MsgUpdateFeeShareResponse struct{} +type MsgUpdateFeeShareResponse struct { +} func (m *MsgUpdateFeeShareResponse) Reset() { *m = MsgUpdateFeeShareResponse{} } func (m *MsgUpdateFeeShareResponse) String() string { return proto.CompactTextString(m) } @@ -227,11 +211,9 @@ func (*MsgUpdateFeeShareResponse) ProtoMessage() {} func (*MsgUpdateFeeShareResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{3} } - func (m *MsgUpdateFeeShareResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateFeeShareResponse.Marshal(b, m, deterministic) @@ -244,15 +226,12 @@ func (m *MsgUpdateFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } - func (m *MsgUpdateFeeShareResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateFeeShareResponse.Merge(m, src) } - func (m *MsgUpdateFeeShareResponse) XXX_Size() int { return m.Size() } - func (m *MsgUpdateFeeShareResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateFeeShareResponse.DiscardUnknown(m) } @@ -274,11 +253,9 @@ func (*MsgCancelFeeShare) ProtoMessage() {} func (*MsgCancelFeeShare) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{4} } - func (m *MsgCancelFeeShare) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgCancelFeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCancelFeeShare.Marshal(b, m, deterministic) @@ -291,15 +268,12 @@ func (m *MsgCancelFeeShare) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *MsgCancelFeeShare) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCancelFeeShare.Merge(m, src) } - func (m *MsgCancelFeeShare) XXX_Size() int { return m.Size() } - func (m *MsgCancelFeeShare) XXX_DiscardUnknown() { xxx_messageInfo_MsgCancelFeeShare.DiscardUnknown(m) } @@ -321,7 +295,8 @@ func (m *MsgCancelFeeShare) GetDeployerAddress() string { } // MsgCancelFeeShareResponse defines the MsgCancelFeeShare response type -type MsgCancelFeeShareResponse struct{} +type MsgCancelFeeShareResponse struct { +} func (m *MsgCancelFeeShareResponse) Reset() { *m = MsgCancelFeeShareResponse{} } func (m *MsgCancelFeeShareResponse) String() string { return proto.CompactTextString(m) } @@ -329,11 +304,9 @@ func (*MsgCancelFeeShareResponse) ProtoMessage() {} func (*MsgCancelFeeShareResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{5} } - func (m *MsgCancelFeeShareResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgCancelFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCancelFeeShareResponse.Marshal(b, m, deterministic) @@ -346,15 +319,12 @@ func (m *MsgCancelFeeShareResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } - func (m *MsgCancelFeeShareResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCancelFeeShareResponse.Merge(m, src) } - func (m *MsgCancelFeeShareResponse) XXX_Size() int { return m.Size() } - func (m *MsgCancelFeeShareResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgCancelFeeShareResponse.DiscardUnknown(m) } @@ -379,11 +349,9 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{6} } - func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -396,15 +364,12 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } - func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } - func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } - func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -429,7 +394,8 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct{} +type MsgUpdateParamsResponse struct { +} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -437,11 +403,9 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1e1ba58fd1f48d8c, []int{7} } - func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -454,15 +418,12 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } - func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } - func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -522,10 +483,8 @@ var fileDescriptor_1e1ba58fd1f48d8c = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var ( - _ context.Context - _ grpc.ClientConn -) +var _ context.Context +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -604,20 +563,18 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct{} +type UnimplementedMsgServer struct { +} func (*UnimplementedMsgServer) RegisterFeeShare(ctx context.Context, req *MsgRegisterFeeShare) (*MsgRegisterFeeShareResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterFeeShare not implemented") } - func (*UnimplementedMsgServer) UpdateFeeShare(ctx context.Context, req *MsgUpdateFeeShare) (*MsgUpdateFeeShareResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateFeeShare not implemented") } - func (*UnimplementedMsgServer) CancelFeeShare(ctx context.Context, req *MsgCancelFeeShare) (*MsgCancelFeeShareResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelFeeShare not implemented") } - func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -991,7 +948,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *MsgRegisterFeeShare) Size() (n int) { if m == nil { return 0 @@ -1105,11 +1061,9 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *MsgRegisterFeeShare) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1256,7 +1210,6 @@ func (m *MsgRegisterFeeShare) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgRegisterFeeShareResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1307,7 +1260,6 @@ func (m *MsgRegisterFeeShareResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateFeeShare) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1454,7 +1406,6 @@ func (m *MsgUpdateFeeShare) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateFeeShareResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1505,7 +1456,6 @@ func (m *MsgUpdateFeeShareResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgCancelFeeShare) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1620,7 +1570,6 @@ func (m *MsgCancelFeeShare) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgCancelFeeShareResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1671,7 +1620,6 @@ func (m *MsgCancelFeeShareResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1787,7 +1735,6 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1838,7 +1785,6 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } - func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/feeshare/types/tx.pb.gw.go b/x/feeshare/types/tx.pb.gw.go index e87ddbd..55822b3 100644 --- a/x/feeshare/types/tx.pb.gw.go +++ b/x/feeshare/types/tx.pb.gw.go @@ -25,18 +25,18 @@ import ( ) // Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = descriptor.ForMessage - _ = metadata.Join + filter_Msg_RegisterFeeShare_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -var filter_Msg_RegisterFeeShare_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} - func request_Msg_RegisterFeeShare_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgRegisterFeeShare var metadata runtime.ServerMetadata @@ -50,6 +50,7 @@ func request_Msg_RegisterFeeShare_0(ctx context.Context, marshaler runtime.Marsh msg, err := client.RegisterFeeShare(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Msg_RegisterFeeShare_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -65,9 +66,12 @@ func local_request_Msg_RegisterFeeShare_0(ctx context.Context, marshaler runtime msg, err := server.RegisterFeeShare(ctx, &protoReq) return msg, metadata, err + } -var filter_Msg_UpdateFeeShare_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +var ( + filter_Msg_UpdateFeeShare_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) func request_Msg_UpdateFeeShare_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgUpdateFeeShare @@ -82,6 +86,7 @@ func request_Msg_UpdateFeeShare_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.UpdateFeeShare(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Msg_UpdateFeeShare_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -97,9 +102,12 @@ func local_request_Msg_UpdateFeeShare_0(ctx context.Context, marshaler runtime.M msg, err := server.UpdateFeeShare(ctx, &protoReq) return msg, metadata, err + } -var filter_Msg_CancelFeeShare_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +var ( + filter_Msg_CancelFeeShare_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) func request_Msg_CancelFeeShare_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq MsgCancelFeeShare @@ -114,6 +122,7 @@ func request_Msg_CancelFeeShare_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.CancelFeeShare(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Msg_CancelFeeShare_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -129,6 +138,7 @@ func local_request_Msg_CancelFeeShare_0(ctx context.Context, marshaler runtime.M msg, err := server.CancelFeeShare(ctx, &protoReq) return msg, metadata, err + } // RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". @@ -136,6 +146,7 @@ func local_request_Msg_CancelFeeShare_0(ctx context.Context, marshaler runtime.M // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + mux.Handle("POST", pattern_Msg_RegisterFeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -156,6 +167,7 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_RegisterFeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("POST", pattern_Msg_UpdateFeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -178,6 +190,7 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_UpdateFeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("POST", pattern_Msg_CancelFeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -200,6 +213,7 @@ func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server } forward_Msg_CancelFeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -242,6 +256,7 @@ func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.C // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "MsgClient" to call the correct interceptors. func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + mux.Handle("POST", pattern_Msg_RegisterFeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -259,6 +274,7 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_RegisterFeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("POST", pattern_Msg_UpdateFeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -278,6 +294,7 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_UpdateFeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("POST", pattern_Msg_CancelFeeShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -297,6 +314,7 @@ func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client } forward_Msg_CancelFeeShare_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil diff --git a/x/globalfee/alias.go b/x/globalfee/alias.go index 13f4a5e..3a16d3a 100644 --- a/x/globalfee/alias.go +++ b/x/globalfee/alias.go @@ -1,7 +1,7 @@ package globalfee import ( - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) const ( diff --git a/x/globalfee/ante/antetest/fee_test_setup.go.archive b/x/globalfee/ante/antetest/fee_test_setup.go.archive index 7d37020..b504011 100644 --- a/x/globalfee/ante/antetest/fee_test_setup.go.archive +++ b/x/globalfee/ante/antetest/fee_test_setup.go.archive @@ -17,9 +17,9 @@ import ( "github.com/terpnetwork/terp-core/app" appparams "github.com/terpnetwork/terp-core/app/params" - "github.com/terpnetwork/terp-core/x/globalfee" - gaiafeeante "github.com/terpnetwork/terp-core/x/globalfee/ante" - globfeetypes "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee" + gaiafeeante "github.com/terpnetwork/terp-core/v2/x/globalfee/ante" + globfeetypes "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) type IntegrationTestSuite struct { diff --git a/x/globalfee/ante/fee.go b/x/globalfee/ante/fee.go index 6efc249..0f03279 100644 --- a/x/globalfee/ante/fee.go +++ b/x/globalfee/ante/fee.go @@ -11,7 +11,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - globalfeekeeper "github.com/terpnetwork/terp-core/x/globalfee/keeper" + globalfeekeeper "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" ) // FeeWithBypassDecorator checks if the transaction's fee is at least as large diff --git a/x/globalfee/client/cli/query.go b/x/globalfee/client/cli/query.go index 67a9ede..415a1cb 100644 --- a/x/globalfee/client/cli/query.go +++ b/x/globalfee/client/cli/query.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) func GetQueryCmd() *cobra.Command { diff --git a/x/globalfee/genesis_test.go b/x/globalfee/genesis_test.go index eb15cad..79e4ce1 100644 --- a/x/globalfee/genesis_test.go +++ b/x/globalfee/genesis_test.go @@ -15,9 +15,9 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - appparams "github.com/terpnetwork/terp-core/app/params" - globalfeekeeper "github.com/terpnetwork/terp-core/x/globalfee/keeper" - "github.com/terpnetwork/terp-core/x/globalfee/types" + appparams "github.com/terpnetwork/terp-core/v2/app/params" + globalfeekeeper "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) func TestDefaultGenesis(t *testing.T) { diff --git a/x/globalfee/keeper/keeper.go b/x/globalfee/keeper/keeper.go index 0a04774..6919f83 100644 --- a/x/globalfee/keeper/keeper.go +++ b/x/globalfee/keeper/keeper.go @@ -5,7 +5,7 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) // Keeper of the globalfee store diff --git a/x/globalfee/keeper/migrator.go b/x/globalfee/keeper/migrator.go index 49c4536..747b1be 100644 --- a/x/globalfee/keeper/migrator.go +++ b/x/globalfee/keeper/migrator.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v2 "github.com/terpnetwork/terp-core/x/globalfee/migrations/v2" + v2 "github.com/terpnetwork/terp-core/v2/x/globalfee/migrations/v2" ) // Migrator is a struct for handling in-place state migrations. diff --git a/x/globalfee/keeper/msg_server.go b/x/globalfee/keeper/msg_server.go index d9be11e..cef1608 100644 --- a/x/globalfee/keeper/msg_server.go +++ b/x/globalfee/keeper/msg_server.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) var _ types.MsgServer = msgServer{} diff --git a/x/globalfee/migrations/v2/migrate.go b/x/globalfee/migrations/v2/migrate.go index 683ddc2..aa0a219 100644 --- a/x/globalfee/migrations/v2/migrate.go +++ b/x/globalfee/migrations/v2/migrate.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) const ( diff --git a/x/globalfee/migrations/v2/migrator_test.go b/x/globalfee/migrations/v2/migrator_test.go index fc9ea9d..f2a9ed6 100644 --- a/x/globalfee/migrations/v2/migrator_test.go +++ b/x/globalfee/migrations/v2/migrator_test.go @@ -9,10 +9,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/terpnetwork/terp-core/x/globalfee" - "github.com/terpnetwork/terp-core/x/globalfee/keeper/exported" - v2 "github.com/terpnetwork/terp-core/x/globalfee/migrations/v2" - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee" + "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper/exported" + v2 "github.com/terpnetwork/terp-core/v2/x/globalfee/migrations/v2" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) //lint:ignore U1000 disregard lint check diff --git a/x/globalfee/module.go b/x/globalfee/module.go index d95fcaf..e54b45f 100644 --- a/x/globalfee/module.go +++ b/x/globalfee/module.go @@ -19,9 +19,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/terpnetwork/terp-core/x/globalfee/client/cli" - "github.com/terpnetwork/terp-core/x/globalfee/keeper" - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee/client/cli" + "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) var ( diff --git a/x/globalfee/querier.go b/x/globalfee/querier.go index 9fc8d52..90e36a5 100644 --- a/x/globalfee/querier.go +++ b/x/globalfee/querier.go @@ -5,8 +5,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/globalfee/keeper" - "github.com/terpnetwork/terp-core/x/globalfee/types" + "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) var _ types.QueryServer = &GrpcQuerier{} diff --git a/x/globalfee/querier_test.go b/x/globalfee/querier_test.go index 2b1e871..e0d0ff8 100644 --- a/x/globalfee/querier_test.go +++ b/x/globalfee/querier_test.go @@ -8,8 +8,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - globalfeekeeper "github.com/terpnetwork/terp-core/x/globalfee/keeper" - "github.com/terpnetwork/terp-core/x/globalfee/types" + globalfeekeeper "github.com/terpnetwork/terp-core/v2/x/globalfee/keeper" + "github.com/terpnetwork/terp-core/v2/x/globalfee/types" ) func TestQueryMinimumGasPrices(t *testing.T) { diff --git a/x/globalfee/types/genesis.pb.go b/x/globalfee/types/genesis.pb.go index a478fad..9c91da8 100644 --- a/x/globalfee/types/genesis.pb.go +++ b/x/globalfee/types/genesis.pb.go @@ -5,22 +5,19 @@ package types import ( fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -40,11 +37,9 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_015b3e8b7a7c65c5, []int{0} } - func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -57,15 +52,12 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } - func (m *GenesisState) XXX_Size() int { return m.Size() } - func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -95,11 +87,9 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_015b3e8b7a7c65c5, []int{1} } - func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -112,15 +102,12 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } - func (m *Params) XXX_Size() int { return m.Size() } - func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -249,7 +236,6 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -279,11 +265,9 @@ func (m *Params) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -367,7 +351,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } - func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -452,7 +435,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } - func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/globalfee/types/query.pb.go b/x/globalfee/types/query.pb.go index 23b7cf8..5b87eb6 100644 --- a/x/globalfee/types/query.pb.go +++ b/x/globalfee/types/query.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" @@ -19,14 +15,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -36,7 +33,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryMinimumGasPricesRequest is the request type for the // Query/MinimumGasPrices RPC method. -type QueryMinimumGasPricesRequest struct{} +type QueryMinimumGasPricesRequest struct { +} func (m *QueryMinimumGasPricesRequest) Reset() { *m = QueryMinimumGasPricesRequest{} } func (m *QueryMinimumGasPricesRequest) String() string { return proto.CompactTextString(m) } @@ -44,11 +42,9 @@ func (*QueryMinimumGasPricesRequest) ProtoMessage() {} func (*QueryMinimumGasPricesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_12a736cede25d10a, []int{0} } - func (m *QueryMinimumGasPricesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryMinimumGasPricesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMinimumGasPricesRequest.Marshal(b, m, deterministic) @@ -61,15 +57,12 @@ func (m *QueryMinimumGasPricesRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryMinimumGasPricesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMinimumGasPricesRequest.Merge(m, src) } - func (m *QueryMinimumGasPricesRequest) XXX_Size() int { return m.Size() } - func (m *QueryMinimumGasPricesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryMinimumGasPricesRequest.DiscardUnknown(m) } @@ -88,11 +81,9 @@ func (*QueryMinimumGasPricesResponse) ProtoMessage() {} func (*QueryMinimumGasPricesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_12a736cede25d10a, []int{1} } - func (m *QueryMinimumGasPricesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryMinimumGasPricesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryMinimumGasPricesResponse.Marshal(b, m, deterministic) @@ -105,15 +96,12 @@ func (m *QueryMinimumGasPricesResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } - func (m *QueryMinimumGasPricesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryMinimumGasPricesResponse.Merge(m, src) } - func (m *QueryMinimumGasPricesResponse) XXX_Size() int { return m.Size() } - func (m *QueryMinimumGasPricesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryMinimumGasPricesResponse.DiscardUnknown(m) } @@ -165,10 +153,8 @@ var fileDescriptor_12a736cede25d10a = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var ( - _ context.Context - _ grpc.ClientConn -) +var _ context.Context +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -178,6 +164,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // MinimumGasPrices returns the minimum gas prices. MinimumGasPrices(ctx context.Context, in *QueryMinimumGasPricesRequest, opts ...grpc.CallOption) (*QueryMinimumGasPricesResponse, error) } @@ -200,11 +187,13 @@ func (c *queryClient) MinimumGasPrices(ctx context.Context, in *QueryMinimumGasP // QueryServer is the server API for Query service. type QueryServer interface { + // MinimumGasPrices returns the minimum gas prices. MinimumGasPrices(context.Context, *QueryMinimumGasPricesRequest) (*QueryMinimumGasPricesResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct{} +type UnimplementedQueryServer struct { +} func (*UnimplementedQueryServer) MinimumGasPrices(ctx context.Context, req *QueryMinimumGasPricesRequest) (*QueryMinimumGasPricesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MinimumGasPrices not implemented") @@ -316,7 +305,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *QueryMinimumGasPricesRequest) Size() (n int) { if m == nil { return 0 @@ -344,11 +332,9 @@ func (m *QueryMinimumGasPricesResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *QueryMinimumGasPricesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -399,7 +385,6 @@ func (m *QueryMinimumGasPricesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryMinimumGasPricesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -484,7 +469,6 @@ func (m *QueryMinimumGasPricesResponse) Unmarshal(dAtA []byte) error { } return nil } - func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/globalfee/types/query.pb.gw.go b/x/globalfee/types/query.pb.gw.go index 123396e..a7b2956 100644 --- a/x/globalfee/types/query.pb.gw.go +++ b/x/globalfee/types/query.pb.gw.go @@ -25,15 +25,13 @@ import ( ) // Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = descriptor.ForMessage - _ = metadata.Join -) +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_MinimumGasPrices_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryMinimumGasPricesRequest @@ -41,6 +39,7 @@ func request_Query_MinimumGasPrices_0(ctx context.Context, marshaler runtime.Mar msg, err := client.MinimumGasPrices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_MinimumGasPrices_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -49,6 +48,7 @@ func local_request_Query_MinimumGasPrices_0(ctx context.Context, marshaler runti msg, err := server.MinimumGasPrices(ctx, &protoReq) return msg, metadata, err + } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -56,6 +56,7 @@ func local_request_Query_MinimumGasPrices_0(ctx context.Context, marshaler runti // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_MinimumGasPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -76,6 +77,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_MinimumGasPrices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -118,6 +120,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_MinimumGasPrices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -135,11 +138,16 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_MinimumGasPrices_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } -var pattern_Query_MinimumGasPrices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"gaia", "globalfee", "v1beta1", "minimum_gas_prices"}, "", runtime.AssumeColonVerbOpt(false))) +var ( + pattern_Query_MinimumGasPrices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"gaia", "globalfee", "v1beta1", "minimum_gas_prices"}, "", runtime.AssumeColonVerbOpt(false))) +) -var forward_Query_MinimumGasPrices_0 = runtime.ForwardResponseMessage +var ( + forward_Query_MinimumGasPrices_0 = runtime.ForwardResponseMessage +) diff --git a/x/globalfee/types/tx.pb.go b/x/globalfee/types/tx.pb.go index c5d9b2c..5438344 100644 --- a/x/globalfee/types/tx.pb.go +++ b/x/globalfee/types/tx.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" @@ -18,14 +14,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -51,11 +48,9 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_1b7ff262ac5784d9, []int{0} } - func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -68,15 +63,12 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } - func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } - func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } - func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -101,7 +93,8 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct{} +type MsgUpdateParamsResponse struct { +} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -109,11 +102,9 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_1b7ff262ac5784d9, []int{1} } - func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -126,15 +117,12 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } - func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } - func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -174,10 +162,8 @@ var fileDescriptor_1b7ff262ac5784d9 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var ( - _ context.Context - _ grpc.ClientConn -) +var _ context.Context +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -221,7 +207,8 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct{} +type UnimplementedMsgServer struct { +} func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") @@ -336,7 +323,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 @@ -364,11 +350,9 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -484,7 +468,6 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -535,7 +518,6 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } - func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenfactory/bindings/custom_msg_test.go b/x/tokenfactory/bindings/custom_msg_test.go index 59d736e..22d56d7 100644 --- a/x/tokenfactory/bindings/custom_msg_test.go +++ b/x/tokenfactory/bindings/custom_msg_test.go @@ -11,9 +11,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/app" - bindings "github.com/terpnetwork/terp-core/x/tokenfactory/bindings/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/app" + bindings "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func TestCreateDenomMsg(t *testing.T) { diff --git a/x/tokenfactory/bindings/custom_query_test.go b/x/tokenfactory/bindings/custom_query_test.go index dae50a8..e603a7c 100644 --- a/x/tokenfactory/bindings/custom_query_test.go +++ b/x/tokenfactory/bindings/custom_query_test.go @@ -10,8 +10,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/app" - bindings "github.com/terpnetwork/terp-core/x/tokenfactory/bindings/types" + "github.com/terpnetwork/terp-core/v2/app" + bindings "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings/types" ) func TestQueryFullDenom(t *testing.T) { diff --git a/x/tokenfactory/bindings/helpers_test.go b/x/tokenfactory/bindings/helpers_test.go index 5f584c1..6b4f840 100644 --- a/x/tokenfactory/bindings/helpers_test.go +++ b/x/tokenfactory/bindings/helpers_test.go @@ -15,7 +15,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" - "github.com/terpnetwork/terp-core/app" + "github.com/terpnetwork/terp-core/v2/app" ) func CreateTestInput(t *testing.T) (*app.TerpApp, sdk.Context) { diff --git a/x/tokenfactory/bindings/message_plugin.go b/x/tokenfactory/bindings/message_plugin.go index e71187a..78d7f2c 100644 --- a/x/tokenfactory/bindings/message_plugin.go +++ b/x/tokenfactory/bindings/message_plugin.go @@ -13,9 +13,9 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - bindingstypes "github.com/terpnetwork/terp-core/x/tokenfactory/bindings/types" - tokenfactorykeeper "github.com/terpnetwork/terp-core/x/tokenfactory/keeper" - tokenfactorytypes "github.com/terpnetwork/terp-core/x/tokenfactory/types" + bindingstypes "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings/types" + tokenfactorykeeper "github.com/terpnetwork/terp-core/v2/x/tokenfactory/keeper" + tokenfactorytypes "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // CustomMessageDecorator returns decorator for custom CosmWasm bindings messages diff --git a/x/tokenfactory/bindings/queries.go b/x/tokenfactory/bindings/queries.go index 15dd308..75a21d1 100644 --- a/x/tokenfactory/bindings/queries.go +++ b/x/tokenfactory/bindings/queries.go @@ -6,8 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - bindingstypes "github.com/terpnetwork/terp-core/x/tokenfactory/bindings/types" - tokenfactorykeeper "github.com/terpnetwork/terp-core/x/tokenfactory/keeper" + bindingstypes "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings/types" + tokenfactorykeeper "github.com/terpnetwork/terp-core/v2/x/tokenfactory/keeper" ) type QueryPlugin struct { diff --git a/x/tokenfactory/bindings/query_plugin.go b/x/tokenfactory/bindings/query_plugin.go index 8fef701..f934663 100644 --- a/x/tokenfactory/bindings/query_plugin.go +++ b/x/tokenfactory/bindings/query_plugin.go @@ -11,7 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - bindingstypes "github.com/terpnetwork/terp-core/x/tokenfactory/bindings/types" + bindingstypes "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings/types" ) // CustomQuerier dispatches custom CosmWasm bindings queries. diff --git a/x/tokenfactory/bindings/validate_msg_test.go b/x/tokenfactory/bindings/validate_msg_test.go index 5f2cd8c..0d94920 100644 --- a/x/tokenfactory/bindings/validate_msg_test.go +++ b/x/tokenfactory/bindings/validate_msg_test.go @@ -8,9 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - wasmbinding "github.com/terpnetwork/terp-core/x/tokenfactory/bindings" - bindings "github.com/terpnetwork/terp-core/x/tokenfactory/bindings/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + wasmbinding "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings" + bindings "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func TestCreateDenom(t *testing.T) { diff --git a/x/tokenfactory/bindings/validate_queries_test.go b/x/tokenfactory/bindings/validate_queries_test.go index 2a487e4..d9095c8 100644 --- a/x/tokenfactory/bindings/validate_queries_test.go +++ b/x/tokenfactory/bindings/validate_queries_test.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - wasmbinding "github.com/terpnetwork/terp-core/x/tokenfactory/bindings" + wasmbinding "github.com/terpnetwork/terp-core/v2/x/tokenfactory/bindings" ) func TestFullDenom(t *testing.T) { diff --git a/x/tokenfactory/bindings/wasm.go b/x/tokenfactory/bindings/wasm.go index ddbf3de..fd77a21 100644 --- a/x/tokenfactory/bindings/wasm.go +++ b/x/tokenfactory/bindings/wasm.go @@ -5,7 +5,7 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - tokenfactorykeeper "github.com/terpnetwork/terp-core/x/tokenfactory/keeper" + tokenfactorykeeper "github.com/terpnetwork/terp-core/v2/x/tokenfactory/keeper" ) func RegisterCustomPlugins( diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 843a067..d76648e 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // GetQueryCmd returns the cli query commands for this module diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index d1c20ed..059dd24 100644 --- a/x/tokenfactory/client/cli/tx.go +++ b/x/tokenfactory/client/cli/tx.go @@ -13,7 +13,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/tokenfactory/keeper/admins.go b/x/tokenfactory/keeper/admins.go index 33e4888..ba4aa7c 100644 --- a/x/tokenfactory/keeper/admins.go +++ b/x/tokenfactory/keeper/admins.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // GetAuthorityMetadata returns the authority metadata for a specific denom diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index e2fb813..ac602a5 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -6,14 +6,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func (suite *KeeperTestSuite) TestAdminMsgs() { addr0bal := int64(0) addr1bal := int64(0) - bankKeeper := suite.app.BankKeeper + bankKeeper := suite.App.BankKeeper suite.CreateDefaultDenom() // Make sure that the admin is set correctly @@ -33,15 +33,15 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { _, err = suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMintTo(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 10), suite.TestAccs[1].String())) addr1bal += 10 suite.Require().NoError(err) - suite.Require().True(suite.app.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.app.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) // Test force transferring _, err = suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), types.NewMsgForceTransfer(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5), suite.TestAccs[1].String(), suite.TestAccs[0].String())) addr1bal -= 5 addr0bal += 5 suite.Require().NoError(err) - suite.Require().True(suite.app.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, suite.app.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) - suite.Require().True(suite.app.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.app.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom).Amount.Int64() == addr0bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.defaultDenom)) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom).Amount.Int64() == addr1bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], suite.defaultDenom)) // Test burning from own account _, err = suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(suite.TestAccs[0].String(), sdk.NewInt64Coin(suite.defaultDenom, 5))) @@ -131,6 +131,7 @@ func (suite *KeeperTestSuite) TestMintDenom() { }, } { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { + tc := tc _, err := suite.msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), &tc.mintMsg) if tc.expectPass { suite.Require().NoError(err) @@ -140,7 +141,7 @@ func (suite *KeeperTestSuite) TestMintDenom() { } mintToAddr, _ := sdk.AccAddressFromBech32(tc.mintMsg.MintToAddress) - bal := suite.app.BankKeeper.GetBalance(suite.Ctx, mintToAddr, suite.defaultDenom).Amount + bal := suite.App.BankKeeper.GetBalance(suite.Ctx, mintToAddr, suite.defaultDenom).Amount suite.Require().Equal(bal.Int64(), balances[tc.mintMsg.MintToAddress]) }) } @@ -207,6 +208,7 @@ func (suite *KeeperTestSuite) TestBurnDenom() { }, } { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { + tc := tc _, err := suite.msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), &tc.burnMsg) if tc.expectPass { suite.Require().NoError(err) @@ -216,7 +218,7 @@ func (suite *KeeperTestSuite) TestBurnDenom() { } burnFromAddr, _ := sdk.AccAddressFromBech32(tc.burnMsg.BurnFromAddress) - bal := suite.app.BankKeeper.GetBalance(suite.Ctx, burnFromAddr, suite.defaultDenom).Amount + bal := suite.App.BankKeeper.GetBalance(suite.Ctx, burnFromAddr, suite.defaultDenom).Amount suite.Require().Equal(bal.Int64(), balances[tc.burnMsg.BurnFromAddress]) }) } @@ -281,6 +283,7 @@ func (suite *KeeperTestSuite) TestForceTransferDenom() { }, } { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { + tc := tc _, err := suite.msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), &tc.forceTransferMsg) if tc.expectPass { suite.Require().NoError(err) @@ -293,12 +296,12 @@ func (suite *KeeperTestSuite) TestForceTransferDenom() { fromAddr, err := sdk.AccAddressFromBech32(tc.forceTransferMsg.TransferFromAddress) suite.Require().NoError(err) - fromBal := suite.app.BankKeeper.GetBalance(suite.Ctx, fromAddr, suite.defaultDenom).Amount + fromBal := suite.App.BankKeeper.GetBalance(suite.Ctx, fromAddr, suite.defaultDenom).Amount suite.Require().True(fromBal.Int64() == balances[tc.forceTransferMsg.TransferFromAddress]) toAddr, err := sdk.AccAddressFromBech32(tc.forceTransferMsg.TransferToAddress) suite.Require().NoError(err) - toBal := suite.app.BankKeeper.GetBalance(suite.Ctx, toAddr, suite.defaultDenom).Amount + toBal := suite.App.BankKeeper.GetBalance(suite.Ctx, toAddr, suite.defaultDenom).Amount suite.Require().True(toBal.Int64() == balances[tc.forceTransferMsg.TransferToAddress]) }) } @@ -505,7 +508,8 @@ func (suite *KeeperTestSuite) TestSetDenomMetaData() { }, } { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - bankKeeper := suite.app.BankKeeper + tc := tc + bankKeeper := suite.App.BankKeeper res, err := suite.msgServer.SetDenomMetadata(sdk.WrapSDKContext(suite.Ctx), &tc.msgSetDenomMetadata) if tc.expectedPass { suite.Require().NoError(err) diff --git a/x/tokenfactory/keeper/bankactions.go b/x/tokenfactory/keeper/bankactions.go index 3213d39..dbe92b5 100644 --- a/x/tokenfactory/keeper/bankactions.go +++ b/x/tokenfactory/keeper/bankactions.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func (k Keeper) mintTo(ctx sdk.Context, amount sdk.Coin, mintTo string) error { diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 0443d4a..5411ca8 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // ConvertToBaseToken converts a fee amount in a whitelisted fee token to the base fee token amount diff --git a/x/tokenfactory/keeper/createdenom_test.go b/x/tokenfactory/keeper/createdenom_test.go index cd74069..b64c50a 100644 --- a/x/tokenfactory/keeper/createdenom_test.go +++ b/x/tokenfactory/keeper/createdenom_test.go @@ -6,14 +6,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/app/apptesting" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/app/apptesting" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func (suite *KeeperTestSuite) TestMsgCreateDenom() { var ( - tokenFactoryKeeper = suite.app.TokenFactoryKeeper - bankKeeper = suite.app.BankKeeper + tokenFactoryKeeper = suite.App.TokenFactoryKeeper + bankKeeper = suite.App.BankKeeper denomCreationFee = tokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee ) @@ -138,8 +138,8 @@ func (suite *KeeperTestSuite) TestCreateDenom() { if tc.setup != nil { tc.setup() } - tokenFactoryKeeper := suite.app.TokenFactoryKeeper - bankKeeper := suite.app.BankKeeper + tokenFactoryKeeper := suite.App.TokenFactoryKeeper + bankKeeper := suite.App.BankKeeper // Set denom creation fee in params if err := tokenFactoryKeeper.SetParams(suite.Ctx, tc.denomCreationFee); err != nil { suite.Require().NoError(err) diff --git a/x/tokenfactory/keeper/genesis.go b/x/tokenfactory/keeper/genesis.go index cec4897..dfd5875 100644 --- a/x/tokenfactory/keeper/genesis.go +++ b/x/tokenfactory/keeper/genesis.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // InitGenesis initializes the tokenfactory module's state from a provided genesis diff --git a/x/tokenfactory/keeper/genesis_test.go b/x/tokenfactory/keeper/genesis_test.go index 017b51c..71e8711 100644 --- a/x/tokenfactory/keeper/genesis_test.go +++ b/x/tokenfactory/keeper/genesis_test.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func (suite *KeeperTestSuite) TestGenesis() { diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index cc16b84..5ced656 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) var _ types.QueryServer = Keeper{} diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 092fef7..2eb024d 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -11,7 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) type ( diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index bf2102d..ec06ea1 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -10,9 +10,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/app/apptesting" - "github.com/terpnetwork/terp-core/x/tokenfactory/keeper" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/app/apptesting" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/keeper" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) type KeeperTestSuite struct { @@ -40,7 +40,7 @@ func (suite *KeeperTestSuite) SetupTest() { suite.queryClient = types.NewQueryClient(suite.QueryHelper) suite.bankQueryClient = banktypes.NewQueryClient(suite.QueryHelper) - suite.msgServer = keeper.NewMsgServerImpl(suite.app.TokenFactoryKeeper) + suite.msgServer = keeper.NewMsgServerImpl(suite.App.TokenFactoryKeeper) } func (suite *KeeperTestSuite) CreateDefaultDenom() { diff --git a/x/tokenfactory/keeper/migrator.go b/x/tokenfactory/keeper/migrator.go index 7d7df92..0a5ac69 100644 --- a/x/tokenfactory/keeper/migrator.go +++ b/x/tokenfactory/keeper/migrator.go @@ -6,8 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/exported" - v2 "github.com/terpnetwork/terp-core/x/tokenfactory/migrations/v2" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/exported" + v2 "github.com/terpnetwork/terp-core/v2/x/tokenfactory/migrations/v2" ) // Migrator is a struct for handling in-place state migrations. diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index 0440cd2..098db8e 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) type msgServer struct { diff --git a/x/tokenfactory/keeper/msg_server_test.go b/x/tokenfactory/keeper/msg_server_test.go index 06d8b41..e341568 100644 --- a/x/tokenfactory/keeper/msg_server_test.go +++ b/x/tokenfactory/keeper/msg_server_test.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // TestMintDenomMsg tests TypeMsgMint message is emitted on a successful mint @@ -115,7 +115,7 @@ func (suite *KeeperTestSuite) TestCreateDenomMsg() { } { suite.SetupTest() suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { - tokenFactoryKeeper := suite.app.TokenFactoryKeeper + tokenFactoryKeeper := suite.App.TokenFactoryKeeper ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) suite.Require().Equal(0, len(ctx.EventManager().Events())) // Set denom creation fee in params @@ -238,6 +238,7 @@ func (suite *KeeperTestSuite) TestSetDenomMetaDataMsg() { }, } { suite.Run(fmt.Sprintf("Case %s", tc.desc), func() { + tc := tc ctx := suite.Ctx.WithEventManager(sdk.NewEventManager()) suite.Require().Equal(0, len(ctx.EventManager().Events())) // Test set denom metadata message diff --git a/x/tokenfactory/keeper/params.go b/x/tokenfactory/keeper/params.go index f105b0f..5949338 100644 --- a/x/tokenfactory/keeper/params.go +++ b/x/tokenfactory/keeper/params.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // GetParams returns the total set params. diff --git a/x/tokenfactory/migrations/v2/migrate.go b/x/tokenfactory/migrations/v2/migrate.go index 7a06cb5..689486c 100644 --- a/x/tokenfactory/migrations/v2/migrate.go +++ b/x/tokenfactory/migrations/v2/migrate.go @@ -4,8 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/exported" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/exported" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) const ModuleName = "tokenfactory" diff --git a/x/tokenfactory/migrations/v2/migrate_test.go b/x/tokenfactory/migrations/v2/migrate_test.go index 7d7ab41..0ed9fdd 100644 --- a/x/tokenfactory/migrations/v2/migrate_test.go +++ b/x/tokenfactory/migrations/v2/migrate_test.go @@ -9,10 +9,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/terpnetwork/terp-core/x/tokenfactory" - "github.com/terpnetwork/terp-core/x/tokenfactory/exported" - v2 "github.com/terpnetwork/terp-core/x/tokenfactory/migrations/v2" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/exported" + v2 "github.com/terpnetwork/terp-core/v2/x/tokenfactory/migrations/v2" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) type mockSubspace struct { diff --git a/x/tokenfactory/module.go b/x/tokenfactory/module.go index 45a4344..9f93f1d 100644 --- a/x/tokenfactory/module.go +++ b/x/tokenfactory/module.go @@ -26,11 +26,11 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/terpnetwork/terp-core/x/tokenfactory/client/cli" - "github.com/terpnetwork/terp-core/x/tokenfactory/exported" - "github.com/terpnetwork/terp-core/x/tokenfactory/keeper" - simulation "github.com/terpnetwork/terp-core/x/tokenfactory/simulation" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/client/cli" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/exported" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/keeper" + simulation "github.com/terpnetwork/terp-core/v2/x/tokenfactory/simulation" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) var ( diff --git a/x/tokenfactory/simulation/genesis.go b/x/tokenfactory/simulation/genesis.go index 311c615..3d2704e 100644 --- a/x/tokenfactory/simulation/genesis.go +++ b/x/tokenfactory/simulation/genesis.go @@ -6,8 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - appparams "github.com/terpnetwork/terp-core/app/params" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + appparams "github.com/terpnetwork/terp-core/v2/app/params" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func RandDenomCreationFeeParam(r *rand.Rand) sdk.Coins { diff --git a/x/tokenfactory/simulation/operations.go b/x/tokenfactory/simulation/operations.go index e6eae09..4936439 100644 --- a/x/tokenfactory/simulation/operations.go +++ b/x/tokenfactory/simulation/operations.go @@ -10,8 +10,8 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/simulation" - appparams "github.com/terpnetwork/terp-core/app/params" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + appparams "github.com/terpnetwork/terp-core/v2/app/params" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // Simulation operation weights constants diff --git a/x/tokenfactory/types/authorityMetadata.pb.go b/x/tokenfactory/types/authorityMetadata.pb.go index eba7853..92ad7ae 100644 --- a/x/tokenfactory/types/authorityMetadata.pb.go +++ b/x/tokenfactory/types/authorityMetadata.pb.go @@ -5,21 +5,18 @@ package types import ( fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -41,11 +38,9 @@ func (*DenomAuthorityMetadata) ProtoMessage() {} func (*DenomAuthorityMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_99435de88ae175f7, []int{0} } - func (m *DenomAuthorityMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *DenomAuthorityMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_DenomAuthorityMetadata.Marshal(b, m, deterministic) @@ -58,15 +53,12 @@ func (m *DenomAuthorityMetadata) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *DenomAuthorityMetadata) XXX_Merge(src proto.Message) { xxx_messageInfo_DenomAuthorityMetadata.Merge(m, src) } - func (m *DenomAuthorityMetadata) XXX_Size() int { return m.Size() } - func (m *DenomAuthorityMetadata) XXX_DiscardUnknown() { xxx_messageInfo_DenomAuthorityMetadata.DiscardUnknown(m) } @@ -132,7 +124,6 @@ func (this *DenomAuthorityMetadata) Equal(that interface{}) bool { } return true } - func (m *DenomAuthorityMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -174,7 +165,6 @@ func encodeVarintAuthorityMetadata(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *DenomAuthorityMetadata) Size() (n int) { if m == nil { return 0 @@ -191,11 +181,9 @@ func (m *DenomAuthorityMetadata) Size() (n int) { func sovAuthorityMetadata(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozAuthorityMetadata(x uint64) (n int) { return sovAuthorityMetadata(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *DenomAuthorityMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -278,7 +266,6 @@ func (m *DenomAuthorityMetadata) Unmarshal(dAtA []byte) error { } return nil } - func skipAuthorityMetadata(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenfactory/types/denoms_test.go b/x/tokenfactory/types/denoms_test.go index e9472c6..36f013e 100644 --- a/x/tokenfactory/types/denoms_test.go +++ b/x/tokenfactory/types/denoms_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func TestDeconstructDenom(t *testing.T) { diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go index 5915af8..fe6b208 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -5,20 +5,17 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" - - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -39,11 +36,9 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_5749c3f71850298b, []int{0} } - func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) @@ -56,15 +51,12 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *GenesisState) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState.Merge(m, src) } - func (m *GenesisState) XXX_Size() int { return m.Size() } - func (m *GenesisState) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState.DiscardUnknown(m) } @@ -99,11 +91,9 @@ func (*GenesisDenom) ProtoMessage() {} func (*GenesisDenom) Descriptor() ([]byte, []int) { return fileDescriptor_5749c3f71850298b, []int{1} } - func (m *GenesisDenom) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *GenesisDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisDenom.Marshal(b, m, deterministic) @@ -116,15 +106,12 @@ func (m *GenesisDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *GenesisDenom) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisDenom.Merge(m, src) } - func (m *GenesisDenom) XXX_Size() int { return m.Size() } - func (m *GenesisDenom) XXX_DiscardUnknown() { xxx_messageInfo_GenesisDenom.DiscardUnknown(m) } @@ -209,7 +196,6 @@ func (this *GenesisDenom) Equal(that interface{}) bool { } return true } - func (m *GenesisState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -308,7 +294,6 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -344,11 +329,9 @@ func (m *GenesisDenom) Size() (n int) { func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozGenesis(x uint64) (n int) { return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *GenesisState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -466,7 +449,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } - func (m *GenesisDenom) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -582,7 +564,6 @@ func (m *GenesisDenom) Unmarshal(dAtA []byte) error { } return nil } - func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenfactory/types/genesis_test.go b/x/tokenfactory/types/genesis_test.go index c93adb4..a3134d7 100644 --- a/x/tokenfactory/types/genesis_test.go +++ b/x/tokenfactory/types/genesis_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) func TestGenesisState_Validate(t *testing.T) { diff --git a/x/tokenfactory/types/msgs_test.go b/x/tokenfactory/types/msgs_test.go index b49fd63..8c31600 100644 --- a/x/tokenfactory/types/msgs_test.go +++ b/x/tokenfactory/types/msgs_test.go @@ -11,8 +11,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/terpnetwork/terp-core/x/tokenfactory/testhelpers" - "github.com/terpnetwork/terp-core/x/tokenfactory/types" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/testhelpers" + "github.com/terpnetwork/terp-core/v2/x/tokenfactory/types" ) // Test authz serialize and de-serializes for tokenfactory msg. diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 7916f41..c557cc3 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -5,23 +5,20 @@ package types import ( fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -44,11 +41,9 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_cc8299d306f3ff47, []int{0} } - func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Params.Marshal(b, m, deterministic) @@ -61,15 +56,12 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *Params) XXX_Merge(src proto.Message) { xxx_messageInfo_Params.Merge(m, src) } - func (m *Params) XXX_Size() int { return m.Size() } - func (m *Params) XXX_DiscardUnknown() { xxx_messageInfo_Params.DiscardUnknown(m) } @@ -178,7 +170,6 @@ func encodeVarintParams(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *Params) Size() (n int) { if m == nil { return 0 @@ -200,11 +191,9 @@ func (m *Params) Size() (n int) { func sovParams(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozParams(x uint64) (n int) { return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -308,7 +297,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } - func skipParams(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index cbb4cd7..757b909 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" @@ -18,14 +14,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -34,7 +31,8 @@ var ( const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct{} +type QueryParamsRequest struct { +} func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } @@ -42,11 +40,9 @@ func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_6f22013ad0f72e3f, []int{0} } - func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) @@ -59,15 +55,12 @@ func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsRequest.Merge(m, src) } - func (m *QueryParamsRequest) XXX_Size() int { return m.Size() } - func (m *QueryParamsRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) } @@ -86,11 +79,9 @@ func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_6f22013ad0f72e3f, []int{1} } - func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) @@ -103,15 +94,12 @@ func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryParamsResponse.Merge(m, src) } - func (m *QueryParamsResponse) XXX_Size() int { return m.Size() } - func (m *QueryParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) } @@ -137,11 +125,9 @@ func (*QueryDenomAuthorityMetadataRequest) ProtoMessage() {} func (*QueryDenomAuthorityMetadataRequest) Descriptor() ([]byte, []int) { return fileDescriptor_6f22013ad0f72e3f, []int{2} } - func (m *QueryDenomAuthorityMetadataRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryDenomAuthorityMetadataRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDenomAuthorityMetadataRequest.Marshal(b, m, deterministic) @@ -154,15 +140,12 @@ func (m *QueryDenomAuthorityMetadataRequest) XXX_Marshal(b []byte, deterministic return b[:n], nil } } - func (m *QueryDenomAuthorityMetadataRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDenomAuthorityMetadataRequest.Merge(m, src) } - func (m *QueryDenomAuthorityMetadataRequest) XXX_Size() int { return m.Size() } - func (m *QueryDenomAuthorityMetadataRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryDenomAuthorityMetadataRequest.DiscardUnknown(m) } @@ -188,11 +171,9 @@ func (*QueryDenomAuthorityMetadataResponse) ProtoMessage() {} func (*QueryDenomAuthorityMetadataResponse) Descriptor() ([]byte, []int) { return fileDescriptor_6f22013ad0f72e3f, []int{3} } - func (m *QueryDenomAuthorityMetadataResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryDenomAuthorityMetadataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDenomAuthorityMetadataResponse.Marshal(b, m, deterministic) @@ -205,15 +186,12 @@ func (m *QueryDenomAuthorityMetadataResponse) XXX_Marshal(b []byte, deterministi return b[:n], nil } } - func (m *QueryDenomAuthorityMetadataResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDenomAuthorityMetadataResponse.Merge(m, src) } - func (m *QueryDenomAuthorityMetadataResponse) XXX_Size() int { return m.Size() } - func (m *QueryDenomAuthorityMetadataResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryDenomAuthorityMetadataResponse.DiscardUnknown(m) } @@ -239,11 +217,9 @@ func (*QueryDenomsFromCreatorRequest) ProtoMessage() {} func (*QueryDenomsFromCreatorRequest) Descriptor() ([]byte, []int) { return fileDescriptor_6f22013ad0f72e3f, []int{4} } - func (m *QueryDenomsFromCreatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryDenomsFromCreatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDenomsFromCreatorRequest.Marshal(b, m, deterministic) @@ -256,15 +232,12 @@ func (m *QueryDenomsFromCreatorRequest) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } - func (m *QueryDenomsFromCreatorRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDenomsFromCreatorRequest.Merge(m, src) } - func (m *QueryDenomsFromCreatorRequest) XXX_Size() int { return m.Size() } - func (m *QueryDenomsFromCreatorRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryDenomsFromCreatorRequest.DiscardUnknown(m) } @@ -290,11 +263,9 @@ func (*QueryDenomsFromCreatorResponse) ProtoMessage() {} func (*QueryDenomsFromCreatorResponse) Descriptor() ([]byte, []int) { return fileDescriptor_6f22013ad0f72e3f, []int{5} } - func (m *QueryDenomsFromCreatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryDenomsFromCreatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryDenomsFromCreatorResponse.Marshal(b, m, deterministic) @@ -307,15 +278,12 @@ func (m *QueryDenomsFromCreatorResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } - func (m *QueryDenomsFromCreatorResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryDenomsFromCreatorResponse.Merge(m, src) } - func (m *QueryDenomsFromCreatorResponse) XXX_Size() int { return m.Size() } - func (m *QueryDenomsFromCreatorResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryDenomsFromCreatorResponse.DiscardUnknown(m) } @@ -383,10 +351,8 @@ var fileDescriptor_6f22013ad0f72e3f = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var ( - _ context.Context - _ grpc.ClientConn -) +var _ context.Context +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -456,16 +422,15 @@ type QueryServer interface { } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct{} +type UnimplementedQueryServer struct { +} func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } - func (*UnimplementedQueryServer) DenomAuthorityMetadata(ctx context.Context, req *QueryDenomAuthorityMetadataRequest) (*QueryDenomAuthorityMetadataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DenomAuthorityMetadata not implemented") } - func (*UnimplementedQueryServer) DenomsFromCreator(ctx context.Context, req *QueryDenomsFromCreatorRequest) (*QueryDenomsFromCreatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DenomsFromCreator not implemented") } @@ -741,7 +706,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 @@ -817,11 +781,9 @@ func (m *QueryDenomsFromCreatorResponse) Size() (n int) { func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -872,7 +834,6 @@ func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -956,7 +917,6 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1039,7 +999,6 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1123,7 +1082,6 @@ func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1206,7 +1164,6 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1289,7 +1246,6 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { } return nil } - func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index 39c5471..0b895e7 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -25,15 +25,13 @@ import ( ) // Suppress "imported and not used" errors -var ( - _ codes.Code - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = descriptor.ForMessage - _ = metadata.Join -) +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -41,6 +39,7 @@ func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, cl msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -49,6 +48,7 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal msg, err := server.Params(ctx, &protoReq) return msg, metadata, err + } func request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -75,6 +75,7 @@ func request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runti msg, err := client.DenomAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -101,6 +102,7 @@ func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler msg, err := server.DenomAuthorityMetadata(ctx, &protoReq) return msg, metadata, err + } func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -127,6 +129,7 @@ func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Ma msg, err := client.DenomsFromCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -153,6 +156,7 @@ func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runt msg, err := server.DenomsFromCreator(ctx, &protoReq) return msg, metadata, err + } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". @@ -160,6 +164,7 @@ func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runt // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -180,6 +185,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_DenomAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -202,6 +208,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_DenomAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_DenomsFromCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -224,6 +231,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_DenomsFromCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -266,6 +274,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -283,6 +292,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_DenomAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -302,6 +312,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_DenomAuthorityMetadata_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_DenomsFromCreator_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -321,6 +332,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_DenomsFromCreator_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go index 2577116..d47d5ed 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -20,14 +16,15 @@ import ( grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. -var ( - _ = proto.Marshal - _ = fmt.Errorf - _ = math.Inf -) +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -56,11 +53,9 @@ func (*MsgCreateDenom) ProtoMessage() {} func (*MsgCreateDenom) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{0} } - func (m *MsgCreateDenom) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgCreateDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCreateDenom.Marshal(b, m, deterministic) @@ -73,15 +68,12 @@ func (m *MsgCreateDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } - func (m *MsgCreateDenom) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCreateDenom.Merge(m, src) } - func (m *MsgCreateDenom) XXX_Size() int { return m.Size() } - func (m *MsgCreateDenom) XXX_DiscardUnknown() { xxx_messageInfo_MsgCreateDenom.DiscardUnknown(m) } @@ -114,11 +106,9 @@ func (*MsgCreateDenomResponse) ProtoMessage() {} func (*MsgCreateDenomResponse) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{1} } - func (m *MsgCreateDenomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgCreateDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgCreateDenomResponse.Marshal(b, m, deterministic) @@ -131,15 +121,12 @@ func (m *MsgCreateDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *MsgCreateDenomResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgCreateDenomResponse.Merge(m, src) } - func (m *MsgCreateDenomResponse) XXX_Size() int { return m.Size() } - func (m *MsgCreateDenomResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgCreateDenomResponse.DiscardUnknown(m) } @@ -167,11 +154,9 @@ func (*MsgMint) ProtoMessage() {} func (*MsgMint) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{2} } - func (m *MsgMint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgMint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgMint.Marshal(b, m, deterministic) @@ -184,15 +169,12 @@ func (m *MsgMint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *MsgMint) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgMint.Merge(m, src) } - func (m *MsgMint) XXX_Size() int { return m.Size() } - func (m *MsgMint) XXX_DiscardUnknown() { xxx_messageInfo_MsgMint.DiscardUnknown(m) } @@ -220,7 +202,8 @@ func (m *MsgMint) GetMintToAddress() string { return "" } -type MsgMintResponse struct{} +type MsgMintResponse struct { +} func (m *MsgMintResponse) Reset() { *m = MsgMintResponse{} } func (m *MsgMintResponse) String() string { return proto.CompactTextString(m) } @@ -228,11 +211,9 @@ func (*MsgMintResponse) ProtoMessage() {} func (*MsgMintResponse) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{3} } - func (m *MsgMintResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgMintResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgMintResponse.Marshal(b, m, deterministic) @@ -245,15 +226,12 @@ func (m *MsgMintResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } - func (m *MsgMintResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgMintResponse.Merge(m, src) } - func (m *MsgMintResponse) XXX_Size() int { return m.Size() } - func (m *MsgMintResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgMintResponse.DiscardUnknown(m) } @@ -274,11 +252,9 @@ func (*MsgBurn) ProtoMessage() {} func (*MsgBurn) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{4} } - func (m *MsgBurn) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgBurn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgBurn.Marshal(b, m, deterministic) @@ -291,15 +267,12 @@ func (m *MsgBurn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *MsgBurn) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgBurn.Merge(m, src) } - func (m *MsgBurn) XXX_Size() int { return m.Size() } - func (m *MsgBurn) XXX_DiscardUnknown() { xxx_messageInfo_MsgBurn.DiscardUnknown(m) } @@ -327,7 +300,8 @@ func (m *MsgBurn) GetBurnFromAddress() string { return "" } -type MsgBurnResponse struct{} +type MsgBurnResponse struct { +} func (m *MsgBurnResponse) Reset() { *m = MsgBurnResponse{} } func (m *MsgBurnResponse) String() string { return proto.CompactTextString(m) } @@ -335,11 +309,9 @@ func (*MsgBurnResponse) ProtoMessage() {} func (*MsgBurnResponse) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{5} } - func (m *MsgBurnResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgBurnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgBurnResponse.Marshal(b, m, deterministic) @@ -352,15 +324,12 @@ func (m *MsgBurnResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } - func (m *MsgBurnResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgBurnResponse.Merge(m, src) } - func (m *MsgBurnResponse) XXX_Size() int { return m.Size() } - func (m *MsgBurnResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgBurnResponse.DiscardUnknown(m) } @@ -381,11 +350,9 @@ func (*MsgChangeAdmin) ProtoMessage() {} func (*MsgChangeAdmin) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{6} } - func (m *MsgChangeAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgChangeAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgChangeAdmin.Marshal(b, m, deterministic) @@ -398,15 +365,12 @@ func (m *MsgChangeAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } - func (m *MsgChangeAdmin) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgChangeAdmin.Merge(m, src) } - func (m *MsgChangeAdmin) XXX_Size() int { return m.Size() } - func (m *MsgChangeAdmin) XXX_DiscardUnknown() { xxx_messageInfo_MsgChangeAdmin.DiscardUnknown(m) } @@ -436,7 +400,8 @@ func (m *MsgChangeAdmin) GetNewAdmin() string { // MsgChangeAdminResponse defines the response structure for an executed // MsgChangeAdmin message. -type MsgChangeAdminResponse struct{} +type MsgChangeAdminResponse struct { +} func (m *MsgChangeAdminResponse) Reset() { *m = MsgChangeAdminResponse{} } func (m *MsgChangeAdminResponse) String() string { return proto.CompactTextString(m) } @@ -444,11 +409,9 @@ func (*MsgChangeAdminResponse) ProtoMessage() {} func (*MsgChangeAdminResponse) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{7} } - func (m *MsgChangeAdminResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgChangeAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgChangeAdminResponse.Marshal(b, m, deterministic) @@ -461,15 +424,12 @@ func (m *MsgChangeAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *MsgChangeAdminResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgChangeAdminResponse.Merge(m, src) } - func (m *MsgChangeAdminResponse) XXX_Size() int { return m.Size() } - func (m *MsgChangeAdminResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgChangeAdminResponse.DiscardUnknown(m) } @@ -489,11 +449,9 @@ func (*MsgSetDenomMetadata) ProtoMessage() {} func (*MsgSetDenomMetadata) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{8} } - func (m *MsgSetDenomMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgSetDenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgSetDenomMetadata.Marshal(b, m, deterministic) @@ -506,15 +464,12 @@ func (m *MsgSetDenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *MsgSetDenomMetadata) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgSetDenomMetadata.Merge(m, src) } - func (m *MsgSetDenomMetadata) XXX_Size() int { return m.Size() } - func (m *MsgSetDenomMetadata) XXX_DiscardUnknown() { xxx_messageInfo_MsgSetDenomMetadata.DiscardUnknown(m) } @@ -537,7 +492,8 @@ func (m *MsgSetDenomMetadata) GetMetadata() types1.Metadata { // MsgSetDenomMetadataResponse defines the response structure for an executed // MsgSetDenomMetadata message. -type MsgSetDenomMetadataResponse struct{} +type MsgSetDenomMetadataResponse struct { +} func (m *MsgSetDenomMetadataResponse) Reset() { *m = MsgSetDenomMetadataResponse{} } func (m *MsgSetDenomMetadataResponse) String() string { return proto.CompactTextString(m) } @@ -545,11 +501,9 @@ func (*MsgSetDenomMetadataResponse) ProtoMessage() {} func (*MsgSetDenomMetadataResponse) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{9} } - func (m *MsgSetDenomMetadataResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgSetDenomMetadataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgSetDenomMetadataResponse.Marshal(b, m, deterministic) @@ -562,15 +516,12 @@ func (m *MsgSetDenomMetadataResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *MsgSetDenomMetadataResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgSetDenomMetadataResponse.Merge(m, src) } - func (m *MsgSetDenomMetadataResponse) XXX_Size() int { return m.Size() } - func (m *MsgSetDenomMetadataResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgSetDenomMetadataResponse.DiscardUnknown(m) } @@ -590,11 +541,9 @@ func (*MsgForceTransfer) ProtoMessage() {} func (*MsgForceTransfer) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{10} } - func (m *MsgForceTransfer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgForceTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgForceTransfer.Marshal(b, m, deterministic) @@ -607,15 +556,12 @@ func (m *MsgForceTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } - func (m *MsgForceTransfer) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgForceTransfer.Merge(m, src) } - func (m *MsgForceTransfer) XXX_Size() int { return m.Size() } - func (m *MsgForceTransfer) XXX_DiscardUnknown() { xxx_messageInfo_MsgForceTransfer.DiscardUnknown(m) } @@ -650,7 +596,8 @@ func (m *MsgForceTransfer) GetTransferToAddress() string { return "" } -type MsgForceTransferResponse struct{} +type MsgForceTransferResponse struct { +} func (m *MsgForceTransferResponse) Reset() { *m = MsgForceTransferResponse{} } func (m *MsgForceTransferResponse) String() string { return proto.CompactTextString(m) } @@ -658,11 +605,9 @@ func (*MsgForceTransferResponse) ProtoMessage() {} func (*MsgForceTransferResponse) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{11} } - func (m *MsgForceTransferResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgForceTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgForceTransferResponse.Marshal(b, m, deterministic) @@ -675,15 +620,12 @@ func (m *MsgForceTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } - func (m *MsgForceTransferResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgForceTransferResponse.Merge(m, src) } - func (m *MsgForceTransferResponse) XXX_Size() int { return m.Size() } - func (m *MsgForceTransferResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgForceTransferResponse.DiscardUnknown(m) } @@ -708,11 +650,9 @@ func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{12} } - func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) @@ -725,15 +665,12 @@ func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } - func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParams.Merge(m, src) } - func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } - func (m *MsgUpdateParams) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } @@ -758,7 +695,8 @@ func (m *MsgUpdateParams) GetParams() Params { // MsgUpdateParams message. // // Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct{} +type MsgUpdateParamsResponse struct { +} func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } @@ -766,11 +704,9 @@ func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_283b6c9a90a846b4, []int{13} } - func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) @@ -783,15 +719,12 @@ func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } - func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } - func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } @@ -879,10 +812,8 @@ var fileDescriptor_283b6c9a90a846b4 = []byte{ } // Reference imports to suppress errors if they are not otherwise used. -var ( - _ context.Context - _ grpc.ClientConn -) +var _ context.Context +var _ grpc.ClientConn // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. @@ -992,32 +923,27 @@ type MsgServer interface { } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct{} +type UnimplementedMsgServer struct { +} func (*UnimplementedMsgServer) CreateDenom(ctx context.Context, req *MsgCreateDenom) (*MsgCreateDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateDenom not implemented") } - func (*UnimplementedMsgServer) Mint(ctx context.Context, req *MsgMint) (*MsgMintResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") } - func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Burn not implemented") } - func (*UnimplementedMsgServer) ChangeAdmin(ctx context.Context, req *MsgChangeAdmin) (*MsgChangeAdminResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChangeAdmin not implemented") } - func (*UnimplementedMsgServer) SetDenomMetadata(ctx context.Context, req *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetDenomMetadata not implemented") } - func (*UnimplementedMsgServer) ForceTransfer(ctx context.Context, req *MsgForceTransfer) (*MsgForceTransferResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ForceTransfer not implemented") } - func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } @@ -1677,7 +1603,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *MsgCreateDenom) Size() (n int) { if m == nil { return 0 @@ -1877,11 +1802,9 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1996,7 +1919,6 @@ func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgCreateDenomResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2079,7 +2001,6 @@ func (m *MsgCreateDenomResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgMint) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2227,7 +2148,6 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2278,7 +2198,6 @@ func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgBurn) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2426,7 +2345,6 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2477,7 +2395,6 @@ func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2624,7 +2541,6 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2675,7 +2591,6 @@ func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgSetDenomMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2791,7 +2706,6 @@ func (m *MsgSetDenomMetadata) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgSetDenomMetadataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2842,7 +2756,6 @@ func (m *MsgSetDenomMetadataResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgForceTransfer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3022,7 +2935,6 @@ func (m *MsgForceTransfer) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgForceTransferResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3073,7 +2985,6 @@ func (m *MsgForceTransferResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3189,7 +3100,6 @@ func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3240,7 +3150,6 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } - func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0