Skip to content

Commit

Permalink
chore(runtime): audit (backport #17035) (#17036)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 18, 2023
1 parent d23caef commit 2049c4b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions runtime/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (a *AppBuilder) Build(db dbm.DB, traceStore io.Writer, baseAppOptions ...fu

a.app.BaseApp = bApp
a.app.configurator = module.NewConfigurator(a.app.cdc, a.app.MsgServiceRouter(), a.app.GRPCQueryRouter())

if err := a.app.ModuleManager.RegisterServices(a.app.configurator); err != nil {
panic(err)
}
Expand Down
11 changes: 4 additions & 7 deletions runtime/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,25 @@ func NewEventManager(ctx context.Context) event.Manager {
}

// Emit emits an typed event that is defined in the protobuf file.
// In the future these events will be added to consensus
// In the future these events will be added to consensus.
func (e Events) Emit(ctx context.Context, event protoiface.MessageV1) error {
return e.EventManagerI.EmitTypedEvent(event)
}

// EmitKV emits a key value pair event
// EmitKV emits a key value pair event.
func (e Events) EmitKV(ctx context.Context, eventType string, attrs ...event.Attribute) error {
attributes := make([]sdk.Attribute, 0, len(attrs))

for _, attr := range attrs {
attributes = append(attributes, sdk.NewAttribute(attr.Key, attr.Value))
}

events := sdk.Events{
sdk.NewEvent(eventType, attributes...),
}
e.EventManagerI.EmitEvents(events)
e.EventManagerI.EmitEvents(sdk.Events{sdk.NewEvent(eventType, attributes...)})
return nil
}

// Emit emits an typed event that is defined in the protobuf file.
// In the future these events will be added to consensus
// In the future these events will be added to consensus.
func (e Events) EmitNonConsensus(ctx context.Context, event protoiface.MessageV1) error {
return e.EventManagerI.EmitTypedEvent(event)
}
4 changes: 3 additions & 1 deletion runtime/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func ProvideApp(interfaceRegistry codectypes.InterfaceRegistry) (

// At startup, check that all proto annotations are correct.
if err := msgservice.ValidateProtoAnnotations(protoFiles); err != nil {
// Once we switch to using protoreflect-based antehandlers, we might
// Once we switch to using protoreflect-based ante handlers, we might
// want to panic here instead of logging a warning.
_, _ = fmt.Fprintln(os.Stderr, err.Error())
}
Expand Down Expand Up @@ -178,10 +178,12 @@ func ProvideInterfaceRegistry(customGetSigners []signing.CustomGetSigner) (codec
if err != nil {
return nil, err
}

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

return interfaceRegistry, nil
}

Expand Down
1 change: 1 addition & 0 deletions runtime/services/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewAutoCLIQueryService(appModules map[string]interface{}) *AutoCLIQueryServ
}

// ExtractAutoCLIOptions extracts autocli ModuleOptions from the provided app modules.
//
// Example Usage:
//
// ExtractAutoCLIOptions(ModuleManager.Modules)
Expand Down
2 changes: 1 addition & 1 deletion runtime/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type AppI interface {
Name() string

// The application types codec.
// NOTE: This shoult be sealed before being returned.
// NOTE: This should NOT be sealed before being returned.
LegacyAmino() *codec.LegacyAmino

// Application updates every begin block.
Expand Down

0 comments on commit 2049c4b

Please sign in to comment.