Skip to content

Commit

Permalink
chore: fix spelling errors (#22888)
Browse files Browse the repository at this point in the history
Co-authored-by: github-merge-queue <[email protected]>
Co-authored-by: Julien Robert <[email protected]>
(cherry picked from commit 4e81d17)

# Conflicts:
#	schema/type.go
  • Loading branch information
github-actions[bot] authored and mergify[bot] committed Dec 16, 2024
1 parent 8969116 commit ca5c822
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 5 deletions.
4 changes: 2 additions & 2 deletions codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type (
// MarshalInterface is a helper method which will wrap `i` into `Any` for correct
// binary interface (de)serialization.
MarshalInterface(i proto.Message) ([]byte, error)
// UnmarshalInterface is a helper method which will parse binary enoded data
// UnmarshalInterface is a helper method which will parse binary encoded data
// into `Any` and unpack any into the `ptr`. It fails if the target interface type
// is not registered in codec, or is not compatible with the serialized data
UnmarshalInterface(bz []byte, ptr interface{}) error
Expand All @@ -88,7 +88,7 @@ type (
// MarshalInterfaceJSON is a helper method which will wrap `i` into `Any` for correct
// JSON interface (de)serialization.
MarshalInterfaceJSON(i proto.Message) ([]byte, error)
// UnmarshalInterfaceJSON is a helper method which will parse JSON enoded data
// UnmarshalInterfaceJSON is a helper method which will parse JSON encoded data
// into `Any` and unpack any into the `ptr`. It fails if the target interface type
// is not registered in codec, or is not compatible with the serialized data
UnmarshalInterfaceJSON(bz []byte, ptr interface{}) error
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/adr-033-protobuf-inter-module-comm.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ replacing `Keeper` interfaces altogether.

* an alternative to keepers which can more easily lead to stable inter-module interfaces
* proper inter-module OCAPs
* improved module developer DevX, as commented on by several particpants on
* improved module developer DevX, as commented on by several participants on
[Architecture Review Call, Dec 3](https://hackmd.io/E0wxxOvRQ5qVmTf6N_k84Q)
* lays the groundwork for what can be a greatly simplified `app.go`
* router can be setup to enforce atomic transactions for module-to-module calls
Expand Down
2 changes: 1 addition & 1 deletion docs/build/building-modules/00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ While there are no definitive guidelines for writing modules, here are some impo
The SDK provides a set of APIs that a module can implement, and a set of services that a module can use.
Those APIs are defined in the `cosmossdk.io/core/appmodule` package, and are used to defined the module capabilities, which is used by `runtime` during the wiring of the application.

Whenever possible, a module should strive to use only the core APIs (`cosmossdk.io/core`) and not import the `github.com/cosmos/cosmos-sdk` module. This makes modules reusable accross SDK versions and reduces the risk of breaking changes.
Whenever possible, a module should strive to use only the core APIs (`cosmossdk.io/core`) and not import the `github.com/cosmos/cosmos-sdk` module. This makes modules reusable across SDK versions and reduces the risk of breaking changes.

Learn more about the core APIs for modules [here](../../learn/advanced/02-core.md).

Expand Down
2 changes: 1 addition & 1 deletion docs/learn/beginner/00-app-anatomy.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ In general, the core of the state-machine is defined in a file called `app.go`.

The first thing defined in `app.go` is the `type` of the application. It is generally comprised of the following parts:

* **Embeding [runtime.App](../../build/building-apps/00-runtime.md)** The runtime package manages the application's core components and modules through dependency injection. It provides declarative configuration for module management, state storage, and ABCI handling.
* **Embedding [runtime.App](../../build/building-apps/00-runtime.md)** The runtime package manages the application's core components and modules through dependency injection. It provides declarative configuration for module management, state storage, and ABCI handling.
* `Runtime` wraps `baseapp`, meaning when a transaction is relayed by CometBFT to the application, `app` uses `runtime`'s methods to route them to the appropriate module. Baseapp implements all the [ABCI methods](https://docs.cometbft.com/v1.0/spec/abci/) and the [routing logic](../advanced/00-baseapp.md#service-routers).
* It configures automatically the **[module manager](../../build/building-modules/01-module-manager.md#manager)** based on the app wiring configuration. The module manager facilitates operations related to these modules, like registering their [`Msg` service](../../build/building-modules/03-msg-services.md) and [gRPC `Query` service](#grpc-query-services), or setting the order of execution between modules for various functions like [`InitChainer`](#initchainer), [`PreBlocker`](#preblocker) and [`BeginBlocker` and `EndBlocker`](#beginblocker-and-endblocker).
* [**An App Wiring configuration file**](../../build/building-apps/00-runtime.md) The app wiring configuration file contains the list of application's modules that `runtime` must instantiate. The instantiation of the modules are done using `depinject`. It contains as well at which order the modules `InitGenesis`, `Pre/Begin/EndBlocker` should be executed.
Expand Down
84 changes: 84 additions & 0 deletions schema/type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package schema

// Type is an interface that all types in the schema implement.
// Currently, these are StateObjectType and EnumType.
type Type interface {
// TypeName returns the type's name.
TypeName() string

// Validate validates the type.
Validate(TypeSet) error

// isType is a private method that ensures that only types in this package can be marked as types.
isType()
}

// ReferenceableType is a marker interface that all types that can be the target of Field.ReferencedType implement.
// Currently, this is only EnumType.
type ReferenceableType interface {
Type

// isReferenceableType is implemented if this is a reference type.
isReferenceableType()
}

// TypeSet represents something that has types and allows them to be looked up by name.
// Currently, the only implementation is ModuleSchema.
type TypeSet interface {
// LookupType looks up a type by name.
LookupType(name string) (t Type, found bool)

// LookupEnumType is a convenience method that looks up an EnumType by name.
LookupEnumType(name string) (t EnumType, found bool)

Check failure on line 32 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: EnumType

Check failure on line 32 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: EnumType

// LookupStateObjectType is a convenience method that looks up an StateObjectType by name.
LookupStateObjectType(name string) (t StateObjectType, found bool)

Check failure on line 35 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: StateObjectType

Check failure on line 35 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: StateObjectType

// AllTypes calls the given function for each type in the type set.
// This function is compatible with go 1.23 iterators and can be used like this:
// for t := range types.AllTypes {
// // do something with t
// }
AllTypes(f func(Type) bool)

// EnumTypes calls the given function for each EnumType in the type set.
// This function is compatible with go 1.23 iterators.
EnumTypes(f func(EnumType) bool)

Check failure on line 46 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: EnumType

Check failure on line 46 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: EnumType

// StateObjectTypes calls the given function for each StateObjectType in the type set.
// This function is compatible with go 1.23 iterators.
StateObjectTypes(f func(objectType StateObjectType) bool)

Check failure on line 50 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: StateObjectType

Check failure on line 50 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: StateObjectType

// isTypeSet is a private method that ensures that only types in this package can be marked as type sets.
isTypeSet()
}

// EmptyTypeSet is a schema that contains no types.
// It can be used in Validate methods when there is no schema needed or available.
func EmptyTypeSet() TypeSet {
return emptyTypeSetInst
}

var emptyTypeSetInst = emptyTypeSet{}

type emptyTypeSet struct{}

func (emptyTypeSet) LookupType(string) (Type, bool) {
return nil, false
}

func (s emptyTypeSet) LookupEnumType(string) (t EnumType, found bool) {

Check failure on line 70 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: EnumType

Check failure on line 70 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: EnumType
return EnumType{}, false

Check failure on line 71 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: EnumType

Check failure on line 71 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: EnumType
}

func (s emptyTypeSet) LookupStateObjectType(string) (t StateObjectType, found bool) {

Check failure on line 74 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: StateObjectType

Check failure on line 74 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: StateObjectType
return StateObjectType{}, false

Check failure on line 75 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: StateObjectType

Check failure on line 75 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: StateObjectType
}

func (emptyTypeSet) AllTypes(func(Type) bool) {}

func (s emptyTypeSet) EnumTypes(func(EnumType) bool) {}

Check failure on line 80 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: EnumType

Check failure on line 80 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: EnumType

func (s emptyTypeSet) StateObjectTypes(func(objectType StateObjectType) bool) {}

Check failure on line 82 in schema/type.go

View workflow job for this annotation

GitHub Actions / dependency-review

undefined: StateObjectType

Check failure on line 82 in schema/type.go

View workflow job for this annotation

GitHub Actions / golangci-lint

undefined: StateObjectType

func (emptyTypeSet) isTypeSet() {}

0 comments on commit ca5c822

Please sign in to comment.