fix(server/v2/cometbft): add tx result for failed tx (#21200)

This commit is contained in:
Julien Robert 2024-08-07 15:07:28 +02:00 committed by GitHub
parent 72e77c3580
commit 90fd6320a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 16 deletions

View File

@ -325,13 +325,6 @@ func (s *CometBFTServer[T]) QueryBlockResultsCmd() *cobra.Command {
Long: "Query for a specific committed block's results using the CometBFT RPC `block_results` method",
Args: cobra.RangeArgs(0, 1),
RunE: func(cmd *cobra.Command, args []string) error {
// clientCtx, err := client.GetClientQueryContext(cmd)
// if err != nil {
// return err
// }
// TODO: we should be able to do this without using client context
node, err := s.rpcClient(cmd)
if err != nil {
return err

View File

@ -102,18 +102,24 @@ func intoABCIValidatorUpdates(updates []appmodulev2.ValidatorUpdate) []abci.Vali
func intoABCITxResults(results []appmanager.TxResult, indexSet map[string]struct{}) []*abci.ExecTxResult {
res := make([]*abci.ExecTxResult, len(results))
for i := range results {
if results[i].Error == nil {
res[i] = responseExecTxResultWithEvents(
results[i].Error,
results[i].GasWanted,
results[i].GasUsed,
intoABCIEvents(results[i].Events, indexSet),
false,
)
if results[i].Error != nil {
space, code, log := errorsmod.ABCIInfo(results[i].Error, true)
res[i] = &abci.ExecTxResult{
Codespace: space,
Code: code,
Log: log,
}
continue
}
// TODO: handle properly once the we decide on the type of TxResult.Resp
res[i] = responseExecTxResultWithEvents(
results[i].Error,
results[i].GasWanted,
results[i].GasUsed,
intoABCIEvents(results[i].Events, indexSet),
false,
)
}
return res