From eaa987ec923aa804695f4e5b15fdc7a1de8d2505 Mon Sep 17 00:00:00 2001 From: Evan Forbes <42654277+evan-forbes@users.noreply.github.com> Date: Thu, 26 Jan 2023 13:07:04 +0100 Subject: [PATCH] feat!: add baseapp method to create a safe context for `ProcessProposal` (#296) * feat!: new baseapp method to return a branched version of the state that we can use to query in processproposal * fix!: use existing query context functionalit and re --- baseapp/baseapp.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index a094c1be6c34..70dadc8cc59a 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -568,6 +568,12 @@ func (app *BaseApp) getState(mode runTxMode) *state { return app.checkState } +// NewProcessProposalContext returns a context with a branched version of the +// DeliverTx state that is safe to query during ProcessProposal. +func (app *BaseApp) NewProcessProposalQueryContext() (sdk.Context, error) { + return app.createQueryContext(app.cms.LatestVersion(), false) +} + // retrieve the context for the tx w/ txBytes and other memoized values. func (app *BaseApp) getContextForTx(mode runTxMode, txBytes []byte) sdk.Context { ctx := app.getState(mode).ctx.