mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 13:24:21 +00:00
make test green
This commit is contained in:
parent
f3c740498c
commit
1383a87e10
@ -193,6 +193,7 @@ proc initComputation(vmState: BaseVMState, tx: Transaction, sender: EthAddress,
|
||||
|
||||
let contractAddress = generateAddress(sender, tx.accountNonce)
|
||||
let msg = newMessage(tx.gasLimit - gasUsed, tx.gasPrice, tx.to, sender, tx.value, data, tx.payload,
|
||||
contractCreation = false,
|
||||
options = newMessageOptions(origin = sender, createAddress = contractAddress))
|
||||
|
||||
newBaseComputation(vmState, vmState.blockNumber, msg, some(fork))
|
||||
|
@ -32,6 +32,7 @@ proc testCode(code: string, initialGas: GasInt, blockNum: UInt256): BaseComputat
|
||||
value=0.u256,
|
||||
data = @[],
|
||||
code=code.hexToSeqByte,
|
||||
contractCreation = true,
|
||||
gas=initial_gas,
|
||||
gasPrice=1) # What is this used for?
|
||||
# gasPrice=fixture{"exec"}{"gasPrice"}.getHexadecimalInt.u256,
|
||||
|
@ -28,7 +28,7 @@ template doTest(fixture: JsonNode, address: byte, action: untyped): untyped =
|
||||
gasPrice = 1.GasInt
|
||||
sender: EthAddress
|
||||
to = initAddress(address)
|
||||
message = newMessage(gas, gasPrice, to, sender, 0.u256, data, @[])
|
||||
message = newMessage(gas, gasPrice, to, sender, 0.u256, data, @[], contractCreation = false)
|
||||
computation = newBaseComputation(vmState, header.blockNumber, message)
|
||||
echo "Running ", action.astToStr, " - ", test["name"]
|
||||
`action`(computation)
|
||||
|
@ -50,6 +50,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
|
||||
value = cast[uint64](fexec{"value"}.getHexadecimalInt).u256, # Cast workaround for negative value
|
||||
data = fexec{"data"}.getStr.hexToSeqByte,
|
||||
code = code,
|
||||
contractCreation = toAddress == ZERO_ADDRESS, # assume ZERO_ADDRESS is a contract creation
|
||||
gas = fexec{"gas"}.getHexadecimalInt,
|
||||
gasPrice = fexec{"gasPrice"}.getHexadecimalInt,
|
||||
options = newMessageOptions(origin=fexec{"origin"}.getStr.parseAddress,
|
||||
@ -57,7 +58,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
|
||||
|
||||
var computation = newBaseComputation(vmState, header.blockNumber, message)
|
||||
computation.executeOpcodes()
|
||||
|
||||
|
||||
if not fixture{"post"}.isNil:
|
||||
# Success checks
|
||||
check(not computation.isError)
|
||||
|
Loading…
x
Reference in New Issue
Block a user