mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-07 15:38:37 +00:00
internal/ethapi: fix error code for revert in eth_simulateV1 (#33007)
The error code for revert should be consistent with eth_call and be 3.
This commit is contained in:
parent
7b7be249cb
commit
14c2408957
2 changed files with 1 additions and 2 deletions
|
|
@ -112,7 +112,6 @@ const (
|
||||||
errCodeClientLimitExceeded = -38026
|
errCodeClientLimitExceeded = -38026
|
||||||
errCodeInternalError = -32603
|
errCodeInternalError = -32603
|
||||||
errCodeInvalidParams = -32602
|
errCodeInvalidParams = -32602
|
||||||
errCodeReverted = -32000
|
|
||||||
errCodeVMError = -32015
|
errCodeVMError = -32015
|
||||||
errCodeTxSyncTimeout = 4
|
errCodeTxSyncTimeout = 4
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
if errors.Is(result.Err, vm.ErrExecutionReverted) {
|
if errors.Is(result.Err, vm.ErrExecutionReverted) {
|
||||||
// If the result contains a revert reason, try to unpack it.
|
// If the result contains a revert reason, try to unpack it.
|
||||||
revertErr := newRevertError(result.Revert())
|
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 {
|
} else {
|
||||||
callRes.Error = &callError{Message: result.Err.Error(), Code: errCodeVMError}
|
callRes.Error = &callError{Message: result.Err.Error(), Code: errCodeVMError}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue