Skip to content

Commit

Permalink
logs: print proposal if error
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersuweijie committed Mar 21, 2024
1 parent 1e7f3bf commit 24f2e72
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions baseapp/abci_utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package baseapp

import (
"encoding/json"
"fmt"

"github.com/cockroachdb/errors"
Expand Down Expand Up @@ -199,10 +200,13 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan
maxBlockGas = b.MaxGas
}

for _, txBytes := range req.Txs {
for i, txBytes := range req.Txs {
tx, err := h.txVerifier.ProcessProposalVerifyTx(txBytes)
if err != nil {
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err)
proposal, err := json.Marshal(req)
if err == nil {
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err, "proposal", string(proposal), "tx_index", i)
}
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
}

Expand All @@ -213,6 +217,10 @@ func (h *DefaultProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHan
}

if totalTxGas > uint64(maxBlockGas) {
proposal, err := json.Marshal(req)
if err == nil {
ctx.Logger().Error("proposal failed on ProcessProposalVerifyTx", "error", err, "proposal", string(proposal), "tx_index", i)
}
ctx.Logger().Error("proposal failed on totalTxGas > maxBlockGas", "totalTxGas", totalTxGas, "maxBlockGas", maxBlockGas)
return abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}
}
Expand Down

0 comments on commit 24f2e72

Please sign in to comment.