Commit Graph

94 Commits

Author SHA1 Message Date
Zahary Karadjov 583c72fa54 Implement storage backends using RocksDB and SQLite 2018-06-26 13:46:54 +03:00
mratsim 05703fc86f logging: non-debug costless, avoid allocating constant string messages 2018-06-15 14:20:42 +02:00
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 05275f9773
Activate logging, sha3, arith tests (#51)
* Activate the tests

* Use 3 params in memExpansion gas costs, fix 31 log tests and 8 sha3 tests

* Activate Control Flow tests as well
2018-06-13 19:33:47 +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 d8a4e5cbfb Fixed compilation of test_vm_json. Still fails because of Op.Call :( 2018-05-31 10:58:59 +03: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 507bdda25a
Catch stack underflow (#33)
* Stack underflow: Add failing test to catch #31

* ensurePop, use proc instead of template + add comment for future refactoring of popInternal

* Check stack underflows before popping values

* run json tests again
2018-05-17 20:59:17 +02:00
Mamy Ratsimbazafy 74a558f187
Fix arithmetic implementation issues (#30)
* Change modular arithmetic ops and signextend implementation

* Don't use signed int, introduce EVM "pseudoSigned" conversion pass 4 sdiv/smod tests

* Print computation error in tests
2018-05-17 10:08:28 +02:00
Zahary Karadjov f705a60dc1 fixes #27 (a number of setStorage failing tests) 2018-05-14 23:13:13 +03:00
mratsim 9fc80cb6c9 Update VMTests with Stint, raise Exception for non-implemented Exp and byteOp instead of quitting 2018-05-11 18:16:35 +02:00
Mamy Ratsimbazafy 8f95c86944
Fix JSON VMtests compile-time errors (#25)
* Fix imports

* Fix Ethtime in fixtures following https://github.com/nim-lang/Nim/commit/f6df2d9956a79eda0486391
2018-05-11 15:32:10 +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
cheatfate 155287c21b Fix tests. 2018-05-01 11:44:05 +03:00
cheatfate fac64467f2 Add nim-eth-p2p dependency.
Add ENode support to arguments parsing.
2018-05-01 03:47:35 +03: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 cbc0176011 update test readme 2018-04-03 18:14:47 +02:00
mratsim 3852c84841 Refactor: remove .sh dependency for tests 2018-04-03 18:09:09 +02:00
mratsim 1cf5e6694b Force usage of GCC on MacOS for #2 2018-04-03 12:30:05 +02:00
Alexander Ivanov c4361061c1 Opcode add test 2018-03-14 13:11:32 +02:00
Alexander Ivanov c1a8fa6381 Fix memory 2018-03-14 11:15:03 +02:00
Alexander Ivanov edac9af2a2 Improve types 2018-03-13 16:30:38 +02:00
Alexander Ivanov 8be1a51c64 Fix 80 arithmetic gas cost tests, improve exp gas cost 2018-02-28 17:06:05 +02:00
Alexander Ivanov f179695341 Fix arithmetic and save test progress in VMTests.md 2018-02-27 20:10:45 +02:00
Alexander Ivanov dc365b2e23 Fix tests 2018-02-26 14:00:15 +02:00
Alexander Ivanov 99921f38cb Pass more tests, use UInt256 more often
82 / 189 arithmetic
55 / 62 logic
77 / 78 stack

Most errors are the same sstore gascost bug, also next work on flow and memory
2018-02-20 19:27:43 +02:00
Alexander Ivanov 9c056b85de Pass first fixtures tests
Todo

Pass most VM opcode tests that we can (of those that don't depend
too much on porting the whole py-evm)

Simplify a bit the current py-evm-inspired internal loop arch
2018-02-14 18:38:01 +02:00
Alexander Ivanov 3a0596bac7 WIP tests based on fixtures 2018-02-13 19:18:08 +02:00
Alexander Ivanov 63d76e0f37 Improve headers build 2018-02-13 12:42:22 +02:00
Alexander Ivanov 0d31382e3d Work on text fitures and decompiling bytecode 2018-02-12 18:59:50 +02:00
Alexander Ivanov df41fe270e Add the ttmath wrapper 2018-02-07 18:16:04 +02:00
Alexander Ivanov 35e43fa32e Pass correctly commands to docker command for travis 2018-02-07 13:46:07 +02:00
Alexander Ivanov e07fc0562d Separate test build from run 2018-02-07 13:15:54 +02:00
Alexander Ivanov 04546ef629 Compile actual test files 2018-02-07 11:58:17 +02:00
Alexander Ivanov f918692496 Fix memory and gas tests 2018-02-07 11:50:15 +02:00
Alexander Ivanov 211d46e39e Finish the first memory impl and tests, stack tests, fixes validation 2018-02-06 21:20:06 +02:00
Alexander Ivanov 04b1228fbe Add gas meter tests and some helpers unittest 2018-01-31 15:28:25 +02:00
Alexander Ivanov a233cef719 CodeStream impl and tests, fix byte and string fields 2018-01-31 14:57:05 +02:00
Alexander Ivanov e1c04e587f First version of tests 2018-01-17 13:24:09 +02:00