From 63229e6267fd0e0a2305a312a7331677875372f4 Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Wed, 1 Nov 2023 16:01:19 -0400 Subject: [PATCH] bing bong --- cosmos/miner/miner.go | 9 +++++++-- cosmos/runtime/runtime.go | 2 +- cosmos/x/evm/keeper/abci.go | 4 ++-- cosmos/x/evm/module.go | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cosmos/miner/miner.go b/cosmos/miner/miner.go index 9ed4bd31b..90f7e4237 100644 --- a/cosmos/miner/miner.go +++ b/cosmos/miner/miner.go @@ -54,7 +54,7 @@ type App interface { type EVMKeeper interface { // Setup initializes the EVM keeper. Setup(evmkeeper.Blockchain) error - PrepareCheckState(context.Context) error + SetLatestQueryContext(context.Context) error } // Miner implements the baseapp.TxSelector interface. @@ -89,18 +89,23 @@ func (m *Miner) PrepareProposal( err error ) - if err = m.keeper.PrepareCheckState(ctx); err != nil { + // We have to prime the state plugin. + if err = m.keeper.SetLatestQueryContext(ctx); err != nil { return nil, err } + // We have to run the BeginBlocker to get the chain into the state it'll // be in when the EVM transaction actually runs. if _, err = m.app.BeginBlocker(ctx); err != nil { return nil, err } + // Trigger the geth miner to build a block. if payloadEnvelopeBz, err = m.buildBlock(ctx); err != nil { return nil, err } + + // Return the payload as a transaction in the proposal. return &abci.ResponsePrepareProposal{Txs: [][]byte{payloadEnvelopeBz}}, err } diff --git a/cosmos/runtime/runtime.go b/cosmos/runtime/runtime.go index 6b30c8188..d37058df2 100644 --- a/cosmos/runtime/runtime.go +++ b/cosmos/runtime/runtime.go @@ -51,7 +51,7 @@ import ( type EVMKeeper interface { // Setup initializes the EVM keeper. Setup(evmkeeper.Blockchain) error - PrepareCheckState(context.Context) error + SetLatestQueryContext(context.Context) error } // CosmosApp is an interface that defines the methods needed for the Cosmos setup. diff --git a/cosmos/x/evm/keeper/abci.go b/cosmos/x/evm/keeper/abci.go index 888f27b47..c5fc838b3 100644 --- a/cosmos/x/evm/keeper/abci.go +++ b/cosmos/x/evm/keeper/abci.go @@ -49,8 +49,8 @@ func (k *Keeper) Precommit(ctx context.Context) error { return nil } -// PrepareCheckState runs on the Cosmos-SDK lifecycle PrepareCheckState(). -func (k *Keeper) PrepareCheckState(ctx context.Context) error { +// SetLatestQueryContext runs on the Cosmos-SDK lifecycle SetLatestQueryContext(). +func (k *Keeper) SetLatestQueryContext(ctx context.Context) error { k.sp.Prepare(ctx) return nil } diff --git a/cosmos/x/evm/module.go b/cosmos/x/evm/module.go index 5969ad3dd..07d2d653a 100644 --- a/cosmos/x/evm/module.go +++ b/cosmos/x/evm/module.go @@ -126,9 +126,9 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error { // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } -// PrepareCheckState prepares the application state for a check. +// SetLatestQueryContext prepares the application state for a check. func (am AppModule) PrepareCheckState(ctx context.Context) error { - return am.keeper.PrepareCheckState(ctx) + return am.keeper.SetLatestQueryContext(ctx) } // Precommit performs precommit operations.