Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Create ABCI++ Verfication Methods #15298

Merged
merged 21 commits into from
Mar 8, 2023
Prev Previous commit
Next Next commit
updates
  • Loading branch information
alexanderbez committed Mar 8, 2023
commit fe1f64b85ec8285ff32c658cc362627814967f09
15 changes: 4 additions & 11 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ const (
runTxProcessProposal // Process a TM block proposal
)

var (
// ErrTxDecode is returned when decoding a transaction fails.
ErrTxDecode = errors.New("failed to decode transaction")
// ErrTxEncode is returned when encoding a transaction fails.
ErrTxEncode = errors.New("failed to encode transaction")
)

var _ abci.Application = (*BaseApp)(nil)

// BaseApp reflects the ABCI application implementation.
Expand Down Expand Up @@ -872,7 +865,7 @@ func createEvents(events sdk.Events, msg sdk.Msg) sdk.Events {
func (app *BaseApp) PrepareProposalVerifyTx(tx sdk.Tx) ([]byte, error) {
bz, err := app.txEncoder(tx)
if err != nil {
return nil, errors.WithSecondaryError(ErrTxEncode, err)
return nil, err
}

_, _, _, _, err = app.runTx(runTxPrepareProposal, bz)
Expand All @@ -887,7 +880,7 @@ func (app *BaseApp) PrepareProposalVerifyTx(tx sdk.Tx) ([]byte, error) {
func (app *BaseApp) ProcessProposalVerifyTx(txBz []byte) (sdk.Tx, error) {
tx, err := app.txDecoder(txBz)
if err != nil {
return nil, errors.WithSecondaryError(ErrTxDecode, err)
return nil, err
}

_, _, _, _, err = app.runTx(runTxProcessProposal, txBz)
Expand Down Expand Up @@ -959,10 +952,10 @@ func (h DefaultProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHand
bz, err := h.txVerifier.PrepareProposalVerifyTx(memTx)
txSize := int64(len(bz))
switch {
case bz == nil && errors.Is(err, ErrTxEncode):
case len(bz) == 0 && err != nil:
panic(err)
alexanderbez marked this conversation as resolved.
Show resolved Hide resolved

case bz != nil && err != nil:
case len(bz) > 0 && err != nil:
err := h.mempool.Remove(memTx)
if err != nil && !errors.Is(err, mempool.ErrTxNotFound) {
panic(err)
Expand Down