mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
add data on reverts
This commit is contained in:
parent
a9842e500c
commit
a6f80c750d
1 changed files with 3 additions and 5 deletions
|
|
@ -212,16 +212,14 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
gasUsed += result.UsedGas
|
gasUsed += result.UsedGas
|
||||||
receipts[i] = core.MakeReceipt(evm, result, sim.state, blockContext.BlockNumber, common.Hash{}, tx, gasUsed, root)
|
receipts[i] = core.MakeReceipt(evm, result, sim.state, blockContext.BlockNumber, common.Hash{}, tx, gasUsed, root)
|
||||||
blobGasUsed += receipts[i].BlobGasUsed
|
blobGasUsed += receipts[i].BlobGasUsed
|
||||||
// If the result contains a revert reason, try to unpack it.
|
|
||||||
if len(result.Revert()) > 0 {
|
|
||||||
result.Err = newRevertError(result.Revert())
|
|
||||||
}
|
|
||||||
logs := tracer.Logs()
|
logs := tracer.Logs()
|
||||||
callRes := simCallResult{ReturnValue: result.Return(), Logs: logs, GasUsed: hexutil.Uint64(result.UsedGas)}
|
callRes := simCallResult{ReturnValue: result.Return(), Logs: logs, GasUsed: hexutil.Uint64(result.UsedGas)}
|
||||||
if result.Failed() {
|
if result.Failed() {
|
||||||
callRes.Status = hexutil.Uint64(types.ReceiptStatusFailed)
|
callRes.Status = hexutil.Uint64(types.ReceiptStatusFailed)
|
||||||
if errors.Is(result.Err, vm.ErrExecutionReverted) {
|
if errors.Is(result.Err, vm.ErrExecutionReverted) {
|
||||||
callRes.Error = &callError{Message: result.Err.Error(), Code: errCodeReverted}
|
// 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)}
|
||||||
} 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