Skip to content

Commit

Permalink
feat: remove pulsar generation (prep 0.52)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Aug 9, 2024
1 parent 38c9f4d commit 847c998
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 95 deletions.
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.9
github.com/cosmos/cosmos-sdk v0.50.8
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
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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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
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
6 changes: 3 additions & 3 deletions ignite/templates/app/files/go.mod.plush
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
cosmossdk.io/client/v2 v2.0.0-beta.4
cosmossdk.io/collections v0.4.0
cosmossdk.io/core v0.11.0
cosmossdk.io/depinject v1.0.0-alpha.4
cosmossdk.io/depinject v1.0.0
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.3.1
cosmossdk.io/store v1.1.0
Expand All @@ -31,8 +31,8 @@ require (
github.com/cometbft/cometbft v0.38.8
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.8
github.com/cosmos/gogoproto v1.5.0
github.com/cosmos/cosmos-sdk v0.50.9
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
20 changes: 0 additions & 20 deletions integration/app/cmd_proto_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package app_test
import (
"os"
"path/filepath"
"strings"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -59,25 +58,6 @@ var (
}
)

// TestGenerateAppCheckBufPulsarPath tests scaffolding a new chain and checks if the buf.gen.pulsar.yaml file is correct.
func TestGenerateAppCheckBufPulsarPath(t *testing.T) {
var (
env = envtest.New(t)
app = env.Scaffold("github.com/test/blog")
)

bufGenPulsarPath := filepath.Join(app.SourcePath(), "proto", "buf.gen.pulsar.yaml")
_, statErr := os.Stat(bufGenPulsarPath)
require.False(t, os.IsNotExist(statErr), "buf.gen.pulsar.yaml should be scaffolded")

result, err := os.ReadFile(bufGenPulsarPath)
require.NoError(t, err)

require.True(t, strings.Contains(string(result), "default: github.com/test/blog/api"), "buf.gen.pulsar.yaml should contain the correct api override")

app.EnsureSteady()
}

func TestChangeProtoPath(t *testing.T) {
var (
env = envtest.New(t)
Expand Down
1 change: 0 additions & 1 deletion integration/doctor/testdata/config-ok.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package tools

import (
_ "github.com/bufbuild/buf/cmd/buf"
_ "github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar"
_ "github.com/cosmos/gogoproto/protoc-gen-gocosmos"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
Expand Down
2 changes: 0 additions & 2 deletions integration/doctor/testdata/existing-tools.go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package tools

import (
_ "github.com/bufbuild/buf/cmd/buf"
_ "github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar"
_ "github.com/cosmos/gogoproto/protoc-gen-gocosmos"
_ "github.com/golang/protobuf/protoc-gen-go"
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway"
Expand All @@ -32,7 +31,6 @@ package tools

import (
_ "github.com/bufbuild/buf/cmd/buf"
_ "github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar"
_ "github.com/cosmos/gogoproto/protoc-gen-gocosmos"
_ "github.com/golang/protobuf/protoc-gen-go"
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway"
Expand Down
1 change: 0 additions & 1 deletion integration/doctor/testdata/missing-tools.go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
_ "github.com/cosmos/gogoproto/protoc-gen-gocosmos"
_ "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"
_ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
_ "golang.org/x/tools/cmd/goimports"
Expand Down

0 comments on commit 847c998

Please sign in to comment.