remove unused eraseReturnData
This commit is contained in:
parent
52fffa6e25
commit
009aa35dfb
|
@ -23,8 +23,6 @@ type
|
||||||
|
|
||||||
VMError* = object of EVMError
|
VMError* = object of EVMError
|
||||||
## Class of errors which can be raised during VM execution.
|
## Class of errors which can be raised during VM execution.
|
||||||
erasesReturnData*: bool
|
|
||||||
burnsGas*: bool
|
|
||||||
|
|
||||||
OutOfGas* = object of VMError
|
OutOfGas* = object of VMError
|
||||||
## Error signaling that VM execution has run out of gas.
|
## Error signaling that VM execution has run out of gas.
|
||||||
|
@ -67,8 +65,3 @@ type
|
||||||
|
|
||||||
StaticContextError* = object of VMError
|
StaticContextError* = object of VMError
|
||||||
## State changes not allowed in static call context
|
## State changes not allowed in static call context
|
||||||
|
|
||||||
proc makeVMError*: ref VMError =
|
|
||||||
new(result)
|
|
||||||
result.burnsGas = true
|
|
||||||
result.erasesReturnData = true
|
|
||||||
|
|
|
@ -50,27 +50,16 @@ template isError*(c: Computation): bool =
|
||||||
func shouldBurnGas*(c: Computation): bool =
|
func shouldBurnGas*(c: Computation): bool =
|
||||||
c.isError and c.error.burnsGas
|
c.isError and c.error.burnsGas
|
||||||
|
|
||||||
func shouldEraseReturnData*(c: Computation): bool =
|
|
||||||
c.isError and c.error.erasesReturnData
|
|
||||||
|
|
||||||
func bytesToHex(x: openarray[byte]): string {.inline.} =
|
func bytesToHex(x: openarray[byte]): string {.inline.} =
|
||||||
## TODO: use seq[byte] for raw data and delete this proc
|
## TODO: use seq[byte] for raw data and delete this proc
|
||||||
foldl(x, a & b.int.toHex(2).toLowerAscii, "0x")
|
foldl(x, a & b.int.toHex(2).toLowerAscii, "0x")
|
||||||
|
|
||||||
func output*(c: Computation): seq[byte] =
|
func output*(c: Computation): seq[byte] =
|
||||||
if c.shouldEraseReturnData:
|
|
||||||
@[]
|
|
||||||
else:
|
|
||||||
c.rawOutput
|
c.rawOutput
|
||||||
|
|
||||||
func `output=`*(c: Computation, value: openarray[byte]) =
|
func `output=`*(c: Computation, value: openarray[byte]) =
|
||||||
c.rawOutput = @value
|
c.rawOutput = @value
|
||||||
|
|
||||||
proc outputHex*(c: Computation): string =
|
|
||||||
if c.shouldEraseReturnData:
|
|
||||||
return "0x"
|
|
||||||
c.rawOutput.bytesToHex
|
|
||||||
|
|
||||||
proc isSuicided*(c: Computation, address: EthAddress): bool =
|
proc isSuicided*(c: Computation, address: EthAddress): bool =
|
||||||
result = address in c.suicides
|
result = address in c.suicides
|
||||||
|
|
||||||
|
|
|
@ -777,8 +777,8 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
||||||
else:
|
else:
|
||||||
push: 1
|
push: 1
|
||||||
|
|
||||||
if not child.shouldEraseReturnData:
|
|
||||||
let actualOutputSize = min(c.memOutLen, child.output.len)
|
let actualOutputSize = min(c.memOutLen, child.output.len)
|
||||||
|
if actualOutputSize > 0:
|
||||||
c.memory.write(
|
c.memory.write(
|
||||||
c.memOutPos,
|
c.memOutPos,
|
||||||
child.output.toOpenArray(0, actualOutputSize - 1))
|
child.output.toOpenArray(0, actualOutputSize - 1))
|
||||||
|
|
|
@ -79,7 +79,6 @@ type
|
||||||
Error* = ref object
|
Error* = ref object
|
||||||
info*: string
|
info*: string
|
||||||
burnsGas*: bool
|
burnsGas*: bool
|
||||||
erasesReturnData*: bool
|
|
||||||
|
|
||||||
GasMeter* = object
|
GasMeter* = object
|
||||||
gasRefunded*: GasInt
|
gasRefunded*: GasInt
|
||||||
|
|
Loading…
Reference in New Issue