nimbus-eth1/tests
Adam Spitz e040e2671a
Added basic async capabilities for vm2. (#1260)
* Added basic async capabilities for vm2.

This is a whole new Git branch, not the same one as last time
(https://github.com/status-im/nimbus-eth1/pull/1250) - there wasn't
much worth salvaging. Main differences:

I didn't do the "each opcode has to specify an async handler" junk
that I put in last time. Instead, in oph_memory.nim you can see
sloadOp calling asyncChainTo and passing in an async operation.
That async operation is then run by the execCallOrCreate (or
asyncExecCallOrCreate) code in interpreter_dispatch.nim.

In the test code, the (previously existing) macro called "assembler"
now allows you to add a section called "initialStorage", specifying
fake data to be used by the EVM computation run by that test. (In
the long run we'll obviously want to write tests that for-real use
the JSON-RPC API to asynchronously fetch data; for now, this was
just an expedient way to write a basic unit test that exercises the
async-EVM code pathway.)

There's also a new macro called "concurrentAssemblers" that allows
you to write a test that runs multiple assemblers concurrently (and
then waits for them all to finish). There's one example test using
this, in test_op_memory_lazy.nim, though you can't actually see it
doing so unless you uncomment some echo statements in
async_operations.nim (in which case you can see the two concurrently
running EVM computations each printing out what they're doing, and
you'll see that they interleave).

A question: is it possible to make EVMC work asynchronously? (For
now, this code compiles and "make test" passes even if ENABLE_EVMC
is turned on, but it doesn't actually work asynchronously, it just
falls back on doing the usual synchronous EVMC thing. See
FIXME-asyncAndEvmc.)

* Moved the AsyncOperationFactory to the BaseVMState object.

* Made the AsyncOperationFactory into a table of fn pointers.

Also ditched the plain-data Vm2AsyncOperation type; it wasn't
really serving much purpose. Instead, the pendingAsyncOperation
field directly contains the Future.

* Removed the hasStorage idea.

It's not the right solution to the "how do we know whether we
still need to fetch the storage value or not?" problem. I
haven't implemented the right solution yet, but at least
we're better off not putting in a wrong one.

* Added/modified/removed some comments.

(Based on feedback on the PR.)

* Removed the waitFor from execCallOrCreate.

There was some back-and-forth in the PR regarding whether nested
waitFor calls are acceptable:

https://github.com/status-im/nimbus-eth1/pull/1260#discussion_r998587449

The eventual decision was to just change the waitFor to a doAssert
(since we probably won't want this extra functionality when running
synchronously anyway) to make sure that the Future is already
finished.
2022-11-01 11:35:46 -04:00
..
amphora Migrate to Engine API spec version v1.0.0-alpha.5; More progress towards working M1 2022-01-25 12:52:50 +02:00
bootstrap config: fix new config based on input from jamie and zahary 2021-09-18 17:34:51 +07:00
customgenesis add beacon sync skeleton test 2022-09-17 09:08:55 +07:00
db move rocksdb support to eth1 (#927) 2022-04-06 07:28:19 +02:00
fixtures bump eth/tests fixtures 2022-10-19 09:51:18 +07:00
graphql Activate wire protocol eth/66 (#993) 2022-03-21 17:12:07 +00:00
keystore implement more eth rpc and keystore management 2020-07-23 14:54:32 +07:00
merge reenable testEngineAPI in test_merge 2022-03-17 12:54:04 +07:00
replay Prep for full sync after snap make 4 (#1282) 2022-10-27 14:49:28 +01:00
rpcclient Add eth_chainId rpc to Nimbus and Fluffy (#1219) 2022-09-10 15:05:32 +02:00
test_clique Bump nim-eth and remove all now unneeded p2p related imports (#1273) 2022-10-20 10:34:59 +02:00
test_jwt_auth Enable JWT authentication for websockets (#1039) 2022-04-06 15:11:13 +01:00
test_sync_snap Bump nim-eth and remove all now unneeded p2p related imports (#1273) 2022-10-20 10:34:59 +02:00
test_txpool Update snap offline tests (#1199) 2022-08-24 14:44:18 +01:00
README.md integrate GeneralStateTest runner into CI with 775 running tests (#153) 2018-09-19 16:46:14 +00:00
all_tests.nim Clique snapshots reorg (#1169) 2022-07-21 19:16:28 +01:00
asynctest.nim replace all unittest usage with unittest2 2021-06-21 20:30:01 +07:00
evm_tests.nim Added basic async capabilities for vm2. (#1260) 2022-11-01 11:35:46 -04:00
macro_assembler.nim Added basic async capabilities for vm2. (#1260) 2022-11-01 11:35:46 -04:00
nim.cfg unittest2 (parallelism disabled) 2019-10-31 06:17:01 +01:00
persistBlockTestGen.nim fix markCanonicalChain bug 2022-07-04 19:32:14 +07:00
test_accounts_cache.nim Bump nim-eth and remove all now unneeded p2p related imports (#1273) 2022-10-20 10:34:59 +02:00
test_allowed_to_fail.nim Tests: Add loopMul.json and loopExp.json to skipped, slow tests 2021-08-03 15:03:05 +01:00
test_block_fixture.nim eth: adapt to smaller eth_types (#1210) 2022-09-03 20:15:35 +02:00
test_blockchain_json.nim add gray glacier difficulty calculator 2022-10-19 09:51:27 +07:00
test_clique.nim Update snap offline tests (#1199) 2022-08-24 14:44:18 +01:00
test_code_stream.nim merge vm_memory, vm_interpreter, and vm_utils_numeric => vm_internals 2021-03-31 18:15:27 +01:00
test_config.nim EVM: Remove `vm_types2` everywhere, use common forks list instead 2021-06-08 15:36:31 +01:00
test_configuration.nim Bump nim-eth and remove all now unneeded p2p related imports (#1273) 2022-10-20 10:34:59 +02:00
test_custom_network.nim Bump nim-eth and remove all now unneeded p2p related imports (#1273) 2022-10-20 10:34:59 +02:00
test_difficulty.nim config: fix new config based on input from jamie and zahary 2021-09-18 17:34:51 +07:00
test_filters.nim Add getLogs implementation (#1143) 2022-06-29 17:44:08 +02:00
test_forkid.nim add gray glacier difficulty calculator 2022-10-19 09:51:27 +07:00
test_gas_meter.nim merge vm_memory, vm_interpreter, and vm_utils_numeric => vm_internals 2021-03-31 18:15:27 +01:00
test_generalstate_json.nim reduce imported but not used warning when evmc enabled 2022-10-03 16:41:33 +07:00
test_genesis.nim eth: adapt to smaller eth_types (#1210) 2022-09-03 20:15:35 +02:00
test_graphql.nim add gray glacier difficulty calculator 2022-10-19 09:51:27 +07:00
test_helpers.nim initial wire protocol transformation 2022-10-15 19:48:21 +07:00
test_jwt_auth.nim apply jwt auth to rpcHttpServer and update jwt auth of rpcWebsocketServer 2022-07-18 16:56:44 +07:00
test_keyed_queue_rlp.nim update ec_recover 2022-01-22 08:26:57 +02:00
test_memory.nim merge vm_memory, vm_interpreter, and vm_utils_numeric => vm_internals 2021-03-31 18:15:27 +01:00
test_merge.nim initial wire protocol transformation 2022-10-15 19:48:21 +07:00
test_misc.nim config: replace stdlib parseOpt with nim-confutils 2021-09-18 17:34:46 +07:00
test_op_arith.nim make macro_assembler to use the same testEvmCall 2021-10-14 15:10:12 +07:00
test_op_bit.nim make macro_assembler to use the same testEvmCall 2021-10-14 15:10:12 +07:00
test_op_custom.nim make macro_assembler to use the same testEvmCall 2021-10-14 15:10:12 +07:00
test_op_env.nim fix EVM stack.[] bug 2022-05-25 12:04:47 +07:00
test_op_memory.nim make macro_assembler to use the same testEvmCall 2021-10-14 15:10:12 +07:00
test_op_memory_lazy.nim Added basic async capabilities for vm2. (#1260) 2022-11-01 11:35:46 -04:00
test_op_misc.nim make macro_assembler to use the same testEvmCall 2021-10-14 15:10:12 +07:00
test_persistblock_json.nim fix markCanonicalChain bug 2022-07-04 19:32:14 +07:00
test_pow.nim Exported blobs and some scripts to parallel project nimbus-eth1-blobs (#995) 2022-03-16 09:13:17 +00:00
test_precompiles.nim first step into styleCheck fixes 2022-04-14 08:39:50 +07:00
test_rpc.nim initial wire protocol transformation 2022-10-15 19:48:21 +07:00
test_skeleton.nim add beacon sync skeleton test 2022-09-17 09:08:55 +07:00
test_stack.nim first step into styleCheck fixes 2022-04-14 08:39:50 +07:00
test_state_db.nim eth: adapt to smaller eth_types (#1210) 2022-09-03 20:15:35 +02:00
test_sync_snap.nim Prep for full sync after snap make 4 (#1282) 2022-10-27 14:49:28 +01:00
test_tools_build.nim bump nim eth 2022-08-22 20:11:36 +07:00
test_tracer_json.nim reduce unused import warnings 2020-04-15 19:05:57 +07:00
test_transaction_json.nim fixes test codes to deal with eth_tests submodule 2021-01-06 17:02:19 +07:00
test_txpool.nim Jordan/remove unit tests txpool legacy stuff (#1048) 2022-04-08 15:05:30 +01:00
test_txpool2.nim eth: adapt to smaller eth_types (#1210) 2022-09-03 20:15:35 +02:00
test_wire_protocol.nim initial wire protocol transformation 2022-10-15 19:48:21 +07:00
tracerTestGen.nim first step into styleCheck fixes 2022-04-14 08:39:50 +07:00

README.md

tests

TODO: more GeneralStateTest fixtures!