Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove consumer chain scaffolding #4290

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [#4160](https://github.com/ignite/cli/pull/4160) Enable copyloopvar linter
- [#4162](https://github.com/ignite/cli/pull/4162) Enable errcheck linter
- [#4189](https://github.com/ignite/cli/pull/4189) Deprecate `ignite node` for `ignite connect` app
- [#4290](https://github.com/ignite/cli/pull/4290) Remove ignite consumer from ignite cli (this functionality will be in the `consumer` app)

### Fixes

Expand Down
8 changes: 2 additions & 6 deletions ignite/cmd/scaffold_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
flagMinimal = "minimal"
flagNoDefaultModule = "no-module"
flagSkipGit = "skip-git"
flagIsConsumer = "consumer"

tplScaffoldChainSuccess = `
⭐️ Successfully created a new blockchain '%[1]v'.
Expand Down Expand Up @@ -88,11 +87,10 @@
c.Flags().Bool(flagSkipGit, false, "skip Git repository initialization")
c.Flags().Bool(flagSkipProto, false, "skip proto generation")
c.Flags().Bool(flagMinimal, false, "create a minimal blockchain (with the minimum required Cosmos SDK modules)")
c.Flags().Bool(flagIsConsumer, false, "scafffold an ICS consumer chain")
c.Flags().String(flagProtoDir, defaults.ProtoDir, "chain proto directory")

// Cannot have both minimal and consumer flag
c.MarkFlagsMutuallyExclusive(flagIsConsumer, flagMinimal)
// consumer scaffolding have been migrated to an ignite app
c.Flags().MarkDeprecated("consumer", "use 'ignite consumer' app instead")

Check failure on line 93 in ignite/cmd/scaffold_chain.go

View workflow job for this annotation

GitHub Actions / Lint Go code

Error return value of `(*github.com/spf13/pflag.FlagSet).MarkDeprecated` is not checked (errcheck)

return c
}
Expand All @@ -109,7 +107,6 @@
noDefaultModule, _ = cmd.Flags().GetBool(flagNoDefaultModule)
skipGit, _ = cmd.Flags().GetBool(flagSkipGit)
minimal, _ = cmd.Flags().GetBool(flagMinimal)
isConsumer, _ = cmd.Flags().GetBool(flagIsConsumer)
params, _ = cmd.Flags().GetStringSlice(flagParams)
moduleConfigs, _ = cmd.Flags().GetStringSlice(flagModuleConfigs)
skipProto, _ = cmd.Flags().GetBool(flagSkipProto)
Expand Down Expand Up @@ -139,7 +136,6 @@
protoDir,
noDefaultModule,
minimal,
isConsumer,
params,
moduleConfigs,
)
Expand Down
1 change: 1 addition & 0 deletions ignite/config/chain/base/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const (
ValidationSovereign = "sovereign"
// ValidationConsumer is when the chain is validated by a provider chain.
// Such chain is called a consumer chain.
// This is a special case for ICS chains, used by the consumer ignite app (https://github.com/ignite/apps/issues/101).
ValidationConsumer = "consumer"
)

Expand Down
41 changes: 0 additions & 41 deletions ignite/internal/plugin/consumer.go

This file was deleted.

137 changes: 0 additions & 137 deletions ignite/internal/plugin/consumer_test.go

This file was deleted.

11 changes: 5 additions & 6 deletions ignite/services/chain/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"github.com/imdario/mergo"

chainconfig "github.com/ignite/cli/v29/ignite/config/chain"
plugininternal "github.com/ignite/cli/v29/ignite/internal/plugin"
chaincmdrunner "github.com/ignite/cli/v29/ignite/pkg/chaincmd/runner"
"github.com/ignite/cli/v29/ignite/pkg/cliui/view/accountview"
"github.com/ignite/cli/v29/ignite/pkg/confile"
Expand Down Expand Up @@ -176,11 +175,9 @@
return nil
}
if cfg.IsConsumerChain() {
err := plugininternal.ConsumerWriteGenesis(ctx, c)
if err != nil {
return err
}
// we skip early if the chain is a consumer chain
return nil
} else {

Check failure on line 180 in ignite/services/chain/init.go

View workflow job for this annotation

GitHub Actions / Lint Go code

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
// Sovereign chain writes validators in gentxs.
_, err := c.IssueGentx(ctx, createValidatorFromConfig(cfg))
if err != nil {
Expand Down Expand Up @@ -216,12 +213,14 @@
if err != nil {
return false, err
}

cfg, err := c.Config()
if err != nil {
return false, err
}
if cfg.IsConsumerChain() {
return plugininternal.ConsumerIsInitialized(context.Background(), c)
// when consumer chain, we skip the IsInialized logic
return true, nil
}

gentxDir := filepath.Join(home, "config", "gentx")
Expand Down
6 changes: 2 additions & 4 deletions ignite/services/scaffolder/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func Init(
ctx context.Context,
runner *xgenny.Runner,
root, name, addressPrefix, protoDir string,
noDefaultModule, minimal, isConsumerChain bool,
noDefaultModule, minimal bool,
params, moduleConfigs []string,
) (string, string, error) {
pathInfo, err := gomodulepath.Parse(name)
Expand Down Expand Up @@ -60,7 +60,6 @@ func Init(
path,
noDefaultModule,
minimal,
isConsumerChain,
params,
moduleConfigs,
)
Expand All @@ -75,7 +74,7 @@ func generate(
addressPrefix,
protoDir,
absRoot string,
noDefaultModule, minimal, isConsumerChain bool,
noDefaultModule, minimal bool,
params, moduleConfigs []string,
) (xgenny.SourceModification, error) {
// Parse params with the associated type
Expand Down Expand Up @@ -106,7 +105,6 @@ func generate(
BinaryNamePrefix: pathInfo.Root,
AddressPrefix: addressPrefix,
IsChainMinimal: minimal,
IsConsumerChain: isConsumerChain,
})
if err != nil {
return xgenny.SourceModification{}, err
Expand Down
7 changes: 0 additions & 7 deletions ignite/templates/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ var (

//go:embed files-minimal/* files-minimal/**/*
filesMinimal embed.FS

//go:embed files-consumer/* files-consumer/**/*
filesConsumer embed.FS
)

const (
Expand All @@ -46,9 +43,6 @@ func NewGenerator(opts *Options) (*genny.Generator, error) {
excludePrefix = append(excludePrefix, ibcConfig)
overridesFS["files-minimal"] = filesMinimal
}
if opts.IsConsumerChain {
overridesFS["files-consumer"] = filesConsumer
}

g := genny.New()
if err := g.SelectiveFS(subfs, includePrefix, nil, excludePrefix, nil); err != nil {
Expand All @@ -74,7 +68,6 @@ func NewGenerator(opts *Options) (*genny.Generator, error) {
ctx.Set("GitHubPath", opts.GitHubPath)
ctx.Set("BinaryNamePrefix", opts.BinaryNamePrefix)
ctx.Set("AddressPrefix", opts.AddressPrefix)
ctx.Set("IsConsumerChain", opts.IsConsumerChain)
ctx.Set("DepTools", cosmosgen.DepTools())
ctx.Set("IsChainMinimal", opts.IsChainMinimal)

Expand Down
Loading
Loading