mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-23 02:29:26 +00:00
This commit is contained in:
parent
040c09d5a9
commit
8528f1b704
12
VMTests.md
12
VMTests.md
@ -144,7 +144,7 @@ VMTests
|
|||||||
+ mulmod2_1.json OK
|
+ mulmod2_1.json OK
|
||||||
+ mulmod3.json OK
|
+ mulmod3.json OK
|
||||||
+ mulmod3_0.json OK
|
+ mulmod3_0.json OK
|
||||||
- mulmod4.json Fail
|
+ mulmod4.json OK
|
||||||
+ mulmoddivByZero.json OK
|
+ mulmoddivByZero.json OK
|
||||||
+ mulmoddivByZero1.json OK
|
+ mulmoddivByZero1.json OK
|
||||||
+ mulmoddivByZero2.json OK
|
+ mulmoddivByZero2.json OK
|
||||||
@ -198,7 +198,7 @@ VMTests
|
|||||||
+ sub3.json OK
|
+ sub3.json OK
|
||||||
+ sub4.json OK
|
+ sub4.json OK
|
||||||
```
|
```
|
||||||
OK: 189/195 Fail: 5/195 Skip: 1/195
|
OK: 190/195 Fail: 4/195 Skip: 1/195
|
||||||
## vmBitwiseLogicOperation
|
## vmBitwiseLogicOperation
|
||||||
```diff
|
```diff
|
||||||
+ and0.json OK
|
+ and0.json OK
|
||||||
@ -720,8 +720,8 @@ OK: 0/36 Fail: 0/36 Skip: 36/36
|
|||||||
## vmTests
|
## vmTests
|
||||||
```diff
|
```diff
|
||||||
arith.json Skip
|
arith.json Skip
|
||||||
- boolean.json Fail
|
+ boolean.json OK
|
||||||
- mktx.json Fail
|
+ mktx.json OK
|
||||||
- suicide.json Fail
|
+ suicide.json OK
|
||||||
```
|
```
|
||||||
OK: 0/4 Fail: 3/4 Skip: 1/4
|
OK: 3/4 Fail: 0/4 Skip: 1/4
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
strformat, eth_common,
|
strformat, eth_common,
|
||||||
../constants, ../vm_types, ../errors, ../computation, ../opcode, ../opcode_values, ../logging,
|
../constants, ../vm_types, ../errors, ../computation, ../opcode_values, ../logging,
|
||||||
.. / vm / [stack, memory, gas_meter, message],
|
.. / vm / [stack, memory, gas_meter, message],
|
||||||
.. / utils / [address, bytes],
|
.. / utils / [address, bytes],
|
||||||
stint
|
stint
|
||||||
@ -52,7 +52,7 @@ method callParams*(call: BaseCall, computation): (UInt256, UInt256, EthAddress,
|
|||||||
raise newException(NotImplementedError, "Must be implemented subclasses")
|
raise newException(NotImplementedError, "Must be implemented subclasses")
|
||||||
|
|
||||||
method runLogic*(call: BaseCall, computation) =
|
method runLogic*(call: BaseCall, computation) =
|
||||||
computation.gasMeter.consumeGas(computation.gasCosts[call.gasCost(computation)], reason = $call.kind) # TODO: Refactoring call gas costs
|
computation.gasMeter.consumeGas(computation.gasCosts[call.gasCostKind], reason = $call.kind) # TODO: Refactoring call gas costs
|
||||||
let (gas, value, to, sender,
|
let (gas, value, to, sender,
|
||||||
codeAddress,
|
codeAddress,
|
||||||
memoryInputStartPosition, memoryInputSize,
|
memoryInputStartPosition, memoryInputSize,
|
||||||
@ -87,7 +87,7 @@ method runLogic*(call: BaseCall, computation) =
|
|||||||
else:
|
else:
|
||||||
raise newException(VMError, "Invariant: Unreachable code path")
|
raise newException(VMError, "Invariant: Unreachable code path")
|
||||||
|
|
||||||
call.logger.debug(&"{call.kind} failure: {errMessage}")
|
computation.logger.debug(&"{call.kind} failure: {errMessage}")
|
||||||
computation.gasMeter.returnGas(childMsgGas)
|
computation.gasMeter.returnGas(childMsgGas)
|
||||||
computation.stack.push(0.u256)
|
computation.stack.push(0.u256)
|
||||||
else:
|
else:
|
||||||
|
@ -10,11 +10,22 @@ import
|
|||||||
constants, logging, errors, opcode_values, computation, vm/stack, stint,
|
constants, logging, errors, opcode_values, computation, vm/stack, stint,
|
||||||
./vm_types
|
./vm_types
|
||||||
|
|
||||||
|
|
||||||
|
# Super dirty fix for https://github.com/status-im/nimbus/issues/46
|
||||||
|
# Pending https://github.com/status-im/nimbus/issues/36
|
||||||
|
# Disentangle opcode logic
|
||||||
|
from logic.call import runLogic, BaseCall
|
||||||
|
|
||||||
|
|
||||||
template run*(opcode: Opcode, computation: var BaseComputation) =
|
template run*(opcode: Opcode, computation: var BaseComputation) =
|
||||||
# Hook for performing the actual VM execution
|
# Hook for performing the actual VM execution
|
||||||
# opcode.consumeGas(computation)
|
# opcode.consumeGas(computation)
|
||||||
computation.gasMeter.consumeGas(computation.gasCosts[opcode.gasCost(computation)], reason = $opcode.kind) # TODO: further refactoring of gas costs
|
computation.gasMeter.consumeGas(computation.gasCosts[opcode.gasCost(computation)], reason = $opcode.kind) # TODO: further refactoring of gas costs
|
||||||
opcode.runLogic(computation)
|
|
||||||
|
if opcode.kind == Op.Call: # Super dirty fix for https://github.com/status-im/nimbus/issues/46
|
||||||
|
runLogic(BaseCall(opcode), computation)
|
||||||
|
else:
|
||||||
|
opcode.runLogic(computation)
|
||||||
|
|
||||||
method logger*(opcode: Opcode): Logger =
|
method logger*(opcode: Opcode): Logger =
|
||||||
logging.getLogger(&"vm.opcode.{opcode.kind}")
|
logging.getLogger(&"vm.opcode.{opcode.kind}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user