Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

refactor(blockchain): Minor cleanup and add safety checks. #1266

Merged
merged 16 commits into from
Nov 1, 2023
Prev Previous commit
Next Next commit
add preblock
  • Loading branch information
itsdevbear committed Nov 1, 2023
commit f981084a5dbe5dff97fdfa81d2b231540ec78a3f
9 changes: 8 additions & 1 deletion cosmos/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ type EnvelopeSerializer interface {
}

type App interface {
BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error)
BeginBlocker(sdk.Context) (sdk.BeginBlock, error)
PreBlocker(sdk.Context, *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error)
}

// EVMKeeper is an interface that defines the methods needed for the EVM setup.
Expand Down Expand Up @@ -94,6 +95,12 @@ func (m *Miner) PrepareProposal(
return nil, err
}

// We have to run the PreBlocker to get the chain into the state it'll
// be in when the EVM transaction actually runs.
if _, err = m.app.PreBlocker(ctx, nil); 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 {
Expand Down
Loading