Skip to content

Commit

Permalink
Merge branch 'main' into bot/fix-typos
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle authored Jun 7, 2024
2 parents b85f98e + 439f2f9 commit 5270a21
Show file tree
Hide file tree
Showing 17 changed files with 5,615 additions and 46 deletions.
5,365 changes: 5,365 additions & 0 deletions api/cosmos/streaming/v1/grpc.pulsar.go

Large diffs are not rendered by default.

150 changes: 150 additions & 0 deletions api/cosmos/streaming/v1/grpc_grpc.pb.go

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

9 changes: 5 additions & 4 deletions codec/depinject.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1"
"cosmossdk.io/core/address"
"cosmossdk.io/core/legacy"
"cosmossdk.io/core/registry"
"cosmossdk.io/depinject"
"cosmossdk.io/x/tx/signing"

Expand All @@ -20,7 +21,7 @@ func ProvideInterfaceRegistry(
addressCodec address.Codec,
validatorAddressCodec address.ValidatorAddressCodec,
customGetSigners []signing.CustomGetSigner,
) (types.InterfaceRegistry, error) {
) (types.InterfaceRegistry, registry.InterfaceRegistrar, error) {
signingOptions := signing.Options{
AddressCodec: addressCodec,
ValidatorAddressCodec: validatorAddressCodec,
Expand All @@ -34,14 +35,14 @@ func ProvideInterfaceRegistry(
SigningOptions: signingOptions,
})
if err != nil {
return nil, err
return nil, nil, err
}

if err := interfaceRegistry.SigningContext().Validate(); err != nil {
return nil, err
return nil, nil, err
}

return interfaceRegistry, nil
return interfaceRegistry, interfaceRegistry, nil
}

func ProvideLegacyAmino() legacy.Amino {
Expand Down
1 change: 1 addition & 0 deletions contrib/images/simd-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ COPY runtime/v2/go.mod runtime/v2/go.sum /work/runtime/v2/
COPY server/v2/appmanager/go.mod server/v2/appmanager/go.sum /work/server/v2/appmanager/
COPY server/v2/core/go.mod server/v2/core/go.sum /work/server/v2/core/
COPY server/v2/stf/go.mod server/v2/stf/go.sum /work/server/v2/stf/
COPY server/v2/cometbft/go.mod server/v2/cometbft/go.sum /work/server/v2/cometbft/

RUN go mod download

Expand Down
11 changes: 11 additions & 0 deletions core/context/context._test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package context

import (
"testing"

"github.com/stretchr/testify/require"
)

func Test_Sanity(t *testing.T) {
require.NotEqual(t, CometInfoKey, ExecModeKey)
}
20 changes: 13 additions & 7 deletions core/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ package context

type contextKey uint8

const (
ExecModeKey contextKey = iota
CometInfoKey contextKey = iota
type (
execModeKey struct{}
cometInfoKey struct{}
environmentKey struct{}
)

// EnvironmentContextKey is the context key for the environment.
// A caller should not assume the environment is available in each context.
// ref: https://github.com/cosmos/cosmos-sdk/issues/19640
var EnvironmentContextKey = struct{}{}
var (
ExecModeKey = execModeKey{}
CometInfoKey = cometInfoKey{}

// EnvironmentContextKey is the context key for the environment.
// A caller should not assume the environment is available in each context.
// ref: https://github.com/cosmos/cosmos-sdk/issues/19640
EnvironmentContextKey = environmentKey{}
)
4 changes: 2 additions & 2 deletions core/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var _ KVStore = (Writer)(nil)

// ReaderMap represents a readonly view over all the accounts state.
type ReaderMap interface {
// ReaderMap must return the state for the provided actor.
// GetReader must return the state for the provided actor.
// Storage implements might treat this as a prefix store over an actor.
// Prefix safety is on the implementer.
GetReader(actor []byte) (Reader, error)
Expand All @@ -142,7 +142,7 @@ type ReaderMap interface {
// WriterMap represents a writable actor state.
type WriterMap interface {
ReaderMap
// WriterMap must the return a WritableState
// GetWriter must the return a WritableState
// for the provided actor namespace.
GetWriter(actor []byte) (Writer, error)
// ApplyStateChanges applies all the state changes
Expand Down
3 changes: 2 additions & 1 deletion go.work.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use (
./math
./orm
./simapp
./simapp/v2
./tests
./server/v2/stf
./server/v2/appmanager
Expand All @@ -23,6 +24,7 @@ use (
./tools/confix
./tools/hubl
./x/accounts
./x/accounts/defaults/lockup
./x/auth
./x/authz
./x/bank
Expand All @@ -42,5 +44,4 @@ use (
./x/tx
./x/upgrade
./x/epochs
./x/accounts/defaults/lockup
)
10 changes: 9 additions & 1 deletion runtime/v2/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,13 @@ func (a *App) GetLogger() log.Logger {
}

func (a *App) ExecuteGenesisTx(_ []byte) error {
panic("not implemented")
panic("App.ExecuteGenesisTx not supported in runtime/v2")
}

func (a *App) SetAppVersion(context.Context, uint64) error {
return nil
}

func (a *App) AppVersion(context.Context) (uint64, error) {
return 0, nil
}
13 changes: 5 additions & 8 deletions runtime/v2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ func (m *MM) InitGenesisJSON(

mod := m.modules[moduleName]

// skip genutil as it's a special module that handles gentxs
// TODO: should this be an empty extension interface on genutil for server v2?
if moduleName == "genutil" {
continue
}

// we might get an adapted module, a native core API module or a legacy module
switch module := mod.(type) {
case appmodule.HasGenesisAuto:
Expand Down Expand Up @@ -184,7 +178,7 @@ func (m *MM) InitGenesisJSON(
// only one module will update the validator set
if len(moduleValUpdates) > 0 {
if seenValUpdates {
return errors.New("validator InitGenesis updates already set by a previous module")
return fmt.Errorf("validator InitGenesis updates already set by a previous module: current module %s", moduleName)
} else {
seenValUpdates = true
}
Expand Down Expand Up @@ -284,7 +278,10 @@ type hasABCIEndBlock interface {
}

// EndBlock runs the end-block logic of all modules and tx validator updates
func (m *MM) EndBlock() (endBlockFunc func(ctx context.Context) error, valUpdateFunc func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error)) {
func (m *MM) EndBlock() (
endBlockFunc func(ctx context.Context) error,
valUpdateFunc func(ctx context.Context) ([]appmodulev2.ValidatorUpdate, error),
) {
var validatorUpdates []appmodulev2.ValidatorUpdate
endBlockFunc = func(ctx context.Context) error {
for _, moduleName := range m.config.EndBlockers {
Expand Down
11 changes: 7 additions & 4 deletions runtime/v2/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
"cosmossdk.io/core/app"
"cosmossdk.io/core/appmodule"
appmodulev2 "cosmossdk.io/core/appmodule/v2"
"cosmossdk.io/core/comet"
Expand Down Expand Up @@ -125,10 +126,6 @@ func ProvideAppBuilder(
_, _ = fmt.Fprintln(os.Stderr, err.Error())
}

// TODO register as Invoker from simapp v2; remove if not needed
// std.RegisterInterfaces(interfaceRegistrar)
// std.RegisterLegacyAminoCodec(amino)

msgRouterBuilder := stf.NewMsgRouterBuilder()
app := &App{
storeKeys: nil,
Expand Down Expand Up @@ -246,3 +243,9 @@ func ProvideGenesisTxHandler(appBuilder *AppBuilder) genesis.TxHandler {
func ProvideCometService() comet.Service {
return &services.ContextAwareCometInfoService{}
}

// ProvideAppVersionModifier returns nil, `app.VersionModifier` is a feature of BaseApp and neither used nor required for runtim/v2.
// nil is acceptable, see: https://github.com/cosmos/cosmos-sdk/blob/0a6ee406a02477ae8ccbfcbe1b51fc3930087f4c/x/upgrade/keeper/keeper.go#L438
func ProvideAppVersionModifier(app *AppBuilder) app.VersionModifier {
return nil
}
5 changes: 4 additions & 1 deletion runtime/v2/services/comet.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ type ContextAwareCometInfoService struct{}

// CometInfo implements comet.Service.
func (c *ContextAwareCometInfoService) CometInfo(ctx context.Context) comet.Info {
ci := ctx.Value(corecontext.CometInfoKey).(comet.Info)
ci, ok := ctx.Value(corecontext.CometInfoKey).(comet.Info)
if !ok {
panic("comet.Info not found in context")
}
return ci
}
Loading

0 comments on commit 5270a21

Please sign in to comment.