Skip to content

Commit d459ccc

Browse files
committed
go/consensus/cometbft/abci: Validate system txs after results are set
1 parent 21a9a4f commit d459ccc

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

go/consensus/cometbft/abci/mux.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,11 @@ func (mux *abciMux) ProcessProposal(req types.RequestProcessProposal) (resp type
515515
}
516516
}
517517

518+
// Validate system transactions included by the proposer.
519+
if err := mux.validateSystemTxs(); err != nil {
520+
panic(fmt.Errorf("proposed block has invalid system transactions: %w", err))
521+
}
522+
518523
return types.ResponseProcessProposal{
519524
Status: types.ResponseProcessProposal_ACCEPT,
520525
}
@@ -808,11 +813,6 @@ func (mux *abciMux) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
808813
},
809814
}
810815

811-
// Validate system transactions included by the proposer.
812-
if err := mux.validateSystemTxs(); err != nil {
813-
panic(fmt.Errorf("proposed block has invalid system transactions: %w", err))
814-
}
815-
816816
return resp
817817
}
818818

go/consensus/cometbft/abci/system.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,8 @@ func (mux *abciMux) processSystemTx(ctx *api.Context, tx *transaction.Transactio
9090
return nil
9191
}
9292

93-
// validateSystemTxs performs system transaction validation at the end of a block.
93+
// validateSystemTxs performs system transaction validation.
9494
func (mux *abciMux) validateSystemTxs() error {
95-
// Don't perform any validation when we are still building the proposal.
96-
if len(mux.state.proposal.hash) == 0 {
97-
return nil
98-
}
99-
10095
var hasBlockMetadata bool
10196
for _, tx := range mux.state.blockCtx.SystemTransactions {
10297
switch tx.Method {

0 commit comments

Comments
 (0)