Commit Graph

58 Commits

Author SHA1 Message Date
Jordan Hrycaj bced43c339
test environment for studying crash of hexary trie (#938)
* test environment for studying crash of hexary trie

why:
  the persistent test case will crash unless in genesis.toBlock():
  + pruneTrie is set false, or
  + the directive "tdb.put(emptyRlpHash.data,emptyRlp)" is added right
    before the "for k, v in account.storage:" loop

* different tests for OS variants
2022-01-26 11:56:53 +00:00
Jordan Hrycaj 103656dbb5 TxPool implementation
details:
  For documentation, see comments in the file tx_pool.nim.

  For prettified manual pages run 'make docs' in the nimbus directory and
  point your web browser to the newly created 'docs' directory.
2022-01-22 08:26:57 +02:00
Jordan Hrycaj 9545767c53 update ec_recover
why:
  Previous version was based on lru_cache which is ugly. This module is
  based on the stew/keyed_queue library module.

other:
  There are still some other modules rely on lru_cache which should be
  removed.
2022-01-22 08:26:57 +02:00
Jordan Hrycaj 1f774c01a2
Jordan/accounts cache scenario (#904)
* crash test scenario

details:
  Example code for inspecting nested block chain and accounts cache
  database transaction framework. There seems to be a pathological
  case where the system crashes after a rollback (as appeared in the
  tx-pool packer code.)

* simplified crash scenario

* Workable solution (as suggested by Andri)

details:
  Avoiding db.rollback() (db.commit() is OK) while vmState.stateDB is
  alive.

* Rename text_txcrash => test_accounts_cache

why:
  Unit tests covers part of accounts_cache handling

* comment update
2021-12-13 11:58:05 +00:00
Jordan Hrycaj 55f7a4425f
Jordan/pow cache management (#888)
* PoW wrapper for verification & mining

why:
  It eases data management of per-Epoch lookup tables. Also some unit
  tests show limits of usefulness on non-specialised machines for
  mining besides developing tests.

details:
  For PoW verification, this patch provides a pretty wrapper hiding the
  details of the ethash/Hashimoto lookup cache management.

  For mining on my development system without special hardware, the
  underlying ethash functions are prohibitively slow. It takes
   * ~20 minutes to prepare the full ethash/Hashimoto lookup dataset
   * a second to run ~25k nonce tests (in the mining loop)

  The mining part might be of some use for generating test data for
  the tx-pool, though.

* Using PowRef as replacement for EpochHashCache + hashimotoLight()

* Fix typo (CI failed)

why:
  was below log level when testing locally

* fix canonical naming
2021-12-10 08:49:57 +00:00
jangko 69f2a0f95a
config: replace stdlib parseOpt with nim-confutils
fixes #581
2021-09-18 17:34:46 +07:00
KonradStaniec a59a2c61b6
[FEATURE] Add support for handling experimental api call (#746)
* [FEATURE] Add support for handling experimental api call
2021-07-07 11:04:18 +02:00
jangko 2269d16c4c
reintegrate test_rpc back into all_tests
for a long time, test_rpc will crash all_tests
if they are combined together. but now it works fine
2021-06-22 08:32:32 +07:00
Jordan Hrycaj 61e460c125 Most snapshot unit tests work
details:
  three test cases still fail which are skipped
  test suite is linked to all_tests list
2021-06-17 08:03:57 +01:00
Jordan Hrycaj b83b47e541 LRU cache tests makeover
why:
  source-local unit tests would hardly be triggered by github CI as rightly
  criticised with the last patch.

details:
  source-local unit tests have been moved to tests folder.

  this version also contains rlp serialisation code so rlp encode/decode
  will apply tranparently. this is not needed in p2p/validate but will be
   useful with the clique protocol.
2021-05-26 07:58:12 +01:00
jangko 43bc010c9c
remove test_vm_json
reason:
- they already covered by test_blockchain_json
  and test_generalstate_json.
- new ethereum/tests already remove them,
  nothing to tests anymore
2021-05-17 11:14:34 +07:00
Jordan Hrycaj 59d7ba1f1e print compiler warning about the VM used
why:
  handy to have confirmation about which of the three different VMs
  is activated
2021-04-28 15:24:14 +03:00
jangko a95cec3aa8
add graphql test suite 2021-04-24 11:01:56 +07:00
jangko 97f73fd03d
implement EIP 2046 2020-11-19 14:23:07 +07:00
jangko 165f9fea2e
reduce warnings 2020-07-21 13:15:06 +07:00
jangko e37cacd8f1
implement forkid calculation and tests for each supported network 2020-07-04 13:23:09 +07:00
jangko 7c0d24a648
add instruction comment for test_fuzz 2020-05-20 12:41:05 +07:00
jangko 9d101948ab
use 'const' instead of 'let' for module names in all_tests 2020-05-20 11:43:46 +07:00
jangko 048c8a41f1
all_tests now print the name of failed module instead of only index number 2020-05-20 11:35:27 +07:00
andri lim 758ebabd87
working test_witness_json prototype 2020-05-08 12:16:24 +07:00
andri lim 9c999ffa9c
enable block witness test 2020-05-05 20:46:17 +07:00
andri lim 9596dbc267 activates blockchain test 2019-12-10 12:34:48 +02:00
Ștefan Talpalaru d84e4810d5
unittest2 (parallelism disabled)
This is https://github.com/status-im/nimbus/pull/332 with parallelism
disabled, while some threadpool deadlock is being debugged.
2019-10-31 06:17:01 +01:00
andri lim a45792cede
add diagnostic message to all_tests.nim 2019-10-28 22:21:40 +07:00
andri lim b3a7adcedd
fixes #404 2019-10-17 15:30:15 +07:00
andri lim 578c2bd857
improve cliBuilder macro readability 2019-09-24 10:29:41 +07:00
andri lim d2d5661e11
fix comment 2019-09-22 16:57:19 +07:00
andri lim 321f13dc19
attempt to add simple cli to all_tests 2019-09-21 12:45:23 +07:00
andri lim 230fb4b06d
activates test 2019-08-29 19:57:01 +07:00
andri lim 1d9760eb66
activates difficulty_test 2019-08-26 21:40:27 +07:00
andri lim ccd8835b4d
fixes and activates test for 'calldataload' 2019-08-20 17:11:17 +07:00
andri lim b2bf979c57 remove tests/test_opcode.nim 2019-08-13 17:48:56 +03: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 fa183e3a31 separate test_rpc from all_tests 2019-02-20 15:16:07 +02:00
andri lim 4cc0ef427c add ccountExist and isDeadAccount to AccountStateDB 2019-02-06 18:42:03 +01:00
andri lim 58b5aa5f39 implement macro_assembler and opcodes test suite 2019-01-31 20:16:47 +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
andri lim 3a10f99694 add persistblock test 2019-01-06 11:43:38 +02:00
andri lim 9db4e9296a add tracer test 2019-01-06 11:43:38 +02:00
mratsim 4d07d99f66 Add precompiles to all tests to prevent regressions 2018-12-04 16:32:11 +01: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
Yuriy Glukhov 62260c786d Caching DB backend 2018-09-12 17:53:15 +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
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
Yuriy Glukhov c4f4a37d2c Added genesis initialization 2018-08-01 15:50:44 +03: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 583c72fa54 Implement storage backends using RocksDB and SQLite 2018-06-26 13:46:54 +03: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