Bumps [github.com/cosmos/gogoproto](https://github.com/cosmos/gogoproto) from 1.4.1 to 1.4.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/cosmos/gogoproto/releases">github.com/cosmos/gogoproto's releases</a>.</em></p> <blockquote> <h2>v1.4.2</h2> <h3>Features</h3> <ul> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/13">#13</a> Add <code>AllFileDescriptors</code> function.</li> </ul> <h3>Improvements</h3> <ul> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/8">#8</a> Fix typo in <code>doc.go</code>.</li> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/8">#8</a> Support for merging messages implementing Merger which are embedded by value.</li> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/8">#8</a> Use reflect.Value.String() for String kinds in proto equal.</li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/cosmos/gogoproto/blob/main/CHANGELOG.md">github.com/cosmos/gogoproto's changelog</a>.</em></p> <blockquote> <h2><a href="https://github.com/cosmos/gogoproto/releases/tag/v1.4.2">v1.4.2</a> - 2022-09-14</h2> <h3>Features</h3> <ul> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/13">#13</a> Add <code>AllFileDescriptors</code> function.</li> </ul> <h3>Improvements</h3> <ul> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/8">#8</a> Fix typo in <code>doc.go</code>.</li> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/8">#8</a> Support for merging messages implementing Merger which are embedded by value.</li> <li><a href="https://github-redirect.dependabot.com/cosmos/gogoproto/pull/8">#8</a> Use reflect.Value.String() for String kinds in proto equal.</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/cosmos/gogoproto/commit/739310d858571659171cdd7b2ca8bea7076c7ff2"><code>739310d</code></a> docs: add changelog (<a href="https://github-redirect.dependabot.com/cosmos/gogoproto/issues/15">#15</a>)</li> <li><a href="https://github.com/cosmos/gogoproto/commit/4f8afe8bcdc6a15f9890f6bb14b76d5b5b295cb5"><code>4f8afe8</code></a> feat: add AllFileDescriptors function (<a href="https://github-redirect.dependabot.com/cosmos/gogoproto/issues/13">#13</a>)</li> <li><a href="https://github.com/cosmos/gogoproto/commit/27e576980886b16935ef005e856772fd51b3e7e3"><code>27e5769</code></a> ci: fix proto registry workflow (<a href="https://github-redirect.dependabot.com/cosmos/gogoproto/issues/12">#12</a>)</li> <li><a href="https://github.com/cosmos/gogoproto/commit/c3a0399b5ef29be2bed06aa30827a024566fd652"><code>c3a0399</code></a> feat: cherry-pick improvements from <code>gogo/protobuf</code> (<a href="https://github-redirect.dependabot.com/cosmos/gogoproto/issues/8">#8</a>)</li> <li><a href="https://github.com/cosmos/gogoproto/commit/ed9594ccc9df20896422046173e63cd25fb3ccd3"><code>ed9594c</code></a> chore: bump protobuf (<a href="https://github-redirect.dependabot.com/cosmos/gogoproto/issues/9">#9</a>)</li> <li>See full diff in <a href="https://github.com/cosmos/gogoproto/compare/v1.4.1...v1.4.2">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
Server
The server package is responsible for providing the mechanisms necessary to
start an ABCI Tendermint application and provides the CLI framework (based on cobra)
necessary to fully bootstrap an application. The package exposes two core functions: StartCmd
and ExportCmd which creates commands to start the application and export state respectively.
Preliminary
The root command of an application typically is constructed with:
- command to start an application binary
- three meta commands:
query,tx, and a few auxiliary commands such asgenesis. utilities.
It is vital that the root command of an application uses PersistentPreRun() cobra command
property for executing the command, so all child commands have access to the server and client contexts.
These contexts are set as their default values initially and maybe modified,
scoped to the command, in their respective PersistentPreRun() functions. Note that
the client.Context is typically pre-populated with "default" values that may be
useful for all commands to inherit and override if necessary.
Example:
var (
initClientCtx = client.Context{...}
rootCmd = &cobra.Command{
Use: "simd",
Short: "simulation app",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
return err
}
return server.InterceptConfigsPreRunHandler(cmd)
},
}
// add root sub-commands ...
)
The SetCmdClientContextHandler call reads persistent flags via ReadPersistentCommandFlags
which creates a client.Context and sets that on the root command's Context.
The InterceptConfigsPreRunHandler call creates a viper literal, default server.Context,
and a logger and sets that on the root command's Context. The server.Context
will be modified and saved to disk via the internal interceptConfigs call, which
either reads or creates a Tendermint configuration based on the home path provided.
In addition, interceptConfigs also reads and loads the application configuration,
app.toml, and binds that to the server.Context viper literal. This is vital
so the application can get access to not only the CLI flags, but also to the
application configuration values provided by this file.
StartCmd
The StartCmd accepts an AppCreator function which returns an Application.
The AppCreator is responsible for constructing the application based on the
options provided to it via AppOptions. The AppOptions interface type defines
a single method, Get() interface{}, and is implemented as a viper
literal that exists in the server.Context. All the possible options an application
may use and provide to the construction process are defined by the StartCmd
and by the application's config file, app.toml.
The application can either be started in-process or as an external process. The former creates a Tendermint service and the latter creates a Tendermint Node.
Under the hood, StartCmd will call GetServerContextFromCmd, which provides
the command access to a server.Context. This context provides access to the
viper literal, the Tendermint config and logger. This allows flags to be bound
the viper literal and passed to the application construction.
Example:
func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts server.AppOptions) server.Application {
var cache sdk.MultiStorePersistentCache
if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) {
cache = store.NewCommitKVStoreCacheManager()
}
pruningOpts, err := server.GetPruningOptionsFromFlags(appOpts)
if err != nil {
panic(err)
}
return simapp.NewSimApp(
logger, db, traceStore, true,
baseapp.SetPruning(pruningOpts),
baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))),
baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))),
baseapp.SetHaltTime(cast.ToUint64(appOpts.Get(server.FlagHaltTime))),
baseapp.SetInterBlockCache(cache),
baseapp.SetTrace(cast.ToBool(appOpts.Get(server.FlagTrace))),
)
}
Note, some of the options provided are exposed via CLI flags in the start command
and some are also allowed to be set in the application's app.toml. It is recommend
to use the cast package for type safety guarantees and due to the limitations of
CLI flag types.