Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/consensus/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,5 @@ func (m *Metrics) MarkStep(s cstypes.RoundStepType) {
}

func (m *Metrics) MarkProposalTxNumber(txs int) {
m.ProposalTxs.With("proposal_tx_number").Add(float64(txs))
m.ProposalTxs.Add(float64(txs))
}
18 changes: 15 additions & 3 deletions internal/consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1722,21 +1722,33 @@ func (cs *State) defaultDoPrevote(ctx context.Context, height int64, round int32
liveness properties. Please see PrepareProposal-ProcessProposal coherence and determinism
properties in the ABCI++ specification.
*/
isAppValid, err := cs.blockExec.ProcessProposal(ctx, cs.roundState.ProposalBlock(), cs.state)
isAppValid, resp, err := cs.blockExec.ProcessProposal(ctx, cs.roundState.ProposalBlock(), cs.state)
if err != nil {
panic(fmt.Sprintf("ProcessProposal: %v", err))
}

var gasWanted int64
for _, tx := range resp.TxResults {
gasWanted += tx.GasWanted
}

cs.metrics.MarkProposalProcessed(isAppValid)

numberOfTxs := cs.roundState.ProposalBlock().Txs.Len()
cs.metrics.MarkProposalTxNumber(numberOfTxs)
//cs.metrics.MarkProposalTxNumber(numberOfTxs)

logger.Info("proposal info",
"proposerAddress", cs.roundState.ProposalBlock().ProposerAddress,
"numberOfTxs", numberOfTxs,
"gasWanted", gasWanted)

// Vote nil if the Application rejected the block
if !isAppValid {
logger.Error("prevote step: state machine rejected a proposed block; this should not happen:"+
"the proposer may be misbehaving; prevoting nil", "err", err,
"proposerAddress", cs.roundState.ProposalBlock().ProposerAddress,
"numberOfTxs", numberOfTxs)
"numberOfTxs", numberOfTxs,
"gasWanted", gasWanted)

cs.signAddVote(ctx, tmproto.PrevoteType, nil, types.PartSetHeader{})
return
Expand Down
6 changes: 3 additions & 3 deletions internal/state/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (blockExec *BlockExecutor) ProcessProposal(
ctx context.Context,
block *types.Block,
state State,
) (bool, error) {
) (bool, *abci.ResponseProcessProposal, error) {
txs := block.Data.Txs.ToSliceOfBytes()
resp, err := blockExec.appClient.ProcessProposal(ctx, &abci.RequestProcessProposal{
Hash: block.Header.Hash(),
Expand All @@ -184,13 +184,13 @@ func (blockExec *BlockExecutor) ProcessProposal(
LastResultsHash: block.LastResultsHash,
})
if err != nil {
return false, ErrInvalidBlock(err)
return false, resp, ErrInvalidBlock(err)
}
if resp.IsStatusUnknown() {
panic(fmt.Sprintf("ProcessProposal responded with status %s", resp.Status.String()))
}

return resp.IsAccepted(), nil
return resp.IsAccepted(), resp, nil
}

// ValidateBlock validates the given block against the given state.
Expand Down
2 changes: 1 addition & 1 deletion internal/state/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func TestProcessProposal(t *testing.T) {
}

app.On("ProcessProposal", mock.Anything, mock.Anything).Return(&abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}, nil)
acceptBlock, err := blockExec.ProcessProposal(ctx, block1, state)
acceptBlock, _, err := blockExec.ProcessProposal(ctx, block1, state)
require.NoError(t, err)
require.True(t, acceptBlock)
app.AssertExpectations(t)
Expand Down