mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
chore: use revert error code for execution reverted
This commit is contained in:
parent
624a5d8b23
commit
87fdcf31eb
2 changed files with 3 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ type revertError struct {
|
|||
// ErrorCode returns the JSON error code for a revert.
|
||||
// See: https://github.com/ethereum/wiki/wiki/JSON-RPC-Error-Codes-Improvement-Proposal
|
||||
func (e *revertError) ErrorCode() int {
|
||||
return 3
|
||||
return errCodeReverted
|
||||
}
|
||||
|
||||
// ErrorData returns the hex encoded revert reason.
|
||||
|
|
@ -106,7 +106,7 @@ const (
|
|||
errCodeClientLimitExceeded = -38026
|
||||
errCodeInternalError = -32603
|
||||
errCodeInvalidParams = -32602
|
||||
errCodeReverted = -32000
|
||||
errCodeReverted = 3
|
||||
errCodeVMError = -32015
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
|||
if errors.Is(result.Err, vm.ErrExecutionReverted) {
|
||||
// If the result contains a revert reason, try to unpack it.
|
||||
revertErr := newRevertError(result.Revert())
|
||||
callRes.Error = &callError{Message: revertErr.Error(), Code: errCodeReverted, Data: revertErr.ErrorData().(string)}
|
||||
callRes.Error = &callError{Message: revertErr.Error(), Code: revertErr.ErrorCode(), Data: revertErr.ErrorData().(string)}
|
||||
} else {
|
||||
callRes.Error = &callError{Message: result.Err.Error(), Code: errCodeVMError}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue