Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
This commit is contained in:
co-authored by
Facundo Medica
parent
4762a2fa7d
commit
8295e4a3e0
@@ -167,7 +167,7 @@ func Example_oneModule() {
|
||||
Params: params,
|
||||
},
|
||||
// this allows to the begin and end blocker of the module before and after the message
|
||||
integration.WithAutomaticProcessProposal(),
|
||||
integration.WithAutomaticFinalizeBlock(),
|
||||
// this allows to commit the state after the message
|
||||
integration.WithAutomaticCommit(),
|
||||
)
|
||||
|
||||
@@ -2,21 +2,13 @@ package integration
|
||||
|
||||
// Config is the configuration for the integration app.
|
||||
type Config struct {
|
||||
AutomaticProcessProposal bool
|
||||
AutomaticFinalizeBlock bool
|
||||
AutomaticCommit bool
|
||||
AutomaticFinalizeBlock bool
|
||||
AutomaticCommit bool
|
||||
}
|
||||
|
||||
// Option is a function that can be used to configure the integration app.
|
||||
type Option func(*Config)
|
||||
|
||||
// WithAutomaticProcessProposal calls ABCI process proposal.
|
||||
func WithAutomaticProcessProposal() Option {
|
||||
return func(cfg *Config) {
|
||||
cfg.AutomaticProcessProposal = true
|
||||
}
|
||||
}
|
||||
|
||||
// WithAutomaticFinalizeBlock calls ABCI finalize block.
|
||||
func WithAutomaticFinalizeBlock() Option {
|
||||
return func(cfg *Config) {
|
||||
|
||||
@@ -132,13 +132,6 @@ func (app *App) RunMsg(msg sdk.Msg, option ...Option) (*codectypes.Any, error) {
|
||||
defer app.Commit()
|
||||
}
|
||||
|
||||
if cfg.AutomaticProcessProposal {
|
||||
height := app.LastBlockHeight() + 1
|
||||
if _, err := app.ProcessProposal(&cmtabcitypes.RequestProcessProposal{Height: height}); err != nil {
|
||||
return nil, fmt.Errorf("failed to run process proposal: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.AutomaticFinalizeBlock {
|
||||
height := app.LastBlockHeight() + 1
|
||||
if _, err := app.FinalizeBlock(&cmtabcitypes.RequestFinalizeBlock{Height: height}); err != nil {
|
||||
|
||||
@@ -140,8 +140,7 @@ func SignCheckDeliver(
|
||||
require.False(t, finalizeSuccess)
|
||||
}
|
||||
|
||||
_, err = app.Commit()
|
||||
require.NoError(t, err)
|
||||
app.Commit()
|
||||
|
||||
gInfo := sdk.GasInfo{GasWanted: uint64(txResult.GasWanted), GasUsed: uint64(txResult.GasUsed)}
|
||||
txRes := sdk.Result{Data: txResult.Data, Log: txResult.Log, Events: txResult.Events}
|
||||
|
||||
Reference in New Issue
Block a user