Commit Graph

11 Commits

Author SHA1 Message Date
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
Mamy Ratsimbazafy 8528f1b704
Dirty fix #46 (test_vm_json segfaults from #45), incidentally fix #32 (#47) 2018-06-06 20:40:44 +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
Mamy Ratsimbazafy 43797485e5
Fix exp gas cost pass 40 new tests (#29) 2018-05-16 10:41:34 +02:00
Mamy Ratsimbazafy 0f56bdec26
Re-enable exp and byteOp - pass several dozens more tests (#28)
* Rebase with master

* Run the new tests
2018-05-15 11:23:45 +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
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