Commit Graph

38 Commits

Author SHA1 Message Date
Jordan Hrycaj 827b8c9c81
reset explicit import paths for local modules
why:
  it was convenient to have relocatable source modules when writing the
  vm interface wrappers. this patch moves it back to the standard.

also:
  there are no deep links into the vm folder anymore which leaves some
  room for manoeuvring inside
2021-04-01 12:53:22 +01:00
Jordan Hrycaj 9e365734e6
renamed nvm_ prefixed modules to its original names
why:
  the nvm_ prefix was used inside the vm folder to hide them temporarily
  from the outside world while writing export wrappers. now all
  functionality is accessed via vm_*, rather than vm/* imports.

todo:
  at a later stage the import headers of the vm modules need to get fixed
  to meet style guide standards (as jacek kindly pointed out.)
2021-03-31 17:19:54 +01:00
Jordan Hrycaj 7c28d5d362
provide vm_utils_numeric as import/export wrapper
details:
  moved original vm/interpreter/utils/utils_numeric.nim => vm/interpreter/utils/utils_numeric.nim
2021-03-31 16:49:07 +01:00
Jordan Hrycaj 99568c9b46
provide vm_opcode_values as import/export wrapper
details:
  moved original vm/interpreter/opcode_values.nim => vm/interpreter/nvm_opcode_values.nim
2021-03-31 16:49:03 +01:00
Jordan Hrycaj cf63b9b03f
provide vm_memory as import/export wrapper
details:
  moved original vm/memory.nim => vm/nvm_memory.nim
2021-03-31 16:48:44 +01:00
Jordan Hrycaj cf3a356d76
provide vm_computation as import/export wrapper
details:
  moved original vm/computation.nim => vm/nvm_computation.nim
2021-03-31 16:38:10 +01:00
Jordan Hrycaj ed59f602d5
isolate vm_types as import/export wrapper
details:
  moved original vm_types.nim => vm/nvm_types.nim
2021-03-31 09:48:50 +01:00
Jordan Hrycaj a3db0f41d8
remove relative paths ./ and ../ from import section
why:
  relative paths make sources inherently non-relocatable

details:
  import base is set to the nimbus directoy, so importing ./stack
  from file interpreter.nim becomes vm/stack etc.

caveat:
   a file named nimbus/strformat.nim would clash with strformat (but
   not with std/strformat)
2021-03-30 17:20:43 +01:00
jangko 97f73fd03d
implement EIP 2046 2020-11-19 14:23:07 +07:00
Jacek Sieka 4ade5797ee
rlp: don't use ranges / experimental features (#495) 2020-04-20 20:12:44 +02:00
andri lim af02a3b1b2
reduce unused import warnings 2020-04-15 19:05:57 +07:00
andri lim c459879647 only import evmc files when 'evmc_enabled' defined 2020-01-23 18:07:44 +02:00
andri lim 62f96e9bd4 integrate evmc 'emitLog' 2020-01-23 18:07:44 +02:00
andri lim 0b99b76cd1 change 'BaseComputation' to 'Computation' 2020-01-20 18:36:58 +02:00
andri lim 836e087984 [skip ci] change storageAddress to contractAddres 2020-01-19 19:17:37 +02:00
andri lim c4dcf5da30
reduce compiler warnings 2019-11-13 21:49:39 +07:00
andri lim dec3c7baee
fixes 32bit problem 2019-10-28 22:21:41 +07:00
andri lim 7d74d38530 countLeadingZero become leadingZeros 2019-05-13 10:26:28 +03:00
andri lim b7a1431c33 fix modexp gasFee 2019-05-13 10:26:28 +03:00
andri lim cd7143e9af fix modexp 2019-05-13 10:26:28 +03:00
andri lim f809a864b1 fix calcMemSize bug 2019-05-13 10:26:28 +03:00
andri lim 3ccd1b1ee9
fix rangeToPadded, GST +5 2019-04-26 07:31:17 +07:00
andri lim 605618d9ee
add static context check, GST +94 -28 2019-04-26 07:31:12 +07:00
Ștefan Talpalaru 29a226da1e
more gcsafe pragmas for Nim HEAD 2019-04-26 00:18:51 +02:00
andri lim 07ac4620d9
remove 'var' modifier from 'computation: var BaseComputation' 2019-04-04 10:20:00 +07:00
Ștefan Talpalaru a67edd693a
assert() -> doAssert() 2019-03-13 22:36:54 +01:00
Yuriy Glukhov 481c6cf4ed Use nim-eth (#224) 2019-02-05 20:15:50 +01:00
andri lim ad1202f98a initial make_receipt 2018-12-16 15:38:51 +02:00
mratsim 24bcb3b2d8 remove log2 spurious comment 2018-12-04 15:56:18 +01:00
mratsim 6d93bdffea modExp, support up to uint4096 2018-12-04 14:39:10 +01:00
mratsim 949c5a1dc6 Modexp fix example 1 (returned to early for ints of length 1) 2018-12-04 12:49:48 +01:00
mratsim bb6e1e1d76 modExp precompiles: fix padding and static evaluation 2018-10-10 16:26:21 +02:00
mratsim 38b4d54815 Add modExp precompile + gas costs 2018-10-05 17:26:20 +02:00
Dustin Brody 048921b045 20 new working GeneralStateTests 2018-09-18 14:00:30 +00:00
Yuriy Glukhov 6c67115ef5 Fixed sstore gas computation, empty sha3, smod, sdiv (#71)
* Fixed sstore gas computation, fixed empty sha3

* Fixed smod and sdiv

* Comments addressed
2018-07-18 11:14:28 +02:00
Yuriy Glukhov 46a8b5dc49 Refactored log opcodes, added validation, fixed a couple of tests 2018-07-16 11:14:52 +02:00
Mamy Ratsimbazafy 4dd75aee84
Delete utilities: address, padding, bytes (#68)
* Delete utilities: address, padding, bytes

* Remove bigEndianToInt

* Fix C compiler error: member reference base type 'char' is not a structure or union

* fix todo comment
2018-07-06 17:08:31 +02:00
Mamy Ratsimbazafy 4b5eada322
Refactor interpreter dispatch (#65)
* move forks constants, rename errors

* Move vm/utils to vm/interpreter/utils

* initial opcodes refactoring

* Add refactored Comparison & Bitwise Logic Operations

* Add sha3 and address, simplify macro, support pop 0

* balance, origin, caller, callValue

* fix gas copy opcodes gas costs, add callDataLoad/Size/Copy, CodeSize/Copy and gas price opcode

* Update with 30s, 40s, 50s opcodes + impl of balance + stack improvement

* add push, dup, swap, log, create and call operations

* finish opcode implementation

* Add the new dispatching logic

* Pass the opcode test

* Make test_vm_json compile

* halt execution without exceptions for Return, Revert, selfdestruct (fix #62)

* Properly catch and recover from EVM exceptions (stack underflow ...)

* Fix byte op

* Fix jump regressions

* Update for latest devel, don't import old dispatch code as quasiBoolean macro is broken by latest devel

* Fix sha3 regression on empty memory slice and until end of range slice

* Fix padding / range error on expXY_success (gas computation left)

* update logging procs

* Add tracing - expXY_success is not a regression, sload stub was accidentally passing the test

* Reuse the same stub as OO implementation

* Delete previous opcode implementation

* Delete object oriented fork code

* Delete exceptions that were used as control flows

* delete base.nim 🔥, yet another OO remnants

* Delete opcode table

* Enable omputed gotos and compile-time gas fees

* Revert const gasCosts -> generates SIGSEGV

* inline push, swap and dup opcodes

* loggers are now template again, why does this pass new tests?

* Trigger CI rebuild after rocksdb fix https://github.com/status-im/nim-rocksdb/pull/5

* Address review comment on "push" + VMTests in debug mode (not release)

* Address review comment: don't tag fork by default, make opcode impl grepable

* Static compilation fixes after rebasing

* fix the initialization of the VM database

* add a missing import

* Deactivate balance and sload test following #59

* Reactivate stack check (deactivated in #59, necessary to pass tests)

* Merge remaining opcodes implementation from #59

* Merge callDataLoad and codeCopy fixes, todo simplify see #67
2018-07-06 09:52:31 +02:00