remove unused eraseReturnData
This commit is contained in:
parent
52fffa6e25
commit
009aa35dfb
|
@ -23,8 +23,6 @@ type
|
|||
|
||||
VMError* = object of EVMError
|
||||
## Class of errors which can be raised during VM execution.
|
||||
erasesReturnData*: bool
|
||||
burnsGas*: bool
|
||||
|
||||
OutOfGas* = object of VMError
|
||||
## Error signaling that VM execution has run out of gas.
|
||||
|
@ -67,8 +65,3 @@ type
|
|||
|
||||
StaticContextError* = object of VMError
|
||||
## 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 =
|
||||
c.isError and c.error.burnsGas
|
||||
|
||||
func shouldEraseReturnData*(c: Computation): bool =
|
||||
c.isError and c.error.erasesReturnData
|
||||
|
||||
func bytesToHex(x: openarray[byte]): string {.inline.} =
|
||||
## TODO: use seq[byte] for raw data and delete this proc
|
||||
foldl(x, a & b.int.toHex(2).toLowerAscii, "0x")
|
||||
|
||||
func output*(c: Computation): seq[byte] =
|
||||
if c.shouldEraseReturnData:
|
||||
@[]
|
||||
else:
|
||||
c.rawOutput
|
||||
c.rawOutput
|
||||
|
||||
func `output=`*(c: Computation, value: openarray[byte]) =
|
||||
c.rawOutput = @value
|
||||
|
||||
proc outputHex*(c: Computation): string =
|
||||
if c.shouldEraseReturnData:
|
||||
return "0x"
|
||||
c.rawOutput.bytesToHex
|
||||
|
||||
proc isSuicided*(c: Computation, address: EthAddress): bool =
|
||||
result = address in c.suicides
|
||||
|
||||
|
|
|
@ -598,7 +598,7 @@ template genCreate(callName: untyped, opCode: Op): untyped =
|
|||
op callName, inline = false, val, startPosition, size:
|
||||
## 0xf0, Create a new account with associated code.
|
||||
checkInStaticContext(c)
|
||||
|
||||
|
||||
let (memPos, len) = (startPosition.safeInt, size.safeInt)
|
||||
if not c.canTransfer(memPos, len, val, opCode):
|
||||
push: 0
|
||||
|
@ -614,7 +614,7 @@ template genCreate(callName: untyped, opCode: Op): untyped =
|
|||
push: 0
|
||||
else:
|
||||
push: child.msg.contractAddress
|
||||
|
||||
|
||||
child.applyMessage(Create)
|
||||
|
||||
genCreate(create, Create)
|
||||
|
@ -777,8 +777,8 @@ template genCall(callName: untyped, opCode: Op): untyped =
|
|||
else:
|
||||
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.memOutPos,
|
||||
child.output.toOpenArray(0, actualOutputSize - 1))
|
||||
|
|
|
@ -79,7 +79,6 @@ type
|
|||
Error* = ref object
|
||||
info*: string
|
||||
burnsGas*: bool
|
||||
erasesReturnData*: bool
|
||||
|
||||
GasMeter* = object
|
||||
gasRefunded*: GasInt
|
||||
|
|
Loading…
Reference in New Issue