Skip to content

Commit

Permalink
fix: err msg for eth_callMany (#12029)
Browse files Browse the repository at this point in the history
if revert happend in eth_callMany, the error will be included in the
normal result rather than error result, and the revert info will be
ignored when response marshaling.

current response: 
`{
   ......
    "error": {}
   ......
}`

expected response:
`{
   ......
    "error": {
        "message": "execution reverted: ......",
        "data": "0x......"
    }
   ......
}`
  • Loading branch information
rekyyang authored Oct 16, 2024
1 parent 189c7aa commit a2acb61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion turbo/jsonrpc/eth_callMany.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ func (api *APIImpl) CallMany(ctx context.Context, bundles []Bundle, simulateCont
jsonResult := make(map[string]interface{})
if result.Err != nil {
if len(result.Revert()) > 0 {
jsonResult["error"] = ethapi.NewRevertError(result)
revertErr := ethapi.NewRevertError(result)
jsonResult["error"] = map[string]interface{}{
"message": revertErr.Error(),
"data": revertErr.ErrorData(),
}
} else {
jsonResult["error"] = result.Err.Error()
}
Expand Down

0 comments on commit a2acb61

Please sign in to comment.