Skip to content

Commit

Permalink
feat: remove pulsar generation (prep 0.52) (#4295)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt authored Aug 12, 2024
1 parent c4a2e01 commit da00481
Show file tree
Hide file tree
Showing 28 changed files with 39 additions and 109 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
- [#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)
- [#4290](https://github.com/ignite/cli/pull/4290) Remove ignite ics logic from ignite cli (this functionality will be in the `consumer` app)
- [#4295](https://github.com/ignite/cli/pull/4295) Stop scaffolding `pulsar` files

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/cometbft/cometbft v0.38.10
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.5.0
github.com/cosmos/gogoproto v1.6.0
github.com/emicklei/proto v1.12.2
github.com/emicklei/proto-contrib v0.15.0
github.com/go-delve/delve v1.21.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI=
github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU=
github.com/cosmos/gogoproto v1.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o=
github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I=
github.com/cosmos/gogoproto v1.6.0 h1:Xm0F/96O5Ox4g6xGgjA41rWaaPjYtOdTi59uBcV2qEE=
github.com/cosmos/gogoproto v1.6.0/go.mod h1:Y+g956rcUf2vr4uwtCcK/1Xx9BWVluCtcI9vsh0GHmk=
github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y=
github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
Expand Down
2 changes: 1 addition & 1 deletion ignite/cmd/scaffold_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ about Cosmos SDK on https://docs.cosmos.network
c.Flags().String(flagProtoDir, defaults.ProtoDir, "chain proto directory")

// consumer scaffolding have been migrated to an ignite app
c.Flags().MarkDeprecated("consumer", "use 'ignite consumer' app instead")
_ = c.Flags().MarkDeprecated("consumer", "use 'ignite consumer' app instead")

return c
}
Expand Down
4 changes: 0 additions & 4 deletions ignite/pkg/cosmosanalysis/app/testdata/app_di.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
Expand Down Expand Up @@ -263,9 +262,6 @@ func NewSimApp(
// RegisterUpgradeHandlers is used for registering any on-chain upgrades.
app.RegisterUpgradeHandlers()

// add test gRPC service for testing gRPC queries in isolation
testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{})

// create the simulation manager and define the order of the modules for deterministic simulations
//
// NOTE: this is not required apps that don't use the simulator for fuzz testing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1"
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/core/appconfig"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"
_ "cosmossdk.io/x/circuit" // import for side-effects
circuittypes "cosmossdk.io/x/circuit/types"
_ "cosmossdk.io/x/evidence" // import for side-effects
Expand Down Expand Up @@ -71,7 +71,6 @@ import (
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
"google.golang.org/protobuf/types/known/durationpb"

marsmodulev1 "github.com/ignite/mars/api/mars/mars/module"
_ "github.com/ignite/mars/x/mars" // import for side-effects
marsmoduletypes "github.com/ignite/mars/x/mars/types"
)
Expand Down Expand Up @@ -297,7 +296,7 @@ var (
},
{
Name: marsmoduletypes.ModuleName,
Config: appconfig.WrapAny(&marsmodulev1.Module{}),
Config: appconfig.WrapAny(&marsmoduletypes.Module{}),
},
// this line is used by starport scaffolding # stargate/app/moduleConfig
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1"
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/core/appconfig"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"
_ "cosmossdk.io/x/circuit" // import for side-effects
circuittypes "cosmossdk.io/x/circuit/types"
_ "cosmossdk.io/x/evidence" // import for side-effects
Expand Down Expand Up @@ -74,7 +74,6 @@ import (
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
"google.golang.org/protobuf/types/known/durationpb"

marsmodulev1 "github.com/tendermint/mars/api/mars/mars/module"
_ "github.com/tendermint/mars/x/mars" // import for side-effects
marsmoduletypes "github.com/tendermint/mars/x/mars/types"
)
Expand Down Expand Up @@ -305,7 +304,7 @@ var (
},
{
Name: marsmoduletypes.ModuleName,
Config: appconfig.WrapAny(&marsmodulev1.Module{}),
Config: appconfig.WrapAny(&marsmoduletypes.Module{}),
},
// this line is used by starport scaffolding # stargate/app/moduleConfig
},
Expand Down
6 changes: 1 addition & 5 deletions ignite/pkg/cosmosgen/cosmosgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func WithHooksGeneration(out ModulePathFunc, hooksRootPath string) Option {
}
}

// WithGoGeneration adds protobuf (gogoproto and pulsar) code generation.
// WithGoGeneration adds protobuf (gogoproto) code generation.
func WithGoGeneration() Option {
return func(o *generateOptions) {
o.generateProtobuf = true
Expand Down Expand Up @@ -165,10 +165,6 @@ func Generate(ctx context.Context, cacheStorage cache.Storage, appPath, protoDir
if err := g.generateGoGo(ctx); err != nil {
return err
}

if err := g.generatePulsar(ctx); err != nil {
return err
}
}

if g.opts.specOut != "" {
Expand Down
10 changes: 1 addition & 9 deletions ignite/pkg/cosmosgen/generate_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,12 @@ func (g *generator) gogoTemplate() string {
return filepath.Join(g.appPath, g.protoDir, "buf.gen.gogo.yaml")
}

func (g *generator) pulsarTemplate() string {
return filepath.Join(g.appPath, g.protoDir, "buf.gen.pulsar.yaml")
}

func (g *generator) protoPath() string {
return filepath.Join(g.appPath, g.protoDir)
}

func (g *generator) generateGoGo(ctx context.Context) error {
return g.generate(ctx, g.gogoTemplate(), g.goModPath, "*/module.proto")
}

func (g *generator) generatePulsar(ctx context.Context) error {
return g.generate(ctx, g.pulsarTemplate(), "")
return g.generate(ctx, g.gogoTemplate(), g.goModPath)
}

func (g *generator) generate(ctx context.Context, template, fromPath string, excluded ...string) error {
Expand Down
1 change: 0 additions & 1 deletion ignite/pkg/cosmosgen/generate_typescript.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ func (g *tsGenerator) generateModuleTemplate(
protoPath,
typesOut,
g.g.tsTemplate(),
cosmosbuf.ExcludeFiles("module.proto"),
cosmosbuf.IncludeWKT(),
); err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion ignite/pkg/cosmosgen/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func DepTools() []string {
// Go code generation plugin.
"google.golang.org/grpc/cmd/protoc-gen-go-grpc",
"google.golang.org/protobuf/cmd/protoc-gen-go",
"github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar",

// grpc-gateway plugins.
"github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway",
Expand Down
13 changes: 7 additions & 6 deletions ignite/services/chain/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,17 @@ func (c *Chain) InitAccounts(ctx context.Context, cfg *chainconfig.Config) error
if len(cfg.Validators) == 0 {
return nil
}

if cfg.IsConsumerChain() {
// we skip early if the chain is a consumer chain
return nil
} else {
// Sovereign chain writes validators in gentxs.
_, err := c.IssueGentx(ctx, createValidatorFromConfig(cfg))
if err != nil {
return err
}
}

// Sovereign chain writes validators in gentxs.
if _, err := c.IssueGentx(ctx, createValidatorFromConfig(cfg)); err != nil {
return err
}

return nil
}

Expand Down
7 changes: 3 additions & 4 deletions ignite/services/scaffolder/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func (s Scaffolder) CreateConfigs(
moduleName string,
configs ...string,
) error {
appName := s.modpath.Package
// If no module is provided, we add the type to the app's module
if moduleName == "" {
moduleName = s.modpath.Package
Expand All @@ -36,7 +35,7 @@ func (s Scaffolder) CreateConfigs(
return errors.Errorf("the module %v not exist", moduleName)
}

if err := checkConfigCreated(s.appPath, appName, moduleName, configs); err != nil {
if err := checkConfigCreated(s.appPath, moduleName, configs); err != nil {
return err
}

Expand Down Expand Up @@ -64,8 +63,8 @@ func (s Scaffolder) CreateConfigs(
}

// checkConfigCreated checks if the config has been already created.
func checkConfigCreated(appPath, appName, moduleName string, configs []string) (err error) {
path := filepath.Join(appPath, "api", appName, moduleName, "module")
func checkConfigCreated(appPath, moduleName string, configs []string) (err error) {
path := filepath.Join(appPath, "x", moduleName, "module")
ok, err := goanalysis.HasAnyStructFieldsInPkg(path, "Module", configs)
if err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion ignite/templates/app/files-minimal/app/app.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/app/files-minimal/app/app_config.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1"
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
"cosmossdk.io/core/appconfig"
"cosmossdk.io/depinject/appconfig"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/runtime"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/app/files/app/app_config.go.plush
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1"
upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1"
vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1"
"cosmossdk.io/core/appconfig"
"cosmossdk.io/depinject/appconfig"
circuittypes "cosmossdk.io/x/circuit/types"
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/feegrant"
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/app/files/go.mod.plush
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/gogoproto v1.5.0
github.com/cosmos/gogoproto v1.6.0
github.com/cosmos/ibc-go/modules/capability v1.0.0
github.com/cosmos/ibc-go/v8 v8.3.1
github.com/golang/protobuf v1.5.4
Expand Down
3 changes: 2 additions & 1 deletion ignite/templates/app/files/{{protoDir}}/buf.gen.gogo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ plugins:
out: .
opt:
- plugins=grpc
- Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
- Mgoogle/protobuf/any.proto=github.com/cosmos/gogoproto/types/any
- Mcosmos/orm/v1/orm.proto=cosmossdk.io/orm
- Mcosmos/app/v1alpha1/module.proto=cosmossdk.io/api/cosmos/app/v1alpha1
- name: grpc-gateway
out: .
opt:
Expand Down
23 changes: 0 additions & 23 deletions ignite/templates/app/files/{{protoDir}}/buf.gen.pulsar.yaml.plush

This file was deleted.

6 changes: 1 addition & 5 deletions ignite/templates/module/create/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ func appConfigModify(replacer placeholder.Replacer, opts *CreateOptions) genny.R
// Import
content, err := xast.AppendImports(
fConfig.String(),
xast.WithLastNamedImport(
fmt.Sprintf("%[1]vmodulev1", opts.ModuleName),
fmt.Sprintf("%[1]v/api/%[2]v/%[3]v/module/%[4]v", opts.ModulePath, opts.AppName, opts.ModuleName, opts.ProtoVer),
),
xast.WithLastNamedImport(
"_",
fmt.Sprintf("%[1]v/x/%[2]v/module", opts.ModulePath, opts.ModuleName),
Expand All @@ -118,7 +114,7 @@ func appConfigModify(replacer placeholder.Replacer, opts *CreateOptions) genny.R

template = `{
Name: %[2]vmoduletypes.ModuleName,
Config: appconfig.WrapAny(&%[2]vmodulev1.Module{}),
Config: appconfig.WrapAny(&%[2]vmoduletypes.Module{}),
},
%[1]v`
replacement = fmt.Sprintf(template, module.PlaceholderSgAppModuleConfig, opts.ModuleName)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package <%= moduleName %>
import (
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"

modulev1 "<%= modulePath %>/api/<%= appName %>/<%= moduleName %>/<%= protoVer %>"
"<%= modulePath %>/x/<%= moduleName %>/types"
)

// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: &autocliv1.ServiceCommandDescriptor{
Service: modulev1.Query_ServiceDesc.ServiceName,
Service: types.Query_serviceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Params",
Expand All @@ -21,7 +21,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
},
},
Tx: &autocliv1.ServiceCommandDescriptor{
Service: modulev1.Msg_ServiceDesc.ServiceName,
Service: types.Msg_serviceDesc.ServiceName,
EnhanceCustomCommand: true, // only required if you want to use the custom command
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"fmt"

"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
Expand All @@ -25,7 +26,6 @@ import (

// this line is used by starport scaffolding # 1

modulev1 "<%= modulePath %>/api/<%= appName %>/<%= moduleName %>/module/<%= protoVer %>"
"<%= modulePath %>/x/<%= moduleName %>/keeper"
"<%= modulePath %>/x/<%= moduleName %>/types"
<%= if (isIBC) { %>"<%= modulePath %>/x/<%= moduleName %>/client/cli"<% } %>
Expand Down Expand Up @@ -181,9 +181,9 @@ func (am AppModule) IsAppModule() {}
// ----------------------------------------------------------------------------

func init() {
appmodule.Register(
&modulev1.Module{},
appmodule.Provide(ProvideModule),
appconfig.Register(
&types.Module{},
appconfig.Provide(ProvideModule),
)
}

Expand All @@ -193,7 +193,7 @@ type ModuleInputs struct {
AddressCodec address.Codec
StoreService store.KVStoreService
Cdc codec.Codec
Config *modulev1.Module
Config *types.Module
Logger log.Logger

AccountKeeper types.AccountKeeper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package <%= protoModulePkgName %>;

import "cosmos/app/v1alpha1/module.proto";

option go_package = "<%= modulePath %>/x/<%= moduleName %>/types";

// Module is the config object for the module.
message Module {
option (cosmos.app.v1alpha1.module) = {
Expand Down
Loading

0 comments on commit da00481

Please sign in to comment.