Commit Graph

384 Commits

Author SHA1 Message Date
andri lim f518de20fc
fix miner suicide problem, GST +2 2019-03-18 20:29:07 +07:00
andri lim 655c6bcaae
GST +3 2019-03-18 19:43:54 +07:00
andri lim 7198ce2d05
fix ecrecover bad V, GST +1 2019-03-18 19:28:42 +07:00
andri lim aed0db2d03
fix DelegateCall sender address, GST +37 2019-03-18 18:45:43 +07:00
andri lim 36fb75d042
fix DelegateCall gasCost, GST +6 2019-03-18 17:24:25 +07:00
andri lim a7c6531f08
fix block gaslimit problem, GST +70 2019-03-18 14:35:52 +07:00
andri lim 739e20253a
fix invalid opcodes bug, GST +1 2019-03-18 13:44:22 +07:00
andri lim 4f6f564626
fix regression 2019-03-18 13:13:16 +07:00
andri lim cd765bf452
fix create contract address collision, GST +1 2019-03-18 12:48:32 +07:00
andri lim 4383831772
separate Frontier and Homestead opcode dispatcher 2019-03-18 11:27:32 +07:00
andri lim b4720bce26
make test green 2019-03-18 10:52:18 +07:00
andri lim 0b43b143b1
add config to gst 2019-03-18 10:05:24 +07:00
andri lim 31e8b3d7ed
activates Frontier fork in GST, +125 -57 2019-03-18 09:15:37 +07:00
andri lim 2bd5c99b27
add debugging caps to gst 2019-03-18 08:55:02 +07:00
Ștefan Talpalaru 9f0c945336 CI: use a release build for the test suite (#278)
* CI: use a release build for the test suite

Makefile: the "testsuite" target is no longer needed

* rename EXTRA_NIM_PARAMS to NIMFLAGS
2019-03-16 18:54:30 -06:00
andri lim 90b7e906b4
GST +3 2019-03-16 23:08:41 +07:00
andri lim d0822c26d1
fix callcode insufficient funds, GST +6 2019-03-16 22:54:24 +07:00
andri lim 990bc44c65
fix not enough gas, GST +5 2019-03-16 22:23:15 +07:00
andri lim 433ccba15f
fix writePaddedResult, GST +4 2019-03-16 21:42:06 +07:00
andri lim adb1286e28
fix create hash collision, GST +1 2019-03-16 12:13:57 +07:00
andri lim 3844bc9a11
faster gst helpers 2019-03-15 22:34:05 +07:00
andri lim eb6e872dff
GST +17 2019-03-15 22:21:24 +07:00
Ștefan Talpalaru a67edd693a
assert() -> doAssert() 2019-03-13 22:36:54 +01:00
andri lim fee2a97b52 add problematic block tests 2019-03-13 15:49:54 +02:00
andri lim 9f0b78dc5a GST +3 2019-03-13 15:49:54 +02:00
andri lim b7f630df19 GST OK +1 2019-03-12 13:32:41 +02:00
andri lim 56f81ae821
add notable blocks into test 2019-03-11 20:18:28 +07:00
andri lim 44ec66d5c8
pass additional 11 GST 2019-03-11 19:03:30 +07:00
andri lim 571b93fd7a
pass additional 17 GST 2019-03-11 12:12:35 +07:00
andri lim e2311d798b
fix recurring symbol collision problem 2019-03-07 22:53:09 +07:00
andri lim fdf9e04108
initial contract call/create unification 2019-03-07 22:09:22 +07:00
andri lim 4c5eeac41e make test green 2019-03-04 11:56:50 +02:00
andri lim 38757c956d gst refactor: share the same tx.getSender with rest of Nimbus 2019-03-04 11:56:50 +02:00
andri lim 9ee3458dd4 add logs hash check to GST 2019-02-28 12:06:23 +02:00
andri lim ffe8769259 fix test_vm_json 2019-02-28 10:04:49 +02:00
andri lim 0518802690 contract creation and contract call cleanup 2019-02-28 10:04:49 +02:00
andri lim a99b3f2096 pass additional 9 GST 2019-02-27 13:30:18 +02:00
andri lim e2bc3d0045 refactor GST 2019-02-27 13:30:18 +02:00
andri lim 5ab7c02dcf refactor sender transfer 2019-02-27 13:30:18 +02:00
andri lim 26d8ab84fe refactor recipient transfer 2019-02-27 13:30:18 +02:00
andri lim 8193a4ae6a refactor gas used in transaction 2019-02-27 13:30:18 +02:00
andri lim 810259bfc4 make test green 2019-02-27 13:30:18 +02:00
andri lim 200f93a3b7 refactor incNonce 2019-02-27 13:30:18 +02:00
andri lim 2c032ad1ab refactor utils 2019-02-27 13:30:18 +02:00
andri lim a7c19e7c71
update tracer test data again 2019-02-26 09:00:46 +07:00
andri lim 8fbcbfb9b3
add some notable blocks into test 2019-02-26 08:45:32 +07:00
andri lim 10b61ae22a
update tracer test data 2019-02-26 08:40:40 +07:00
andri lim d679798abb
pass additional 12 GST 2019-02-25 21:13:05 +07:00
andri lim d6f7dfde5c
pass additional 4 GST 2019-02-25 17:10:38 +07:00
andri lim 592fa5df7e fix SIGNEXTEND opcode 2019-02-23 17:57:53 +02:00
andri lim eec9f32985 pass additional 32 GST, no addition failed GST 2019-02-23 17:57:53 +02:00
andri lim 7ff9a7f02e remove add stop from macro assembler 2019-02-22 13:10:22 +02:00
andri lim fa183e3a31 separate test_rpc from all_tests 2019-02-20 15:16:07 +02:00
andri lim 5f2abf7fe1 pass additional 6 GST 2019-02-20 15:16:07 +02:00
andri lim dcf7699358 fix callcode regression 2019-02-20 15:16:07 +02:00
andri lim 85d8155177 pass additional 20 GST 2019-02-20 15:16:07 +02:00
andri lim 8884627d07 trade 3 failed GST with 17 OK GST 2019-02-20 15:16:07 +02:00
andri lim 345133e8eb pass additional 15 GST 2019-02-20 15:16:07 +02:00
andri lim 5ba44083f0 fix contract call in gst and executor.nim 2019-02-20 15:16:07 +02:00
andri lim dfeb0ab3b9 allow Callcode1024BalanceTooLow.json to fail on 32 bit 2019-02-18 13:16:04 +02:00
andri lim e4e1e60790 attempt to make test green 2019-02-18 13:16:04 +02:00
andri lim caa2db63ca update tests data after fixing tracer 2019-02-18 13:16:04 +02:00
andri lim 15e1b13491 trade 13 fail GST with 122 OK GST 2019-02-18 13:16:04 +02:00
andri lim 150fafbc8c trade 7 failed GST with 48 OK GST 2019-02-15 17:20:51 +02:00
andri lim fdc34a4cf6 fixes vmState construction 2019-02-15 17:20:51 +02:00
andri lim b8ada41ce0 allow 'call0.json' to fail on 32 bit 2019-02-07 11:01:43 +01:00
andri lim c657f23d73 fixes persistBlockTestGen and update tests 2019-02-07 11:01:43 +01:00
andri lim 00087de2ce trade 7 failed GST with 107 OK GST 2019-02-07 11:01:43 +01:00
andri lim 4466deff37 fixes path in tests 2019-02-06 18:42:03 +01:00
andri lim 67c38b0275 fixes NUMBER opcode 2019-02-06 18:42:03 +01:00
andri lim 7c6c7dbe3a 'accountExist' to 'accountExists' 2019-02-06 18:42:03 +01:00
andri lim 4cc0ef427c add ccountExist and isDeadAccount to AccountStateDB 2019-02-06 18:42:03 +01:00
Yuriy Glukhov 481c6cf4ed Use nim-eth (#224) 2019-02-05 20:15:50 +01:00
andri lim 2bc880d395 use 'newLitFixed' from std_shims, reduce LOC further 2019-01-31 20:16:47 +02:00
andri lim 99a5eefcce simplifies code, remove globals and double layer macro, employ macrocache 2019-01-31 20:16:47 +02:00
andri lim fff049abe8 fix path again 2019-01-31 20:16:47 +02:00
andri lim c92bc7c4e4 fix path when load test data 2019-01-31 20:16:47 +02:00
andri lim 58b5aa5f39 implement macro_assembler and opcodes test suite 2019-01-31 20:16:47 +02:00
Ștefan Talpalaru 60d2867b2e disable Chronicles colors on Windows 2019-01-16 14:17:26 +02:00
Ștefan Talpalaru a431ceed11 add "--threads:on" to tests and main binary
- some "funcs" were no longer considered side-effect free, so I made
  them procs
- added {.base.} to some base methods to avoid a deprecation warning
2019-01-15 18:59:24 +02:00
andri lim fbb03fb9b2 update test data 2019-01-15 15:30:25 +02:00
Yuriy Glukhov 58ad0e472c Moved db backends to eth_trie 2019-01-13 15:31:59 +02:00
Ștefan Talpalaru 7c7260552d
rebase and various fixes
- port to new APIs
- added copyright headers
- bumped the copyright interval in modified files
- fixed tests
- reorganised imports
- normalised function names
- deleted some trailing space
- added test_rpc to all_tests
- assert() -> doAssert()
- moved the RPC port in a constant for the test suite
2019-01-06 20:19:48 +01:00
coffeepots d19a7f7c04
Add simple test for eth_estimateGas 2019-01-06 19:03:35 +01:00
coffeepots 2c1c3d6c76
Update eth_estimateGas sig for testing 2019-01-06 19:03:35 +01:00
coffeepots c2fae69318
Add assertion to check for canonical head 2019-01-06 19:03:34 +01:00
andri lim 281b7dffac implement debug_setHead 2019-01-06 13:17:08 +02:00
andri lim 74d728f962 pass additional 15 general state tests 2019-01-06 13:16:45 +02:00
andri lim 96b18cfce3 add select_backend module 2019-01-06 11:43:38 +02:00
andri lim 3a10f99694 add persistblock test 2019-01-06 11:43:38 +02:00
andri lim 5cf43c2909 implement dumpDebuggingMetaData 2019-01-06 11:43:38 +02:00
andri lim 5fc134ac2a add lmdb backend 2019-01-06 11:43:38 +02:00
andri lim a6bf970b1b some cleanup 2019-01-06 11:43:38 +02:00
andri lim 9db4e9296a add tracer test 2019-01-06 11:43:38 +02:00
andri lim 83e01994df add total count to test helpers 2018-12-26 23:45:57 +02:00
andri lim d3380f6cf0 fix test 2018-12-16 15:38:51 +02:00
Ștefan Talpalaru f91e69f7c7
more VM tracing
The existing vmState tracing is plugged into chronicles, at the TRACE
level, to facilitate state test debugging.

Some useful chronicles defines are added to "tests/nim.cfg" to simplify
the compile-and-run command for individual tests.
2018-12-12 11:47:10 +01:00
Ștefan Talpalaru 115843487c
general-state testsuite changes and better fork selection
- skipped the tests in allowedFailInCurrentBuild()
- replaced doAssert() with check() in testFixtureIndexes() so we can see
  both hash values on failure
- checking filename extension for JSON tests to avoid editor swap files
- replaced the duplicated block values in the main net's ChainConfig
  with values from forkBlocks
- allowed overriding the current fork in computations, because the old
  strategy of only looking at the block number doesn't work with JSON tests
  where the block number is usually 1
- explicitly pass the fork to gasCosts() and use it for conditional cost
  calculation
- fixed a logic error in the CREATE opcode
- fixed VM selection based on current fork in updateOpcodeExec()
- single point of control for supported forks in tests (just one fork, at the
  moment)
- 44 new test failures (that were probably passing for the wrong reasons)
2018-12-07 18:18:29 +01:00
coffeepots 86853ea97c
Merge pull request #187 from status-im/modexp-fixes
Modexp fixes
2018-12-06 10:10:59 +00:00
andri lim c954dc7d62 fix tests 2018-12-05 22:01:29 +07:00
mratsim 4d07d99f66 Add precompiles to all tests to prevent regressions 2018-12-04 16:32:11 +01:00
mratsim f50bb57eb6 Reactivate the precompiles test + consume gas 2018-12-04 15:52:59 +01:00
mratsim 29f8a8a066 modExp fixed! 2018-12-04 15:46:33 +01:00
mratsim 949c5a1dc6 Modexp fix example 1 (returned to early for ints of length 1) 2018-12-04 12:49:48 +01:00
coffeepots 184143ba65 Update return types 2018-11-28 22:27:15 +00:00
coffeepots b57427e3ee Add genesis block 2018-11-28 21:57:10 +00:00
coffeepots 3557567a1b Moch test for eth_call but needs working header fetching 2018-11-26 18:16:58 +00:00
coffeepots 0899634b6d Update signatures for eth_call 2018-11-26 18:13:24 +00:00
coffeepots f7d858d58b Add missing .json 2018-11-13 19:45:34 +00:00
coffeepots 6dcb639e64 Add 32 bit failures to GST CI exclusion 2018-11-13 19:45:34 +00:00
coffeepots e5551bb3f7 Update memDB/chain use with eth_trie changes 2018-11-13 19:45:34 +00:00
coffeepots eceaa58ebb Update failing tests list 2018-11-13 19:45:34 +00:00
coffeepots f99138dca6 Merge branch 'call-fixes-precompiles' 2018-11-12 15:57:54 +00:00
coffeepots 0366dd47d9 Remove irrelevant comments 2018-11-08 18:54:21 +00:00
Dustin Brody 5095bfa8d8 add missing module import 2018-10-19 09:42:32 -07:00
Zahary Karadjov 41adca1abb Minimal changes required for building the LES branch 2018-10-16 03:10:01 +03:00
coffeepots 4ca4a859ad Remove bogus sha256 tests 2018-10-10 18:47:54 +01:00
coffeepots e53222c7ab Test suite for precompiles 2018-10-10 17:27:00 +01:00
coffeepots 7c778867a2 Allow simpler json files to be processed, add dir sep for echo 2018-10-10 17:26:32 +01:00
coffeepots 2ee9861a9e Precompile test data 2018-10-10 17:25:54 +01:00
Zahary Karadjov 343cc4fa43 Populate the persistent databases with the empty RLP key.
Also implements transactional block persistence. Two issues
in the transaction processing code have been discovered that
might affect other usages such as the CALL instruction.

The main fix gets us past block 49000.

You may need to clean up your database.
2018-10-05 03:36:48 +03:00
Dustin Brody 7459650663 only disable 32-bit-failing tests in 32-bit builds 2018-10-04 17:52:58 +00:00
Dustin Brody 7aa0c386dd some simplification and cleanup 2018-10-04 17:52:58 +00:00
coffeepots e2087f0922 Remove precompile hash table 2018-10-02 15:55:28 +01:00
tersec 4f04332205
Refactor contract creation into transaction code from P2P code; get 14 new GSTs working (#163)
* checkpoint where refactoring and calling from GST runner doesn't break anything

* 14 new GSTs pass by refactoring contract creation out of p2p/chain and using from GST test runner

* 2 of 14 new tests fail in 32-bit builds

* switch from CREATE_CONTRACT_ADDRESS to isContractCreation

* switch another CREATE_CONTRACT_ADDRESS to isContactCreation
2018-09-29 15:36:42 +00:00
tersec d4e95fae94
refactor aspects of transaction processing out of GeneralStateTests handler; get p2p/chain runnning through block 48680; combine/deduplicate two different but equivalent methods of caulculating transaction intrinsic gas cost; fix BaseTransaction references to just Transaction references in hitherto unreferenced stubbed out source so it builds; clean up some imports from refactoring (#161) 2018-09-27 19:09:26 +00:00
Zahary Karadjov 74f6f0b738 Deal with the refactoring in status-im/nim-rlp#20 2018-09-26 12:58:23 +03:00
Zahary Karadjov 4e323df363 Implement a --datadir command-line options
By default, the database files will be written in the
platform-specific application data folder:

$HOME/AppData/Roaming/Nimbus/DB
$HOME/Library/Application Support/Nimbus/DB
$HOME/.cache/nimbus/db
2018-09-25 02:06:20 +03:00
Dustin Brody c468bcd713 clean up VMTests and remove some scaffolding 2018-09-24 21:46:53 +03:00
tersec 690ce2cf97
Partly fix state_db getCode for 20 new working GeneralStateTests (#156)
* partly fix state_db getCode to get 20 new working GeneralStateTests; remove 2 functions which existed as workarounds; switch all remaining setBalance calls in GeneralStateTestRunner to subBalance (addBalance calls already changed)

* two of the 20 new tests don't work in 32-bit builds
2018-09-20 21:36:57 +00:00
Dustin Brody 8e231b566c
set to allow-fail another dozen or so tests which have 32-bit issues and integrate with CI (#154) 2018-09-19 17:57:45 +00:00
Dustin Brody 8f4e1a4445
integrate GeneralStateTest runner into CI with 775 running tests (#153)
* fix 32-bit issue in AppVeyor

* allow another dozen or so GeneralStateTest fixtures which work on 64-bit, but not on 32-bit platforms, to safely-fail, but demarcate them separately to facilitate debugging

* steal fa672600eb from @coffeepots fix-int32-high-zero branch
2018-09-19 16:46:14 +00:00
Yuriy Glukhov 0adfaf0f31 s/increaseBalance/addBalance 2018-09-19 18:41:17 +03:00
Yuriy Glukhov 75f973e654 Fixed test 2018-09-19 18:41:17 +03:00
Dustin Brody 048921b045 20 new working GeneralStateTests 2018-09-18 14:00:30 +00:00
coffeepots 4f03c9cf2a
Merge pull request #139 from status-im/callOpCodeWork
Flesh out call op
2018-09-18 14:09:00 +01:00
coffeepots 4a944398c9 More newMemoryDb updates 2018-09-18 12:18:59 +01:00
coffeepots 760e4f9685 Adjust trie creation to properly init transactional tries 2018-09-18 12:02:34 +01:00
Dustin Brody fe761cd4ff 14 additional GeneralStateTests and clean up some empty hex string parsing kludginess 2018-09-17 13:41:32 +00:00
Dustin Brody beb1befc6e 13 additional GeneralStateTests working; remove commented auto-ported Py-EVM validations which are implicit in UInt256; address comments to last commit (toSeq, hoising vmState.readOnlyStateDB, deltaBalance -> increaseBalance) 2018-09-17 13:41:32 +00:00
Dustin Brody 7ba90fda54
48 new working GeneralStateTests, via fixing some overflows/underflows, creating a rudimentary balance commit/revert scheme, and implementing account deletion for the selfdestruct instruction (#146) 2018-09-14 13:43:40 +00:00
Dustin Brody 22882edf4d
get 106 more generalstatetests working by detecting computation errors and allowing empty code accounts (#145) 2018-09-13 15:00:23 +00:00
Dustin Brody 3cc7e9d8fd
skip 1000+ tests which either are slow (quadratic tests) or don't support Homestead; add ~50 new working tests (#143) 2018-09-12 16:33:53 +00:00
Yuriy Glukhov 62260c786d Caching DB backend 2018-09-12 17:53:15 +03:00
Dustin Brody 00c4df6153
detect erronous transactions and roll back to previous state, without refunding any gas, per yellow paper (#141) 2018-09-11 13:15:59 +00:00
Dustin Brody e24f7fe144 unskip some other (failing) tests 2018-09-10 19:42:45 +03:00
Dustin Brody fd07d6fed1 A simple/basic GeneralStateTest runner which gets 400+ of them correct 2018-09-10 19:42:45 +03:00
Yuriy Glukhov 3a1ec035b3 Various fixes towards state reconstruction 2018-09-07 14:00:37 +03:00
Dustin Brody 9e1be6438e Extract transaction senders from GeneralStateTest fixtures 2018-09-06 11:20:43 +03:00
Dustin Brody 4262ea8670 fix (1) overflow/signed confusion when reading large-valued storage entries; (2) adjust test fixture validity for GeneralStateTests; (3) remove incorrect usage of state trie for code (not codehash) storage; add ability to display state; (4) avoid double-hashing keys for already-hashed SecureHexaryTrie for storage; (5) add intentionally local workaround for empty code in GeneralStateTest fixtures lacking 0x prefix; (6) fix nonce parsing, which is always hex string in test fixtures 2018-09-04 17:55:30 +03:00
coffeepots bda219f8fe Make tests green (AccountNonce) 2018-09-02 03:26:22 +01:00
Jacek Sieka db202dc35f
replace logging module with nim-chronicles (fixes #38)
This blindly changes logging to nim-chronicles - issues that ensue:

* keeps gas cost computation logs hidden behind flag
* unclear if logScope is practical - for example, since vm is split over
many files, topics get lost when using simple top-level per-module
topics
* when passing named object around, scope should incliude the name of
the object but this is caught neither by logScope nor by dynamicLogScope
2018-08-29 16:13:03 -06:00
Yuriy Glukhov e3be8ca30a Separate Chain from ChainDB 2018-08-29 11:49:01 +03:00
coffeepots fd7062fecb Fix VMTest message creation in 32 bits, also duplicated word in comment 2018-08-17 17:16:40 +03:00
coffeepots 5cd81ef3ac Update doAssert to display the correct contents of stint values 2018-08-17 17:16:40 +03:00
coffeepots 1bf432fd46 Fix for VMTest parseHex in 32 bit 2018-08-17 17:16:40 +03:00
Dustin Brody a12b0771d6 remove superflous when true block, retained from when VMTests wasn't passing 2018-08-16 16:07:45 -04:00
coffeepots fb185b7965 Update RPC signatures 2018-08-13 19:26:34 +01:00
coffeepots 0b5d8d53be Added EthHashStr tests 2018-08-13 19:03:09 +01:00
coffeepots d1f283b004 Updated test_rpc to use EthAddressStr 2018-08-13 17:34:54 +01:00
coffeepots 6aab8b05c5 Included tests for EthAddressStr 2018-08-13 17:34:14 +01:00
Dustin Brody 3c0d27021e
remove callcreates-handling code in VMTests harness (#102)
(1) callcreates, empirically, is always missing or empty in VMTests
(2) by policy, callcreates will not be in new VMTests
(3) the code was broken regardless, in a couple of since-removed VMTests which had non-empty callcreates
2018-08-09 21:58:51 +00:00
coffeepots ac2de74d8f Standardised test between data and quantity, added tests for "0x" 2018-08-09 13:50:49 +03:00
coffeepots a0833475d4 Rename test suite 2018-08-09 13:50:49 +03:00
coffeepots a48e1e96c5 Rename test suite 2018-08-09 13:50:49 +03:00
coffeepots f3ccd72f91 Remove redundant account creation, already done in mutateStateDb 2018-08-09 13:50:49 +03:00
coffeepots 155457d47f Basic eth node setup for RPC testing (WIP) 2018-08-09 13:50:49 +03:00
coffeepots c5514155ee Add tests for JSON RPC hex strings 2018-08-09 13:50:49 +03:00
coffeepots 79abeafa41 Setup test rpc server, initial call to eth_getBalance 2018-08-09 13:50:49 +03:00
Dustin Brody 7fd2fa6184 Run VMTests as part of nimble tests, as well as Appveyor and Travis CI 2018-08-07 13:15:56 -07:00
Dustin Brody 21fcaeb8ef add inexpensive vmPerformanceTests, especially Ackermann and Fibonacci tests; whole suite still runs in a few seconds 2018-08-07 12:24:37 -07:00
Dustin Brody ea2f3b71bf
Complete VM Test sync, with EXP(0, 0) defined as 1 now (#98) 2018-08-07 18:41:01 +00:00
Yuriy Glukhov 467a9c3d7a
Merge pull request #93 from status-im/genesis
Added genesis initialization
2018-08-06 18:02:39 +03:00
Dustin Brody 6a3fa4cb22
Merge pull request #94 from status-im/FixLog3Log4CallDataCopyRandomTestFixtures
fix assorted test fixtures which have been un-skipped
2018-08-03 21:07:36 +00:00
Dustin Brody e2dd3ae051 Import current official GeneralStateTests 2018-08-03 13:18:04 -07:00
Dustin Brody 71679d6d95 fix assorted test fixtures which have been un-skipped 2018-08-02 15:57:28 -07:00
Dustin Brody 8325b6461f Stop skipping all but time-intensive vmPerformance VMTests by default 2018-08-02 09:37:16 -07:00
Dustin Brody d94dfbdb43 following https://github.com/ethereum/tests/pull/444 synchronize with upstream test changes by removing many which rely on mocking BLOCKHASH/BALANCE just for VM tests (#92) 2018-08-02 14:21:42 +02:00
Yuriy Glukhov c4f4a37d2c Added genesis initialization 2018-08-01 15:50:44 +03:00
Dustin Brody 1b781aefe9 pursuant to discussion in https://github.com/ethereum/tests/pull/444 refactor tests to not require special-cased codepaths for a VMTest mode by allowing BLOCKHASH-dependent tests to live where actual blockchain state is provided by fixture 2018-07-31 17:09:37 -07:00
Dustin Brody 1921f9b389 arith.json, boolean.json, and mktx.json test fixtures don't provide useful information (#90) 2018-07-30 17:29:13 +02:00
Yuriy Glukhov 84515b78a9 Align DB backend interfaces with eth_trie. Init BaseChainDB in nimbus. 2018-07-30 16:05:32 +03:00
cheatfate d40638af8c Let Appveyor testing again.
Fix test_storage_backends.nim for Windows.
2018-07-28 12:42:40 +03:00
Dustin Brody 90165f4f6b Ethereum test fixtures provide storage values as hex literals (e.g., 0x04), not decimal literals 2018-07-25 09:31:57 -07:00
Yuriy Glukhov b2acf3a5e3 GasMeter is an object now (#73) 2018-07-18 14:18:17 +02:00
Yuriy Glukhov 601db4d9f3 Fixed a few more tests (#70)
* Fixed getting reading balance from the test fixtures

* Fixed sha3 opcode
2018-07-17 10:57:13 +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
zah 18b7bbb3b0 Implemented most of the stubbed-out state handling instructions (#59)
Merge note: currently cannot compile due to `quasiBoolean` (#63). This will be solved by https://github.com/status-im/nimbus/pull/65
----

* Implemented most of the stubbed out state handling instructions

The code compiles, but still fails at the moment due to incorrect

initialization of the VM. Don't merge yet. More commits will be
pushed in the coming days.

* Fixed crash

* trie put and del are void now

* getBlockTransactionData and getReceipts

* Working code for extcodesize0.json

* fix origin.json

* fix calldatasize1

* fix calldataloadSizeTooHighPartial

* fix calldataloadSizeTooHigh

* more efficient PushX implementation

* fix and, or, xor
2018-07-05 14:41:01 +02:00
Zahary Karadjov 3060452d96 review changes
* `usedBytes` was not named appropriately. it indicates the last
  populated position in the data (the last valid index) for slicing
  purposes (i.e. the position is passed to `toOpenArray`)

* Fixed the `==` operator for DBKeys

* Use one-byte key for the 'canonical head hash'
2018-06-26 13:46:54 +03:00
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