Commit Graph

11 Commits

Author SHA1 Message Date
Mamy Ratsimbazafy c26c751f9b
Reorganize VM/interpreter + cleanup (#52)
* Move and cleanup interpreter files - prepare for redesign of VM

* fix call comment aobut recursive dependencies

* memory: use a template again and avoid (?) a cstring-> string conversion

* Fix stack test regression

* Fix recursive dependency on logging_ops, test_vm_json compiles but regression :/

* Fix signextend regression

* Fix 3 signed test and sha3 test
2018-06-15 11:11:25 +02:00
Mamy Ratsimbazafy 90c3ca4a96
Gas refactoring - decouple opcode logic and gas (#49)
* Decoupling op logic and gas - introduce gasometer, rework opcode declaration

* Remove gas constants for gas opcode computation

* Remove gas constants for precompiled contracts

* make vm_types compile

* Make opcode, call and computation compile

* Distinguish between dynamic and complex gas costs, fix arithmetic

* Fix context and sha3

* update memory and storage ops

* Log opcode uses memory expansion code

* update/stub system_ops with gas costs

* Make test compile. Deactivate stub test_vm

* all tests compiles, opcode fails due to https://github.com/nim-lang/Nim/issues/8007 (const object variant in tables reset at runtime)

* Create an enum without holes - workaround: https://github.com/nim-lang/Nim/issues/8007

* Use arrays instead of tables for GasCosts, remove some unused imports - passing all basic tests!

* Make test_vm_json compile

* Fix test_vm_json - workaround https://github.com/nim-lang/Nim/issues/8015

* fix memory expansion cost bug

* Remove leftover special handling from before GckMemExpansion

* cleanup outdated comment, better align =

* Fix sha3 gas cost not taking memory expansion into account

* Improve gas error reporting of test_vm_json

* Fix gas computation regression due to mem expansion

* mass replace for memExpansion->RequestedMemSize was too eager

* fix log gas cost (no tests :/)

* missed a static FeeSchedule

* static as expression is fickle
2018-06-12 17:33:47 +02:00
Yuriy Glukhov 8bdf09683b Hash256/EthAddrres refactoring 2018-05-30 19:11:15 +03:00
Yuriy Glukhov 51b572d8b8 Some renames 2018-05-28 13:22:28 +03:00
Mamy Ratsimbazafy cb49352b6a
Gas & Memory ops refactoring - uses native integer instead of uint256 fixes #35 and #39 (#40)
* Gas refactoring - uses int64

* Use primitive int in test_vm_json
2018-05-25 12:25:19 +02:00
Mamy Ratsimbazafy 0b6fbbad67
1st gas refactoring - handle different gas costs in Ethereum forks (#37)
* Start by renaming the fork by chronological order

* initial commit - groundwork: support different gasCosts depending on VMs

* Running VMTests with new gas config - only push32AndSuicide changed

* Introduce newNimbusVM that (temporarily) abstract over Frontier and Tangerine VM creation

* Fix Gas - push32AndSuicide repassing and expXY_success passing - fixes #34

* case sensitive imports (thank you auto-completion) fix Travis on Linux

* Add pre and post EIP-150 tests

* Nimify gas identifiers that supports multiple forks
2018-05-24 12:01:59 +02:00
Mamy Ratsimbazafy 2d34f1453c
Migrate from ttmath to stint (#24)
* Constants and accounts compile as standalone

* Mass replace ttmath by Stint

* Adapt utils_numeric proc

* Adapt memory.nim

* Deactivate "ValidationError" test that requires pow(2, 256) function

* Fix state_db toByteArrayBE

* Fix more getUint toInt conversion

* Remove absolute value ambiguous call

* Stub-ify proc and opcode that requires pow - https://github.com/status-im/nim-stint/issues/37
2018-05-07 14:41:54 +02:00
Mamy Ratsimbazafy 6654576c6a
Few steps forward vm_tests (#15)
* Enable vm_tests, remove usage of from keyword as a variable name

* Fix Genesis types and use the new EthTime

* Add a new VMKind enum (py-evm vmclass runtime type)

* renaming block_obj to block_types

* chain.BlockHeader and utils.header.Header are the same thing (BlockHeader in py-evm)

* For now blockNumbers are UInt256

* EoD merge: vm_test compiles and does not throw computation error

* running full transactions is too early
2018-04-14 12:40:41 +02:00
mratsim 5a3202f4d3 Update README badges and add dual-license header 2018-04-06 16:52:10 +02:00
Mamy Ratsimbazafy 284a026e51
Add opcode tests (#4) 2018-04-06 16:25:01 +02:00
mratsim 3852c84841 Refactor: remove .sh dependency for tests 2018-04-03 18:09:09 +02:00