refactor: Move TxDecoder into its own middleware (#10612)
* WIP: middleware refactor * refactor `tx.Request` * Add MsgResponses any in sdk.Result * add helper functions in abci * refactor tips * review changes * Fix mock tests * Update baseapp/abci.go * Update baseapp/abci.go * Update types/tx/middleware.go * Update types/tx/middleware.go * tx.Response to abci conversion * refactor makeABCIData * Add comments * Fix build * fix build error * fix tests * fix test * fix tests * Fix TestSimulateTx * fix tests * fix test * Fix build * Simplify code * fix test build * Use repeated bytes in txMsgData * Fix grpc-gateway test * Make proto-gen * Automagically register MsgResponse * review changes * Use froydi's trick * Use Any in TxMsgData * Finally remove API breaking change * Revert unnecessary stuff * refactor: Move TxDecoder into its own middleware * Add test for txDecoderMiddleware * Fix some baseapp tests * Fix some more tests * Fix mock tests * Fix middleware tests * Add cl * Fix tests * Update types/tx/middleware.go Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com> Co-authored-by: atheesh <atheesh@vitwit.com> Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
This commit is contained in:
co-authored by
atheeshp
atheesh
parent
9566c99185
commit
b3e922d08b
+13
-6
@@ -22,6 +22,19 @@ type ResponseSimulateTx struct {
|
||||
Result *sdk.Result
|
||||
}
|
||||
|
||||
// Request is the tx request type used in middlewares.
|
||||
// At least one of Tx or TxBytes must be set. If only TxBytes is set, then
|
||||
// Tx will be populated by the TxDecoderMiddleware. If only Tx is set, then
|
||||
// some middlewares (such as signature verification) will fail.
|
||||
//
|
||||
// In practice, the middleware stack is called from {Check,Deliver}Tx, which
|
||||
// only passes the TxBytes. Then, the TxDecoderMiddleware decodes the bytes
|
||||
// into the Tx field.
|
||||
type Request struct {
|
||||
Tx sdk.Tx
|
||||
TxBytes []byte
|
||||
}
|
||||
|
||||
// Response is the tx response type used in middlewares.
|
||||
type Response struct {
|
||||
GasWanted uint64
|
||||
@@ -34,12 +47,6 @@ type Response struct {
|
||||
Events []abci.Event
|
||||
}
|
||||
|
||||
// Request is the tx request type used in middlewares.
|
||||
type Request struct {
|
||||
Tx sdk.Tx
|
||||
TxBytes []byte
|
||||
}
|
||||
|
||||
// RequestCheckTx is the additional request type used in middlewares CheckTx
|
||||
// method.
|
||||
type RequestCheckTx struct {
|
||||
|
||||
Reference in New Issue
Block a user