Skip to content

Commit

Permalink
feat: start app wiring with runtime and x/params modules (#11924)
Browse files Browse the repository at this point in the history
* feat: start app wiring with runtime and x/params modules

* WIP

* WIP

* docs

* docs, cleanup

* fixing tests

* rollback unrelated changes

* fix

* test fixes

* simplification, tests

* fix tests

* docs

* go mod tidy

* update module path

* codegen

* address middleware removal

* update container alpha 4

* Fix cosmossdk.io/api dependency conflict

- go mod tidy

Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
  • Loading branch information
aaronc and kocubinski authored May 25, 2022
1 parent 2b549b8 commit 1f9871c
Show file tree
Hide file tree
Showing 25 changed files with 1,626 additions and 244 deletions.
994 changes: 994 additions & 0 deletions api/cosmos/app/runtime/v1alpha1/module.pulsar.go

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,8 @@ func (app *BaseApp) SetStreamingService(s StreamingService) {
// BaseApp will pass BeginBlock, DeliverTx, and EndBlock requests and responses to the streaming services to update their ABCI context
app.abciListeners = append(app.abciListeners, s)
}

// SetTxDecoder sets the TxDecoder if it wasn't provided in the BaseApp constructor.
func (app *BaseApp) SetTxDecoder(txDecoder sdk.TxDecoder) {
app.txDecoder = txDecoder
}
12 changes: 6 additions & 6 deletions core/appconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import (

"github.com/cosmos/cosmos-sdk/container"

appv1alpha1 "github.com/cosmos/cosmos-sdk/api/cosmos/app/v1alpha1"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"

"cosmossdk.io/core/internal"
)

// LoadJSON loads an app config in JSON format.
func LoadJSON(bz []byte) container.Option {
func LoadJSON(bz []byte) container.Config {
config := &appv1alpha1.Config{}
err := protojson.Unmarshal(bz, config)
if err != nil {
Expand All @@ -31,7 +31,7 @@ func LoadJSON(bz []byte) container.Option {
}

// LoadYAML loads an app config in YAML format.
func LoadYAML(bz []byte) container.Option {
func LoadYAML(bz []byte) container.Config {
j, err := yaml.YAMLToJSON(bz)
if err != nil {
return container.Error(err)
Expand All @@ -42,8 +42,8 @@ func LoadYAML(bz []byte) container.Option {

// Compose composes a v1alpha1 app config into a container option by resolving
// the required modules and composing their options.
func Compose(appConfig *appv1alpha1.Config) container.Option {
opts := []container.Option{
func Compose(appConfig *appv1alpha1.Config) container.Config {
opts := []container.Config{
container.Supply(appConfig),
}

Expand Down Expand Up @@ -99,7 +99,7 @@ func Compose(appConfig *appv1alpha1.Config) container.Option {
}
}

return container.Options(opts...)
return container.Configs(opts...)
}

func dumpRegisteredModules(modules map[protoreflect.FullName]*internal.ModuleInitializer) string {
Expand Down
2 changes: 1 addition & 1 deletion core/appconfig/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
_ "cosmossdk.io/core/internal/testpb"
)

func expectContainerErrorContains(t *testing.T, option container.Option, contains string) {
func expectContainerErrorContains(t *testing.T, option container.Config, contains string) {
t.Helper()
err := container.Build(option)
assert.ErrorContains(t, err, contains)
Expand Down
13 changes: 5 additions & 8 deletions core/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,25 @@ module cosmossdk.io/core
go 1.18

require (
cosmossdk.io/api v0.1.0-alpha8
github.com/cosmos/cosmos-proto v1.0.0-alpha7
github.com/cosmos/cosmos-sdk/api v0.1.0
github.com/cosmos/cosmos-sdk/container v1.0.0-alpha.3
github.com/cosmos/cosmos-sdk/container v1.0.0-alpha.4
google.golang.org/protobuf v1.28.0
gotest.tools/v3 v3.2.0
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/fogleman/gg v1.3.0 // indirect
github.com/goccy/go-graphviz v0.0.9 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
golang.org/x/exp v0.0.0-20220428152302-39d4317da171 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 // indirect
golang.org/x/text v0.3.5 // indirect
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/grpc v1.46.2 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Expand Down
Loading

0 comments on commit 1f9871c

Please sign in to comment.