Skip to content

Commit

Permalink
feat: Create ABCI++ Verfication Methods (cosmos#15298)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Mar 8, 2023
1 parent fc9ead9 commit b797121
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 26 deletions.
32 changes: 21 additions & 11 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,21 +225,31 @@ func NewSimApp(
interfaceRegistry := encodingConfig.InterfaceRegistry
txConfig := encodingConfig.TxConfig

// Below we could construct and set an application specific mempool and ABCI 1.0 Prepare and Process Proposal
// handlers. These defaults are already set in the SDK's BaseApp, this shows an example of how to override
// Below we could construct and set an application specific mempool and
// ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are
// already set in the SDK's BaseApp, this shows an example of how to override
// them.
//
// Example:
//
// bApp := baseapp.NewBaseApp(...)
// nonceMempool := mempool.NewSenderNonceMempool()
// mempoolOpt := baseapp.SetMempool(nonceMempool)
// prepareOpt := func(app *baseapp.BaseApp) {
// app.SetPrepareProposal(app.DefaultPrepareProposal())
// }
// processOpt := func(app *baseapp.BaseApp) {
// app.SetProcessProposal(app.DefaultProcessProposal())
// }
// abciPropHandler := NewDefaultProposalHandler(nonceMempool, bApp)
//
// bApp.SetMempool(nonceMempool)
// bApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler())
// bApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler())
//
// Further down we'd set the options in the AppBuilder like below.
// baseAppOptions = append(baseAppOptions, mempoolOpt, prepareOpt, processOpt)
// Alternatively, you can construct BaseApp options, append those to
// baseAppOptions and pass them to NewBaseApp.
//
// Example:
//
// prepareOpt = func(app *baseapp.BaseApp) {
// abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app)
// app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler())
// }
// baseAppOptions = append(baseAppOptions, prepareOpt)

bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
Expand Down
41 changes: 26 additions & 15 deletions app_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,6 @@ func NewSimApp(
var (
app = &SimApp{}
appBuilder *runtime.AppBuilder
// Below we could construct and set an application specific mempool and ABCI 1.0 Prepare and Process Proposal
// handlers. These defaults are already set in the SDK's BaseApp, this shows an example of how to override
// them.
//
// nonceMempool = mempool.NewSenderNonceMempool()
// mempoolOpt = baseapp.SetMempool(nonceMempool)
// prepareOpt = func(app *baseapp.BaseApp) {
// app.SetPrepareProposal(app.DefaultPrepareProposal())
// }
// processOpt = func(app *baseapp.BaseApp) {
// app.SetProcessProposal(app.DefaultProcessProposal())
// }
//
// Further down we'd set the options in the AppBuilder like below.
// baseAppOptions = append(baseAppOptions, mempoolOpt, prepareOpt, processOpt)

// merge the AppConfig and other configuration in one config
appConfig = depinject.Configs(
Expand Down Expand Up @@ -244,6 +229,32 @@ func NewSimApp(
panic(err)
}

// Below we could construct and set an application specific mempool and
// ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are
// already set in the SDK's BaseApp, this shows an example of how to override
// them.
//
// Example:
//
// app.App = appBuilder.Build(...)
// nonceMempool := mempool.NewSenderNonceMempool()
// abciPropHandler := NewDefaultProposalHandler(nonceMempool, app.App.BaseApp)
//
// app.App.BaseApp.SetMempool(nonceMempool)
// app.App.BaseApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler())
// app.App.BaseApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler())
//
// Alternatively, you can construct BaseApp options, append those to
// baseAppOptions and pass them to the appBuilder.
//
// Example:
//
// prepareOpt = func(app *baseapp.BaseApp) {
// abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app)
// app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler())
// }
// baseAppOptions = append(baseAppOptions, prepareOpt)

app.App = appBuilder.Build(logger, db, traceStore, baseAppOptions...)

if err := app.App.BaseApp.SetStreamingService(appOpts, app.appCodec, app.kvStoreKeys()); err != nil {
Expand Down

0 comments on commit b797121

Please sign in to comment.