@@ -17,7 +17,7 @@ import (
17
17
"cosmossdk.io/core/server"
18
18
"cosmossdk.io/core/store"
19
19
"cosmossdk.io/core/transaction"
20
- errorsmod "cosmossdk.io/errors"
20
+ errorsmod "cosmossdk.io/errors/v2 "
21
21
"cosmossdk.io/log"
22
22
"cosmossdk.io/server/v2/appmanager"
23
23
"cosmossdk.io/server/v2/cometbft/client/grpc/cmtservice"
@@ -122,7 +122,8 @@ func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxReques
122
122
}
123
123
124
124
resp , err := c .app .ValidateTx (ctx , decodedTx )
125
- if err != nil {
125
+ // we do not want to return a cometbft error, but a check tx response with the error
126
+ if err != nil && err != resp .Error {
126
127
return nil , err
127
128
}
128
129
@@ -132,15 +133,18 @@ func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxReques
132
133
}
133
134
134
135
cometResp := & abciproto.CheckTxResponse {
135
- Code : resp . Code ,
136
+ Code : 0 ,
136
137
GasWanted : uint64ToInt64 (resp .GasWanted ),
137
138
GasUsed : uint64ToInt64 (resp .GasUsed ),
138
139
Events : events ,
139
140
}
140
141
if resp .Error != nil {
141
- cometResp .Code = 1
142
- cometResp .Log = resp .Error .Error ()
142
+ space , code , log := errorsmod .ABCIInfo (resp .Error , c .cfg .AppTomlConfig .Trace )
143
+ cometResp .Code = code
144
+ cometResp .Codespace = space
145
+ cometResp .Log = log
143
146
}
147
+
144
148
return cometResp , nil
145
149
}
146
150
@@ -196,7 +200,7 @@ func (c *Consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) (
196
200
}
197
201
res , err := c .app .Query (ctx , uint64 (req .Height ), protoRequest )
198
202
if err != nil {
199
- resp := queryResult (err )
203
+ resp := QueryResult (err , c . cfg . AppTomlConfig . Trace )
200
204
resp .Height = req .Height
201
205
return resp , err
202
206
@@ -283,10 +287,10 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe
283
287
return nil , fmt .Errorf ("genesis state init failure: %w" , err )
284
288
}
285
289
286
- // TODO necessary? where should this WARN live if it all. helpful for testing
287
290
for _ , txRes := range blockresponse .TxResults {
288
- if txRes .Error != nil {
289
- c .logger .Warn ("genesis tx failed" , "code" , txRes .Code , "error" , txRes .Error )
291
+ if err := txRes .Error ; err != nil {
292
+ space , code , log := errorsmod .ABCIInfo (err , c .cfg .AppTomlConfig .Trace )
293
+ c .logger .Warn ("genesis tx failed" , "codespace" , space , "code" , code , "log" , log )
290
294
}
291
295
}
292
296
@@ -485,7 +489,7 @@ func (c *Consensus[T]) FinalizeBlock(
485
489
return nil , err
486
490
}
487
491
488
- return finalizeBlockResponse (resp , cp , appHash , c .indexedEvents )
492
+ return finalizeBlockResponse (resp , cp , appHash , c .indexedEvents , c . cfg . AppTomlConfig . Trace )
489
493
}
490
494
491
495
// Commit implements types.Application.
0 commit comments