diff --git a/app/app.go b/app/app.go index 154d03224..bf2f2ef15 100644 --- a/app/app.go +++ b/app/app.go @@ -248,6 +248,7 @@ func NewComposableApp( encodingConfig EncodingConfig, appOpts servertypes.AppOptions, wasmOpts []wasmkeeper.Option, + devnetGov *string, baseAppOptions ...func(*baseapp.BaseApp), ) *ComposableApp { appCodec := encodingConfig.Codec @@ -286,6 +287,7 @@ func NewComposableApp( homePath, appOpts, wasmOpts, + devnetGov, ) transferModule := transfer.NewAppModule(app.TransferKeeper) diff --git a/app/helpers/test_helpers.go b/app/helpers/test_helpers.go index 69b643e38..bd6e5c1bf 100644 --- a/app/helpers/test_helpers.go +++ b/app/helpers/test_helpers.go @@ -103,6 +103,7 @@ func setup(withGenesis bool, invCheckPeriod uint, opts ...wasmkeeper.Option) (*c encCdc, EmptyAppOptions{}, opts, + nil, ) if withGenesis { return app, composable.NewDefaultGenesisState() diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 0f60f8a44..80a5d5a26 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -148,6 +148,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( homePath string, appOpts servertypes.AppOptions, wasmOpts []wasmkeeper.Option, + devnetGov *string, ) { // add keepers appKeepers.AccountKeeper = authkeeper.NewAccountKeeper( @@ -228,6 +229,9 @@ func (appKeepers *AppKeepers) InitNormalKeepers( ) govModuleAuthority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + if devnetGov != nil { + govModuleAuthority = *devnetGov + } appKeepers.Wasm08Keeper = wasmclientkeeper.NewKeeper(appCodec, appKeepers.keys[wasm08types.StoreKey], govModuleAuthority, homePath, &appKeepers.IBCKeeper.ClientKeeper) @@ -322,7 +326,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers( wasmDir, wasmConfig, availableCapabilities, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + govModuleAuthority, wasmOpts..., ) diff --git a/app/test_helpers.go b/app/test_helpers.go index 40bc673c2..dd11c6de0 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -82,6 +82,7 @@ func setup(tb testing.TB, withGenesis bool, invCheckPeriod uint) (*ComposableApp MakeEncodingConfig(), EmptyBaseAppOptions{}, wasmOpts, + nil, baseAppOpts...) if withGenesis { return app, NewDefaultGenesisState() diff --git a/cmd/centaurid/cmd/root.go b/cmd/centaurid/cmd/root.go index 8cb43313f..ae2767257 100644 --- a/cmd/centaurid/cmd/root.go +++ b/cmd/centaurid/cmd/root.go @@ -35,6 +35,11 @@ import ( "github.com/cometbft/cometbft/libs/log" ) +const ( + // if set, than uses specific key for governance instead of default (default is production; this override for local devtest) + flagDevnetGov = "devnet-gov" +) + var ChainID string // NewRootCmd creates a new root command for simd. It is called once in the @@ -72,7 +77,6 @@ func NewRootCmd() (*cobra.Command, app.EncodingConfig) { if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { return err } - customAppTemplate, customAppConfig := initAppConfig() customTMConfig := initTendermintConfig() @@ -182,8 +186,8 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) { // this line is used by starport scaffolding # stargate/root/commands ) - a := appCreator{encodingConfig} - server.AddCommands(rootCmd, app.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags) + appCreator := appCreator{encodingConfig} + server.AddCommands(rootCmd, app.DefaultNodeHome, appCreator.newApp, appCreator.appExport, addModuleInitFlags) // add keybase, auxiliary RPC, query, and tx child commands rootCmd.AddCommand( @@ -196,6 +200,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig app.EncodingConfig) { func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) + startCmd.Flags().String(flagDevnetGov, "", "Sets the devnet governance key (if not set, uses the default production key)") // this line is used by starport scaffolding # stargate/root/initFlags } @@ -265,6 +270,11 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a skipUpgradeHeights[h] = true } + var devnetGov *string + devnetGovOption, _ := appOpts.Get(flagDevnetGov).(string) + if devnetGovOption != "" { + devnetGov = &devnetGovOption + } baseappOptions := server.DefaultBaseappOptions(appOpts) var emptyWasmOpts []wasmkeeper.Option @@ -277,6 +287,7 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a // this line is used by starport scaffolding # stargate/root/appArgument appOpts, emptyWasmOpts, + devnetGov, baseappOptions..., ) @@ -308,6 +319,7 @@ func (a appCreator) appExport( a.encCfg, appOpts, emptyWasmOpts, + nil, ) if err := anApp.LoadHeight(height); err != nil { @@ -325,6 +337,7 @@ func (a appCreator) appExport( a.encCfg, appOpts, emptyWasmOpts, + nil, ) } diff --git a/cmd/centaurid/cmd/testnet.go b/cmd/centaurid/cmd/testnet.go index 2411fe878..8df1d9f94 100644 --- a/cmd/centaurid/cmd/testnet.go +++ b/cmd/centaurid/cmd/testnet.go @@ -11,12 +11,6 @@ import ( "path/filepath" "github.com/CosmWasm/wasmd/app" - - tmconfig "github.com/cometbft/cometbft/config" - tmos "github.com/cometbft/cometbft/libs/os" - tmrand "github.com/cometbft/cometbft/libs/rand" - "github.com/cometbft/cometbft/types" - tmtime "github.com/cometbft/cometbft/types/time" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -36,6 +30,12 @@ import ( "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" + + tmconfig "github.com/cometbft/cometbft/config" + tmos "github.com/cometbft/cometbft/libs/os" + tmrand "github.com/cometbft/cometbft/libs/rand" + "github.com/cometbft/cometbft/types" + tmtime "github.com/cometbft/cometbft/types/time" ) var ( diff --git a/flake.nix b/flake.nix index 40dc1587c..fd77c004f 100644 --- a/flake.nix +++ b/flake.nix @@ -43,14 +43,16 @@ gci gnumake go + delve golangci-lint gomod2nix gotools + libwasmvm ]; }; }; - packages = { + packages = rec { centaurid = buildGoApplication rec { pname = "centaurid"; version = "v7.0.0"; @@ -66,7 +68,8 @@ -X github.com/cosmos/cosmos-sdk/version.Name=centauri -X github.com/cosmos/cosmos-sdk/version.AppName=${pname} -X github.com/cosmos/cosmos-sdk/version.Version=${version} -X github.com/cosmos/cosmos-sdk/version.Commit=${self.rev or self.dirtyRev or "dirty"} -X github.com/cometbft/cometbft/version.TMCoreSemVer=v0.37.2 ''; }; - default = pkgs.writeShellApplication { + default = ci; + ci = pkgs.writeShellApplication { name = "ci"; text = '' go get mvdan.cc/gofumpt diff --git a/x/transfermiddleware/keeper/keeper.go b/x/transfermiddleware/keeper/keeper.go index d8da0d929..f4ec52272 100644 --- a/x/transfermiddleware/keeper/keeper.go +++ b/x/transfermiddleware/keeper/keeper.go @@ -167,7 +167,16 @@ func (k Keeper) HasAllowRlyAddress(ctx sdk.Context, rlyAddress string) bool { store := ctx.KVStore(k.storeKey) key := types.GetKeyByRlyAddress(rlyAddress) - return store.Has(key) + if store.Has(key) { + return true + } + + prefixStore := prefix.NewStore(store, types.KeyRlyAddress) + iter := prefixStore.Iterator(nil, nil) + defer iter.Close() + + // there are not records => so it is permissionless + return !iter.Valid() } func (k Keeper) IterateAllowRlyAddress(ctx sdk.Context, cb func(rlyAddress string) (stop bool)) { diff --git a/x/transfermiddleware/types/parachain_token_info.pb.go b/x/transfermiddleware/types/parachain_token_info.pb.go index ea33c7e44..854ea11c0 100644 --- a/x/transfermiddleware/types/parachain_token_info.pb.go +++ b/x/transfermiddleware/types/parachain_token_info.pb.go @@ -28,7 +28,7 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // ParachainIBCTokenInfo represents information about transferable IBC tokens -// from Parachain. +// from Parachain(Substrate based network). type ParachainIBCTokenInfo struct { // ibc_denom is the denomination of the ibced token transferred from the // dotsama chain.