diff --git a/.gitignore b/.gitignore index ec8aabdc8b..657ccac4d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -build/tutoriald +build/exampled build/ data/ config/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7c3235facf..a88d9df7fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ The published content currently lives in a few separate folders: Meet the people [behind the Cosmos SDK and contributors](https://github.com/cosmos/sdk-tutorials/graphs/contributors). -## Viewing Tutorial Builds +## Viewing Example Builds There are two ways to see what your changes will look like in production before the updated pages are published: diff --git a/tutorials/base/Makefile b/tutorials/base/Makefile index 36942413dd..79f375ce11 100644 --- a/tutorials/base/Makefile +++ b/tutorials/base/Makefile @@ -11,8 +11,8 @@ ifeq (,$(VERSION)) endif # Update the ldflags with the app, client & server names -ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=tutorial \ - -X github.com/cosmos/cosmos-sdk/version.AppName=tutoriald \ +ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=example \ + -X github.com/cosmos/cosmos-sdk/version.AppName=exampled \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) @@ -27,8 +27,8 @@ all: install install: @echo "--> ensure dependencies have not been modified" @go mod verify - @echo "--> installing tutoriald" - @go install $(BUILD_FLAGS) -mod=readonly ./cmd/tutoriald + @echo "--> installing exampled" + @go install $(BUILD_FLAGS) -mod=readonly ./cmd/exampled init: ./scripts/init.sh \ No newline at end of file diff --git a/tutorials/base/app/app.go b/tutorials/base/app/app.go index f1a3324c1f..11ffd66ed1 100644 --- a/tutorials/base/app/app.go +++ b/tutorials/base/app/app.go @@ -45,14 +45,14 @@ var DefaultNodeHome string var AppConfigYAML []byte var ( - _ runtime.AppI = (*TutorialApp)(nil) - _ servertypes.Application = (*TutorialApp)(nil) + _ runtime.AppI = (*ExampleApp)(nil) + _ servertypes.Application = (*ExampleApp)(nil) ) -// TutorialApp extends an ABCI application, but with most of its parameters exported. +// ExampleApp extends an ABCI application, but with most of its parameters exported. // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. -type TutorialApp struct { +type ExampleApp struct { *runtime.App legacyAmino *codec.LegacyAmino appCodec codec.Codec @@ -76,7 +76,7 @@ func init() { panic(err) } - DefaultNodeHome = filepath.Join(userHomeDir, ".tutoriald") + DefaultNodeHome = filepath.Join(userHomeDir, ".exampled") } // AppConfig returns the default app config. @@ -92,17 +92,17 @@ func AppConfig() depinject.Config { ) } -// NewTutorialApp returns a reference to an initialized tutorialApp. -func NewTutorialApp( +// NewExampleApp returns a reference to an initialized ExampleApp. +func NewExampleApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) (*TutorialApp, error) { +) (*ExampleApp, error) { var ( - app = &TutorialApp{} + app = &ExampleApp{} appBuilder *runtime.AppBuilder ) @@ -149,13 +149,13 @@ func NewTutorialApp( return app, nil } -// LegacyAmino returns tutorialApp's amino codec. -func (app *TutorialApp) LegacyAmino() *codec.LegacyAmino { +// LegacyAmino returns ExampleApp's amino codec. +func (app *ExampleApp) LegacyAmino() *codec.LegacyAmino { return app.legacyAmino } // GetKey returns the KVStoreKey for the provided store key. -func (app *TutorialApp) GetKey(storeKey string) *storetypes.KVStoreKey { +func (app *ExampleApp) GetKey(storeKey string) *storetypes.KVStoreKey { sk := app.UnsafeFindStoreKey(storeKey) kvStoreKey, ok := sk.(*storetypes.KVStoreKey) if !ok { @@ -164,7 +164,7 @@ func (app *TutorialApp) GetKey(storeKey string) *storetypes.KVStoreKey { return kvStoreKey } -func (app *TutorialApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { +func (app *ExampleApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { keys := make(map[string]*storetypes.KVStoreKey) for _, k := range app.GetStoreKeys() { if kv, ok := k.(*storetypes.KVStoreKey); ok { @@ -176,13 +176,13 @@ func (app *TutorialApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { } // SimulationManager implements the SimulationApp interface -func (app *TutorialApp) SimulationManager() *module.SimulationManager { +func (app *ExampleApp) SimulationManager() *module.SimulationManager { return app.sm } // RegisterAPIRoutes registers all application module routes with the provided // API server. -func (app *TutorialApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { +func (app *ExampleApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { app.App.RegisterAPIRoutes(apiSvr, apiConfig) // register swagger API in app.go so that other applications can override easily if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { diff --git a/tutorials/base/app/app.yaml b/tutorials/base/app/app.yaml index cfaebeb044..61d21c78b8 100644 --- a/tutorials/base/app/app.yaml +++ b/tutorials/base/app/app.yaml @@ -2,7 +2,7 @@ modules: - name: runtime config: "@type": cosmos.app.runtime.v1alpha1.Module - app_name: TutorialApp + app_name: ExampleApp # During begin block slashing happens after distr.BeginBlocker so that # there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant. # NOTE: staking module is required if HistoricalEntries param > 0 diff --git a/tutorials/base/app/export.go b/tutorials/base/app/export.go index c675d003d6..1876ecc731 100644 --- a/tutorials/base/app/export.go +++ b/tutorials/base/app/export.go @@ -15,7 +15,7 @@ import ( ) // ExportAppStateAndValidators exports the state of the application for a genesis file. -func (app *TutorialApp) ExportAppStateAndValidators( +func (app *ExampleApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, @@ -52,7 +52,7 @@ func (app *TutorialApp) ExportAppStateAndValidators( // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature, which will be deprecated in favor of export at a block height -func (app *TutorialApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { +func (app *ExampleApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false // check if there is a allowed address list diff --git a/tutorials/base/app/params/config.go b/tutorials/base/app/params/config.go index e7010a400e..7d420f1953 100644 --- a/tutorials/base/app/params/config.go +++ b/tutorials/base/app/params/config.go @@ -9,12 +9,12 @@ import ( ) const ( - CoinUnit = "tutorial" + CoinUnit = "example" DefaultBondDenom = CoinUnit // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address. - Bech32PrefixAccAddr = "tutorial" + Bech32PrefixAccAddr = "example" ) var ( diff --git a/tutorials/base/cmd/tutoriald/cmd/commands.go b/tutorials/base/cmd/exampled/cmd/commands.go similarity index 89% rename from tutorials/base/cmd/tutoriald/cmd/commands.go rename to tutorials/base/cmd/exampled/cmd/commands.go index 4d2bae8e9b..07d1b8aa0b 100644 --- a/tutorials/base/cmd/tutoriald/cmd/commands.go +++ b/tutorials/base/cmd/exampled/cmd/commands.go @@ -99,7 +99,7 @@ func txCommand() *cobra.Command { // newApp is an appCreator func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { baseappOptions := server.DefaultBaseappOptions(appOpts) - app, err := app.NewTutorialApp(logger, db, traceStore, true, appOpts, baseappOptions...) + app, err := app.NewExampleApp(logger, db, traceStore, true, appOpts, baseappOptions...) if err != nil { panic(err) } @@ -119,8 +119,8 @@ func appExport( modulesToExport []string, ) (servertypes.ExportedApp, error) { var ( - tutorialApp *app.TutorialApp - err error + ExampleApp *app.ExampleApp + err error ) // this check is necessary as we use the flag in x/upgrade. @@ -140,20 +140,20 @@ func appExport( appOpts = viperAppOpts if height != -1 { - tutorialApp, err = app.NewTutorialApp(logger, db, traceStore, false, appOpts) + ExampleApp, err = app.NewExampleApp(logger, db, traceStore, false, appOpts) if err != nil { return servertypes.ExportedApp{}, err } - if err := tutorialApp.LoadHeight(height); err != nil { + if err := ExampleApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - tutorialApp, err = app.NewTutorialApp(logger, db, traceStore, true, appOpts) + ExampleApp, err = app.NewExampleApp(logger, db, traceStore, true, appOpts) if err != nil { return servertypes.ExportedApp{}, err } } - return tutorialApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) + return ExampleApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) } diff --git a/tutorials/base/cmd/tutoriald/cmd/root.go b/tutorials/base/cmd/exampled/cmd/root.go similarity index 96% rename from tutorials/base/cmd/tutoriald/cmd/root.go rename to tutorials/base/cmd/exampled/cmd/root.go index e08333d33d..82e61dc88a 100644 --- a/tutorials/base/cmd/tutoriald/cmd/root.go +++ b/tutorials/base/cmd/exampled/cmd/root.go @@ -27,7 +27,7 @@ import ( "github.com/cosmos/sdk-tutorials/tutorials/base/app" ) -// NewRootCmd creates a new root command for tutoriald. It is called once in the +// NewRootCmd creates a new root command for exampled. It is called once in the // main function. func NewRootCmd() *cobra.Command { var ( @@ -60,8 +60,8 @@ func NewRootCmd() *cobra.Command { } rootCmd := &cobra.Command{ - Use: "tutoriald", - Short: "tutoriald - the tutorial chain app", + Use: "exampled", + Short: "exampled - the example chain app", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) @@ -101,7 +101,7 @@ func NewRootCmd() *cobra.Command { // overwrite the minimum gas price from the app configuration srvCfg := serverconfig.DefaultConfig() - srvCfg.MinGasPrices = "0tutorial" + srvCfg.MinGasPrices = "0example" // overwrite the block timeout cmtCfg := cmtcfg.DefaultConfig() diff --git a/tutorials/base/cmd/tutoriald/main.go b/tutorials/base/cmd/exampled/main.go similarity index 85% rename from tutorials/base/cmd/tutoriald/main.go rename to tutorials/base/cmd/exampled/main.go index 26fbff77e2..4f68c02c5b 100644 --- a/tutorials/base/cmd/tutoriald/main.go +++ b/tutorials/base/cmd/exampled/main.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/sdk-tutorials/tutorials/base/app" "github.com/cosmos/sdk-tutorials/tutorials/base/app/params" - "github.com/cosmos/sdk-tutorials/tutorials/base/cmd/tutoriald/cmd" + "github.com/cosmos/sdk-tutorials/tutorials/base/cmd/exampled/cmd" ) func main() { diff --git a/tutorials/base/scripts/init.sh b/tutorials/base/scripts/init.sh index 329f8c2a8f..4c167e5a32 100755 --- a/tutorials/base/scripts/init.sh +++ b/tutorials/base/scripts/init.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -rm -r ~/.tutoriald || true -tutorialD_BIN=$(which tutoriald) -# configure tutoriald -$tutorialD_BIN config set client chain-id demo -$tutorialD_BIN config set client keyring-backend test -$tutorialD_BIN keys add alice -$tutorialD_BIN keys add bob -$tutorialD_BIN init test --chain-id demo --default-denom tutorial +rm -r ~/.exampled || true +exampled_BIN=$(which exampled) +# configure exampled +$exampled_BIN config set client chain-id demo +$exampled_BIN config set client keyring-backend test +$exampled_BIN keys add alice +$exampled_BIN keys add bob +$exampled_BIN init test --chain-id demo --default-denom example # update genesis -$tutorialD_BIN genesis add-genesis-account alice 10000000tutorial --keyring-backend test -$tutorialD_BIN genesis add-genesis-account bob 1000tutorial --keyring-backend test +$exampled_BIN genesis add-genesis-account alice 10000000example --keyring-backend test +$exampled_BIN genesis add-genesis-account bob 1000example --keyring-backend test # create default validator -$tutorialD_BIN genesis gentx alice 1000000tutorial --chain-id demo -$tutorialD_BIN genesis collect-gentxs +$exampled_BIN genesis gentx alice 1000000example --chain-id demo +$exampled_BIN genesis collect-gentxs diff --git a/tutorials/nameservice/base/Makefile b/tutorials/nameservice/base/Makefile index ca29527582..73c57ba443 100644 --- a/tutorials/nameservice/base/Makefile +++ b/tutorials/nameservice/base/Makefile @@ -54,8 +54,8 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) # ********** process linker flags ********** -ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=tutorial \ - -X github.com/cosmos/cosmos-sdk/version.AppName=tutoriald \ +ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=example \ + -X github.com/cosmos/cosmos-sdk/version.AppName=exampled \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" @@ -88,12 +88,12 @@ all: lint test install ############################################################################### install: enforce-go-version - @echo "Installing tutoriald..." - go install -mod=readonly $(BUILD_FLAGS) ./cmd/tutoriald + @echo "Installing exampled..." + go install -mod=readonly $(BUILD_FLAGS) ./cmd/exampled build: enforce-go-version - @echo "Building tutoriald..." - go build $(BUILD_FLAGS) -o $(BUILDDIR)/ ./cmd/tutoriald + @echo "Building exampled..." + go build $(BUILD_FLAGS) -o $(BUILDDIR)/ ./cmd/exampled enforce-go-version: @echo "Go version: $(GO_MAJOR_VERSION).$(GO_MINOR_VERSION)" @@ -137,20 +137,20 @@ format: ############################################################################### start-localnet: build - rm -rf ~/.tutoriald - ./build/tutoriald init liveness --chain-id cosmos-1 --default-denom uatom - ./build/tutoriald config set client chain-id cosmos-1 - ./build/tutoriald config set client keyring-backend test - ./build/tutoriald keys add val1 - ./build/tutoriald keys add alice - ./build/tutoriald keys add bob - ./build/tutoriald genesis add-genesis-account val1 10000000000000000000000000uatom - ./build/tutoriald genesis add-genesis-account alice 1000000000000000000uatom - ./build/tutoriald genesis add-genesis-account bob 1000000000000000000uatom - ./build/tutoriald genesis gentx val1 1000000000uatom --chain-id cosmos-1 - ./build/tutoriald genesis collect-gentxs - sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025uatom"/' ~/.tutoriald/config/app.toml - ./build/tutoriald start --val-key val1 + rm -rf ~/.exampled + ./build/exampled init liveness --chain-id cosmos-1 --default-denom uatom + ./build/exampled config set client chain-id cosmos-1 + ./build/exampled config set client keyring-backend test + ./build/exampled keys add val1 + ./build/exampled keys add alice + ./build/exampled keys add bob + ./build/exampled genesis add-genesis-account val1 10000000000000000000000000uatom + ./build/exampled genesis add-genesis-account alice 1000000000000000000uatom + ./build/exampled genesis add-genesis-account bob 1000000000000000000uatom + ./build/exampled genesis gentx val1 1000000000uatom --chain-id cosmos-1 + ./build/exampled genesis collect-gentxs + sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025uatom"/' ~/.exampled/config/app.toml + ./build/exampled start --val-key val1 ############################################################################### ### Tests & Simulation ### ############################################################################### diff --git a/tutorials/nameservice/base/app/app.go b/tutorials/nameservice/base/app/app.go index ea5dd390ce..75782c6cfe 100644 --- a/tutorials/nameservice/base/app/app.go +++ b/tutorials/nameservice/base/app/app.go @@ -106,11 +106,11 @@ var ( ) var ( - _ runtime.AppI = (*TutorialApp)(nil) - _ servertypes.Application = (*TutorialApp)(nil) + _ runtime.AppI = (*ExampleApp)(nil) + _ servertypes.Application = (*ExampleApp)(nil) ) -type TutorialApp struct { +type ExampleApp struct { *baseapp.BaseApp legacyAmino *codec.LegacyAmino @@ -149,7 +149,7 @@ func init() { DefaultNodeHome = filepath.Join(userHomeDir, "") } -func NewTutorialApp( +func NewExampleApp( logger log.Logger, db dbm.DB, traceStore io.Writer, @@ -158,7 +158,7 @@ func NewTutorialApp( valKeyName string, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) *TutorialApp { +) *ExampleApp { homePath := cast.ToString(appOpts.Get(flags.FlagHome)) // Set demo flag runProvider := cast.ToBool(appOpts.Get(auction.FlagRunProvider)) @@ -216,7 +216,7 @@ func NewTutorialApp( tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) - app := &TutorialApp{ + app := &ExampleApp{ BaseApp: bApp, legacyAmino: legacyAmino, txConfig: txConfig, @@ -474,20 +474,20 @@ func NewTutorialApp( return app } -func (app *TutorialApp) Name() string { return app.BaseApp.Name() } +func (app *ExampleApp) Name() string { return app.BaseApp.Name() } // BeginBlocker application updates every begin block -func (app *TutorialApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { +func (app *ExampleApp) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { return app.mm.BeginBlock(ctx) } // EndBlocker application updates every end block -func (app *TutorialApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { +func (app *ExampleApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { return app.mm.EndBlock(ctx) } // InitChainer application update at chain initialization -func (app *TutorialApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { +func (app *ExampleApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { var genesisState GenesisState // Enable VE @@ -506,11 +506,11 @@ func (app *TutorialApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) return app.mm.InitGenesis(ctx, app.appCodec, genesisState) } -func (app *TutorialApp) LoadHeight(height int64) error { +func (app *ExampleApp) LoadHeight(height int64) error { return app.LoadVersion(height) } -func (app *TutorialApp) ModuleAccountAddrs() map[string]bool { +func (app *ExampleApp) ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) for acc := range maccPerms { modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true @@ -519,30 +519,30 @@ func (app *TutorialApp) ModuleAccountAddrs() map[string]bool { return modAccAddrs } -func (app *TutorialApp) BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[string]bool { +func (app *ExampleApp) BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[string]bool { delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) return modAccAddrs } -func (app *TutorialApp) LegacyAmino() *codec.LegacyAmino { +func (app *ExampleApp) LegacyAmino() *codec.LegacyAmino { return app.legacyAmino } -func (app *TutorialApp) AppCodec() codec.Codec { +func (app *ExampleApp) AppCodec() codec.Codec { return app.appCodec } -func (app *TutorialApp) InterfaceRegistry() types.InterfaceRegistry { +func (app *ExampleApp) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } -func (app *TutorialApp) GetTxConfig() client.TxConfig { +func (app *ExampleApp) GetTxConfig() client.TxConfig { return app.txConfig } // AutoCliOpts returns the autocli options for the app. -func (app *TutorialApp) AutoCliOpts() autocli.AppOptions { +func (app *ExampleApp) AutoCliOpts() autocli.AppOptions { modules := make(map[string]appmodule.AppModule, 0) for _, m := range app.mm.Modules { if moduleWithName, ok := m.(module.HasName); ok { @@ -562,19 +562,19 @@ func (app *TutorialApp) AutoCliOpts() autocli.AppOptions { } // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. -func (app *TutorialApp) DefaultGenesis() map[string]json.RawMessage { +func (app *ExampleApp) DefaultGenesis() map[string]json.RawMessage { return app.BasicManager.DefaultGenesis(app.appCodec) } // GetKey returns the KVStoreKey for the provided store key. // // NOTE: This is solely to be used for testing purposes. -func (app *TutorialApp) GetKey(storeKey string) *storetypes.KVStoreKey { +func (app *ExampleApp) GetKey(storeKey string) *storetypes.KVStoreKey { return app.keys[storeKey] } // GetStoreKeys returns all the stored store keys. -func (app *TutorialApp) GetStoreKeys() []storetypes.StoreKey { +func (app *ExampleApp) GetStoreKeys() []storetypes.StoreKey { keys := make([]storetypes.StoreKey, len(app.keys)) for _, key := range app.keys { keys = append(keys, key) @@ -584,11 +584,11 @@ func (app *TutorialApp) GetStoreKeys() []storetypes.StoreKey { } // SimulationManager implements the SimulationApp interface -func (app *TutorialApp) SimulationManager() *module.SimulationManager { +func (app *ExampleApp) SimulationManager() *module.SimulationManager { return app.simulationManager } -func (app *TutorialApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { +func (app *ExampleApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) @@ -608,12 +608,12 @@ func (app *TutorialApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.A } } -func (app *TutorialApp) RegisterTxService(clientCtx client.Context) { +func (app *ExampleApp) RegisterTxService(clientCtx client.Context) { authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) } // RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *TutorialApp) RegisterTendermintService(clientCtx client.Context) { +func (app *ExampleApp) RegisterTendermintService(clientCtx client.Context) { cmtApp := server.NewCometABCIWrapper(app) cmtservice.RegisterTendermintService( clientCtx, @@ -623,17 +623,17 @@ func (app *TutorialApp) RegisterTendermintService(clientCtx client.Context) { ) } -func (app *TutorialApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { +func (app *ExampleApp) RegisterNodeService(clientCtx client.Context, cfg config.Config) { nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) } -func (app *TutorialApp) OnTxSucceeded(_ sdk.Context, _, _ string, _, _ []byte) { +func (app *ExampleApp) OnTxSucceeded(_ sdk.Context, _, _ string, _, _ []byte) { } -func (app *TutorialApp) OnTxFailed(_ sdk.Context, _, _ string, _, _ []byte) { +func (app *ExampleApp) OnTxFailed(_ sdk.Context, _, _ string, _, _ []byte) { } -func (app *TutorialApp) GetBaseApp() *baseapp.BaseApp { +func (app *ExampleApp) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } @@ -656,7 +656,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino // GetSubspace returns a param subspace for a given module name. // // NOTE: This is solely to be used for testing purposes. -func (app *TutorialApp) GetSubspace(moduleName string) paramstypes.Subspace { +func (app *ExampleApp) GetSubspace(moduleName string) paramstypes.Subspace { subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) return subspace } diff --git a/tutorials/nameservice/base/app/app.yaml b/tutorials/nameservice/base/app/app.yaml index cfaebeb044..61d21c78b8 100644 --- a/tutorials/nameservice/base/app/app.yaml +++ b/tutorials/nameservice/base/app/app.yaml @@ -2,7 +2,7 @@ modules: - name: runtime config: "@type": cosmos.app.runtime.v1alpha1.Module - app_name: TutorialApp + app_name: ExampleApp # During begin block slashing happens after distr.BeginBlocker so that # there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant. # NOTE: staking module is required if HistoricalEntries param > 0 diff --git a/tutorials/nameservice/base/app/export.go b/tutorials/nameservice/base/app/export.go index a73b7208f5..146948d818 100644 --- a/tutorials/nameservice/base/app/export.go +++ b/tutorials/nameservice/base/app/export.go @@ -15,7 +15,7 @@ import ( ) // ExportAppStateAndValidators exports the state of the application for a genesis file. -func (app *TutorialApp) ExportAppStateAndValidators( +func (app *ExampleApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, @@ -52,7 +52,7 @@ func (app *TutorialApp) ExportAppStateAndValidators( // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature, which will be deprecated in favor of export at a block height -func (app *TutorialApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { +func (app *ExampleApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false // check if there is a allowed address list diff --git a/tutorials/nameservice/base/cmd/tutoriald/cmd/cmd.go b/tutorials/nameservice/base/cmd/exampled/cmd/cmd.go similarity index 99% rename from tutorials/nameservice/base/cmd/tutoriald/cmd/cmd.go rename to tutorials/nameservice/base/cmd/exampled/cmd/cmd.go index 88c5fc2392..870e54a180 100644 --- a/tutorials/nameservice/base/cmd/tutoriald/cmd/cmd.go +++ b/tutorials/nameservice/base/cmd/exampled/cmd/cmd.go @@ -21,7 +21,7 @@ import ( ) func NewRootCmd() (*cobra.Command, testutils.EncodingConfig) { - tmpApp := app.NewTutorialApp( + tmpApp := app.NewExampleApp( log.NewNopLogger(), dbm.NewMemDB(), nil, diff --git a/tutorials/nameservice/base/cmd/tutoriald/cmd/commands.go b/tutorials/nameservice/base/cmd/exampled/cmd/commands.go similarity index 98% rename from tutorials/nameservice/base/cmd/tutoriald/cmd/commands.go rename to tutorials/nameservice/base/cmd/exampled/cmd/commands.go index b14bd51200..ac39be87e5 100644 --- a/tutorials/nameservice/base/cmd/tutoriald/cmd/commands.go +++ b/tutorials/nameservice/base/cmd/exampled/cmd/commands.go @@ -162,7 +162,7 @@ func newApp( valKey = "val" } - return app.NewTutorialApp( + return app.NewExampleApp( logger, db, traceStore, @@ -184,7 +184,7 @@ func appExport( appOpts servertypes.AppOptions, modulesToExport []string, ) (servertypes.ExportedApp, error) { - var exportApp *app.TutorialApp + var exportApp *app.ExampleApp valKey, ok := appOpts.Get(auction.FlagValKey).(string) if !ok { @@ -208,7 +208,7 @@ func appExport( loadLatest = true } - exportApp = app.NewTutorialApp( + exportApp = app.NewExampleApp( logger, db, traceStore, diff --git a/tutorials/nameservice/base/cmd/tutoriald/main.go b/tutorials/nameservice/base/cmd/exampled/main.go similarity index 96% rename from tutorials/nameservice/base/cmd/tutoriald/main.go rename to tutorials/nameservice/base/cmd/exampled/main.go index b4e7038610..b24496f2d7 100644 --- a/tutorials/nameservice/base/cmd/tutoriald/main.go +++ b/tutorials/nameservice/base/cmd/exampled/main.go @@ -7,7 +7,7 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/cosmos/sdk-tutorials/tutorials/nameservice/base/app" - "github.com/cosmos/sdk-tutorials/tutorials/nameservice/base/cmd/tutoriald/cmd" + "github.com/cosmos/sdk-tutorials/tutorials/nameservice/base/cmd/exampled/cmd" ) func main() { diff --git a/tutorials/nameservice/base/scripts/init.sh b/tutorials/nameservice/base/scripts/init.sh index 329f8c2a8f..4c167e5a32 100755 --- a/tutorials/nameservice/base/scripts/init.sh +++ b/tutorials/nameservice/base/scripts/init.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -rm -r ~/.tutoriald || true -tutorialD_BIN=$(which tutoriald) -# configure tutoriald -$tutorialD_BIN config set client chain-id demo -$tutorialD_BIN config set client keyring-backend test -$tutorialD_BIN keys add alice -$tutorialD_BIN keys add bob -$tutorialD_BIN init test --chain-id demo --default-denom tutorial +rm -r ~/.exampled || true +exampled_BIN=$(which exampled) +# configure exampled +$exampled_BIN config set client chain-id demo +$exampled_BIN config set client keyring-backend test +$exampled_BIN keys add alice +$exampled_BIN keys add bob +$exampled_BIN init test --chain-id demo --default-denom example # update genesis -$tutorialD_BIN genesis add-genesis-account alice 10000000tutorial --keyring-backend test -$tutorialD_BIN genesis add-genesis-account bob 1000tutorial --keyring-backend test +$exampled_BIN genesis add-genesis-account alice 10000000example --keyring-backend test +$exampled_BIN genesis add-genesis-account bob 1000example --keyring-backend test # create default validator -$tutorialD_BIN genesis gentx alice 1000000tutorial --chain-id demo -$tutorialD_BIN genesis collect-gentxs +$exampled_BIN genesis gentx alice 1000000example --chain-id demo +$exampled_BIN genesis collect-gentxs diff --git a/tutorials/nameservice/base/x/auction/keeper/keeper_test.go b/tutorials/nameservice/base/x/auction/keeper/keeper_test.go deleted file mode 100644 index 59cc7a1981..0000000000 --- a/tutorials/nameservice/base/x/auction/keeper/keeper_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/golang/mock/gomock" - - storetypes "cosmossdk.io/store/types" - addresscodec "github.com/cosmos/cosmos-sdk/codec/address" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - keeper "github.com/cosmos/sdk-tutorials/tutorials/nameservice/base/x/auction/keeper" - auction "github.com/cosmos/sdk-tutorials/tutorials/nameservice/base/x/auction" -) - -type testFixture struct { - ctx sdk.Context - k keeper.Keeper - msgServer auction.MsgServer - queryServer auction.QueryServer - - addrs []sdk.AccAddress -} - -func initFixture(t *testing.T) *testFixture { - encCfg := moduletestutil.MakeTestEncodingConfig() - key := storetypes.NewKVStoreKey(auction.ModuleName) - testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) - storeService := runtime.NewKVStoreService(key) - addrs := simtestutil.CreateIncrementalAccounts(3) - // gomock initializations - ctrl := gomock.NewController(t) - bankKeeper := auction.NewMockBankKeeper(ctrl) - defaultDenom := "stake" - k := keeper.NewKeeper( - encCfg.Codec, - addresscodec.NewBech32Codec("tutorial"), - storeService, - addrs[0].String(), - bankKeeper, - defaultDenom, - ) - - err := k.InitGenesis(testCtx.Ctx, auction.NewGenesisState()) - if err != nil { - panic(err) - } - - return &testFixture{ - ctx: testCtx.Ctx, - k: k, - msgServer: keeper.NewMsgServerImpl(k), - queryServer: keeper.NewQueryServerImpl(k), - addrs: addrs, - } -} diff --git a/tutorials/nameservice/base/x/auction/scripts/configure.sh b/tutorials/nameservice/base/x/auction/scripts/configure.sh index 31eac08491..a4a91efa87 100755 --- a/tutorials/nameservice/base/x/auction/scripts/configure.sh +++ b/tutorials/nameservice/base/x/auction/scripts/configure.sh @@ -3,7 +3,7 @@ set -eux source ./vars.sh -pkill -f tutoriald &> /dev/null || true +pkill -f exampled &> /dev/null || true sleep 1 rm -rf ${NODES_ROOT_DIR} diff --git a/tutorials/nameservice/base/x/auction/scripts/reserve.sh b/tutorials/nameservice/base/x/auction/scripts/reserve.sh index 5377a18f59..e33ba109d9 100755 --- a/tutorials/nameservice/base/x/auction/scripts/reserve.sh +++ b/tutorials/nameservice/base/x/auction/scripts/reserve.sh @@ -16,7 +16,7 @@ find_project_root() { } PROJECT_ROOT=$(find_project_root) -BINARY=$PROJECT_ROOT/tutorials/nameservice/base/build/tutoriald +BINARY=$PROJECT_ROOT/tutorials/nameservice/base/build/exampled name="$1" diff --git a/tutorials/nameservice/base/x/auction/scripts/single_node/frontrun.sh b/tutorials/nameservice/base/x/auction/scripts/single_node/frontrun.sh index bd0342b6d2..6b69110368 100755 --- a/tutorials/nameservice/base/x/auction/scripts/single_node/frontrun.sh +++ b/tutorials/nameservice/base/x/auction/scripts/single_node/frontrun.sh @@ -8,8 +8,8 @@ find_project_root() { } PROJECT_ROOT=$(find_project_root) -HOME=$HOME/.tutoriald -BINARY=$PROJECT_ROOT/tutorials/auction/base/build/tutoriald +HOME=$HOME/.exampled +BINARY=$PROJECT_ROOT/tutorials/auction/base/build/exampled echo $HOME $BINARY tx reserve "bob.cosmos" $($BINARY keys show alice -a --home $HOME --keyring-backend test) 1000uatom --from $($BINARY keys show bob -a --home $HOME --keyring-backend test) --home $HOME -y diff --git a/tutorials/nameservice/base/x/auction/scripts/single_node/setup.sh b/tutorials/nameservice/base/x/auction/scripts/single_node/setup.sh index 25ed87cdb6..62e0129d40 100755 --- a/tutorials/nameservice/base/x/auction/scripts/single_node/setup.sh +++ b/tutorials/nameservice/base/x/auction/scripts/single_node/setup.sh @@ -8,8 +8,8 @@ find_project_root() { } PROJECT_ROOT=$(find_project_root) -HOME=$HOME/.tutoriald -BINARY=$PROJECT_ROOT/tutorials/auction/base/build/tutoriald +HOME=$HOME/.exampled +BINARY=$PROJECT_ROOT/tutorials/auction/base/build/exampled echo $PROJECT_ROOT echo $HOME diff --git a/tutorials/nameservice/base/x/auction/scripts/stop.sh b/tutorials/nameservice/base/x/auction/scripts/stop.sh index 0d1ce462a8..a3dd425977 100755 --- a/tutorials/nameservice/base/x/auction/scripts/stop.sh +++ b/tutorials/nameservice/base/x/auction/scripts/stop.sh @@ -1,4 +1,4 @@ #!/bin/bash set -eux -pkill -f tutoriald &> /dev/null || true +pkill -f exampled &> /dev/null || true diff --git a/tutorials/nameservice/base/x/auction/scripts/vars.sh b/tutorials/nameservice/base/x/auction/scripts/vars.sh index f0e4e6d192..e91f53621f 100755 --- a/tutorials/nameservice/base/x/auction/scripts/vars.sh +++ b/tutorials/nameservice/base/x/auction/scripts/vars.sh @@ -9,9 +9,9 @@ find_project_root() { } PROJECT_ROOT=$(find_project_root) -export HOME=$HOME/.tutoriald +export HOME=$HOME/.exampled echo $PROJECT_ROOT -BINARY=$PROJECT_ROOT/tutorials/nameservice/base/build/tutoriald +BINARY=$PROJECT_ROOT/tutorials/nameservice/base/build/exampled export CHAIN_ID=test export KEYRING=test # User balance of stake tokens diff --git a/tutorials/oracle/base/Makefile b/tutorials/oracle/base/Makefile index 36942413dd..79f375ce11 100644 --- a/tutorials/oracle/base/Makefile +++ b/tutorials/oracle/base/Makefile @@ -11,8 +11,8 @@ ifeq (,$(VERSION)) endif # Update the ldflags with the app, client & server names -ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=tutorial \ - -X github.com/cosmos/cosmos-sdk/version.AppName=tutoriald \ +ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=example \ + -X github.com/cosmos/cosmos-sdk/version.AppName=exampled \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) @@ -27,8 +27,8 @@ all: install install: @echo "--> ensure dependencies have not been modified" @go mod verify - @echo "--> installing tutoriald" - @go install $(BUILD_FLAGS) -mod=readonly ./cmd/tutoriald + @echo "--> installing exampled" + @go install $(BUILD_FLAGS) -mod=readonly ./cmd/exampled init: ./scripts/init.sh \ No newline at end of file diff --git a/tutorials/oracle/base/app/app.go b/tutorials/oracle/base/app/app.go index 04cb7a4b67..8ad0e72f59 100644 --- a/tutorials/oracle/base/app/app.go +++ b/tutorials/oracle/base/app/app.go @@ -53,14 +53,14 @@ var DefaultNodeHome string var AppConfigYAML []byte var ( - _ runtime.AppI = (*TutorialApp)(nil) - _ servertypes.Application = (*TutorialApp)(nil) + _ runtime.AppI = (*ExampleApp)(nil) + _ servertypes.Application = (*ExampleApp)(nil) ) -// TutorialApp extends an ABCI application, but with most of its parameters exported. +// ExampleApp extends an ABCI application, but with most of its parameters exported. // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. -type TutorialApp struct { +type ExampleApp struct { *runtime.App legacyAmino *codec.LegacyAmino appCodec codec.Codec @@ -85,7 +85,7 @@ func init() { panic(err) } - DefaultNodeHome = filepath.Join(userHomeDir, ".tutoriald") + DefaultNodeHome = filepath.Join(userHomeDir, ".exampled") } // AppConfig returns the default app config. @@ -101,17 +101,17 @@ func AppConfig() depinject.Config { ) } -// NewTutorialApp returns a reference to an initialized TutorialApp. -func NewTutorialApp( +// NewExampleApp returns a reference to an initialized ExampleApp. +func NewExampleApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) (*TutorialApp, error) { +) (*ExampleApp, error) { var ( - app = &TutorialApp{} + app = &ExampleApp{} appBuilder *runtime.AppBuilder ) @@ -188,13 +188,13 @@ func NewTutorialApp( return app, nil } -// LegacyAmino returns TutorialApp's amino codec. -func (app *TutorialApp) LegacyAmino() *codec.LegacyAmino { +// LegacyAmino returns ExampleApp's amino codec. +func (app *ExampleApp) LegacyAmino() *codec.LegacyAmino { return app.legacyAmino } // GetKey returns the KVStoreKey for the provided store key. -func (app *TutorialApp) GetKey(storeKey string) *storetypes.KVStoreKey { +func (app *ExampleApp) GetKey(storeKey string) *storetypes.KVStoreKey { sk := app.UnsafeFindStoreKey(storeKey) kvStoreKey, ok := sk.(*storetypes.KVStoreKey) if !ok { @@ -203,7 +203,7 @@ func (app *TutorialApp) GetKey(storeKey string) *storetypes.KVStoreKey { return kvStoreKey } -func (app *TutorialApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { +func (app *ExampleApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { keys := make(map[string]*storetypes.KVStoreKey) for _, k := range app.GetStoreKeys() { if kv, ok := k.(*storetypes.KVStoreKey); ok { @@ -215,13 +215,13 @@ func (app *TutorialApp) kvStoreKeys() map[string]*storetypes.KVStoreKey { } // SimulationManager implements the SimulationApp interface -func (app *TutorialApp) SimulationManager() *module.SimulationManager { +func (app *ExampleApp) SimulationManager() *module.SimulationManager { return app.sm } // RegisterAPIRoutes registers all application module routes with the provided // API server. -func (app *TutorialApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { +func (app *ExampleApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { app.App.RegisterAPIRoutes(apiSvr, apiConfig) // register swagger API in app.go so that other applications can override easily if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { diff --git a/tutorials/oracle/base/app/app.yaml b/tutorials/oracle/base/app/app.yaml index c29b50c0f6..b6a21beb4b 100644 --- a/tutorials/oracle/base/app/app.yaml +++ b/tutorials/oracle/base/app/app.yaml @@ -2,7 +2,7 @@ modules: - name: runtime config: "@type": cosmos.app.runtime.v1alpha1.Module - app_name: TutorialApp + app_name: ExampleApp # During begin block slashing happens after distr.BeginBlocker so that # there is nothing left over in the validator fee pool, so as to keep the CanWithdrawInvariant invariant. # NOTE: staking module is required if HistoricalEntries param > 0 diff --git a/tutorials/oracle/base/app/export.go b/tutorials/oracle/base/app/export.go index c675d003d6..1876ecc731 100644 --- a/tutorials/oracle/base/app/export.go +++ b/tutorials/oracle/base/app/export.go @@ -15,7 +15,7 @@ import ( ) // ExportAppStateAndValidators exports the state of the application for a genesis file. -func (app *TutorialApp) ExportAppStateAndValidators( +func (app *ExampleApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, @@ -52,7 +52,7 @@ func (app *TutorialApp) ExportAppStateAndValidators( // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature, which will be deprecated in favor of export at a block height -func (app *TutorialApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { +func (app *ExampleApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false // check if there is a allowed address list diff --git a/tutorials/oracle/base/cmd/tutoriald/cmd/commands.go b/tutorials/oracle/base/cmd/exampled/cmd/commands.go similarity index 89% rename from tutorials/oracle/base/cmd/tutoriald/cmd/commands.go rename to tutorials/oracle/base/cmd/exampled/cmd/commands.go index c7b20dd67d..f1aa1f26b8 100644 --- a/tutorials/oracle/base/cmd/tutoriald/cmd/commands.go +++ b/tutorials/oracle/base/cmd/exampled/cmd/commands.go @@ -99,7 +99,7 @@ func txCommand() *cobra.Command { // newApp is an appCreator func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { baseappOptions := server.DefaultBaseappOptions(appOpts) - app, err := app.NewTutorialApp(logger, db, traceStore, true, appOpts, baseappOptions...) + app, err := app.NewExampleApp(logger, db, traceStore, true, appOpts, baseappOptions...) if err != nil { panic(err) } @@ -119,8 +119,8 @@ func appExport( modulesToExport []string, ) (servertypes.ExportedApp, error) { var ( - tutorialApp *app.TutorialApp - err error + ExampleApp *app.ExampleApp + err error ) // this check is necessary as we use the flag in x/upgrade. @@ -140,20 +140,20 @@ func appExport( appOpts = viperAppOpts if height != -1 { - tutorialApp, err = app.NewTutorialApp(logger, db, traceStore, false, appOpts) + ExampleApp, err = app.NewExampleApp(logger, db, traceStore, false, appOpts) if err != nil { return servertypes.ExportedApp{}, err } - if err := tutorialApp.LoadHeight(height); err != nil { + if err := ExampleApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - tutorialApp, err = app.NewTutorialApp(logger, db, traceStore, true, appOpts) + ExampleApp, err = app.NewExampleApp(logger, db, traceStore, true, appOpts) if err != nil { return servertypes.ExportedApp{}, err } } - return tutorialApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) + return ExampleApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) } diff --git a/tutorials/oracle/base/cmd/tutoriald/cmd/root.go b/tutorials/oracle/base/cmd/exampled/cmd/root.go similarity index 96% rename from tutorials/oracle/base/cmd/tutoriald/cmd/root.go rename to tutorials/oracle/base/cmd/exampled/cmd/root.go index 52713addfa..1e1fdd6862 100644 --- a/tutorials/oracle/base/cmd/tutoriald/cmd/root.go +++ b/tutorials/oracle/base/cmd/exampled/cmd/root.go @@ -27,7 +27,7 @@ import ( "github.com/cosmos/sdk-tutorials/tutorials/oracle/base/app" ) -// NewRootCmd creates a new root command for tutoriald. It is called once in the +// NewRootCmd creates a new root command for exampled. It is called once in the // main function. func NewRootCmd() *cobra.Command { var ( @@ -60,8 +60,8 @@ func NewRootCmd() *cobra.Command { } rootCmd := &cobra.Command{ - Use: "tutoriald", - Short: "tutoriald - the tutorial chain app", + Use: "exampled", + Short: "exampled - the example chain app", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) @@ -101,7 +101,7 @@ func NewRootCmd() *cobra.Command { // overwrite the minimum gas price from the app configuration srvCfg := serverconfig.DefaultConfig() - srvCfg.MinGasPrices = "0tutorial" + srvCfg.MinGasPrices = "0example" // overwrite the block timeout cmtCfg := cmtcfg.DefaultConfig() diff --git a/tutorials/oracle/base/cmd/tutoriald/main.go b/tutorials/oracle/base/cmd/exampled/main.go similarity index 85% rename from tutorials/oracle/base/cmd/tutoriald/main.go rename to tutorials/oracle/base/cmd/exampled/main.go index 7ac5eaf55b..b448cd2cf7 100644 --- a/tutorials/oracle/base/cmd/tutoriald/main.go +++ b/tutorials/oracle/base/cmd/exampled/main.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/sdk-tutorials/tutorials/oracle/base/app" "github.com/cosmos/sdk-tutorials/tutorials/oracle/base/app/params" - "github.com/cosmos/sdk-tutorials/tutorials/oracle/base/cmd/tutoriald/cmd" + "github.com/cosmos/sdk-tutorials/tutorials/oracle/base/cmd/exampled/cmd" ) func main() { diff --git a/tutorials/oracle/base/scripts/init.sh b/tutorials/oracle/base/scripts/init.sh index 8b9cba50b4..f105c0b2f3 100755 --- a/tutorials/oracle/base/scripts/init.sh +++ b/tutorials/oracle/base/scripts/init.sh @@ -1,17 +1,18 @@ #!/usr/bin/env bash -rm -r ~/.tutoriald || true -tutorialD_BIN=$(which tutoriald) -# configure tutoriald -$tutorialD_BIN config set client chain-id demo -$tutorialD_BIN config set client keyring-backend test -$tutorialD_BIN keys add alice -$tutorialD_BIN keys add bob -$tutorialD_BIN init test --chain-id demo --default-denom tutorial +rm -r ~/.exampled || true +exampled_BIN=$(which exampled) +# configure exampled +$exampled_BIN config set client chain-id demo +$exampled_BIN config set client keyring-backend test +$exampled_BIN keys add alice +$exampled_BIN keys add bob +$exampled_BIN init test --chain-id demo --default-denom example # update genesis -$tutorialD_BIN genesis add-genesis-account alice 10000000tutorial --keyring-backend test -$tutorialD_BIN genesis add-genesis-account bob 1000tutorial --keyring-backend test +$exampled_BIN genesis add-genesis-account alice 10000000example --keyring-backend test +$exampled_BIN genesis add-genesis-account bob 1000example --keyring-backend test # create default validator -$tutorialD_BIN genesis gentx alice 1000000tutorial --chain-id demo -sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025uatom"/' $HOME/.tutoriald/config/app.toml -$tutorialD_BIN genesis collect-gentxs +$exampled_BIN genesis gentx alice 1000000example --chain-id demo +sed -i.bak'' 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025uatom"/' $HOME/.exampled/config/app.toml +jq '.consensus.params.abci.vote_extensions_enable_height = "1"' ~/.exampled/config/genesis.json > output.json && mv output.json ~/.exampled/config/genesis.json +$exampled_BIN genesis collect-gentxs diff --git a/tutorials/oracle/base/x/oracle/module/autocli.go b/tutorials/oracle/base/x/oracle/module/autocli.go index bf92a81990..8a580087f8 100644 --- a/tutorials/oracle/base/x/oracle/module/autocli.go +++ b/tutorials/oracle/base/x/oracle/module/autocli.go @@ -20,11 +20,6 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { {ProtoField: "address"}, }, }, - { - RpcMethod: "Params", - Use: "params", - Short: "Get the current module parameters", - }, { RpcMethod: "Prices", Use: "prices", diff --git a/tutorials/oracle/docs/03-testing-oracle.md b/tutorials/oracle/docs/03-testing-oracle.md index dc1fc7fdbb..905ca0d741 100644 --- a/tutorials/oracle/docs/03-testing-oracle.md +++ b/tutorials/oracle/docs/03-testing-oracle.md @@ -27,7 +27,7 @@ This command runs the script `tutorials/oracle/base/scripts/init.sh`, which sets Now, we can start the application. Run the following command in your terminal: ```shell -tutoriald start +exampled start ``` This command starts your application, begins the blockchain node, and starts processing transactions. @@ -37,7 +37,7 @@ This command starts your application, begins the blockchain node, and starts pro Finally, we can query the current prices from the Oracle module. Run the following command in your terminal: ```shell -tutoriald q oracle prices +exampled q oracle prices ``` This command queries the current prices from the Oracle module. The expected output shows that the vote extensions were successfully included in the block and the Oracle module was able to retrieve the price data.