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

TxDecoder as Middleware #10610

Closed
4 tasks
amaury1093 opened this issue Nov 25, 2021 · 0 comments · Fixed by #10612
Closed
4 tasks

TxDecoder as Middleware #10610

amaury1093 opened this issue Nov 25, 2021 · 0 comments · Fixed by #10612
Assignees
Labels
C:baseapp Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.

Comments

@amaury1093
Copy link
Contributor

amaury1093 commented Nov 25, 2021

Summary

Refactor tx decoding logic as a TxDecoderMiddleware. ref: #10484 (comment)

Problem Definition

With the BaseApp middleware refactor (#9996), BaseApp should be as slim as possible.

Currently, BaseApp still does tx decoding (see its private txDecoder field). We can move this logic into a middleware

Proposal

Create a TxDecoderMiddleware. It will:

  • Look if both the tx.Request.Tx and tx.Request.TxBytes are set. If both are empty, error. If Txx is empty, then decode from TxBytes.
    • In practice, txs coming from ABCI Check/DeliverTx will have TxBytes set, so the middleware will decode.

Pros:

  • Baseapp only handles tx bytes, is agnostic what the bytes mean
  • Modular

Cons:

  • TxDecoderMiddleware needs to be in the middleware chain (and quite high), it's not an optional middleware

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@amaury1093 amaury1093 added C:baseapp Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. labels Nov 25, 2021
@amaury1093 amaury1093 self-assigned this Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:baseapp Type: Code Hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant