* adds a new overload of queryPastEvents allowing to query past events based on timestamp in the past
* adds state restoration to validator
* refactors a bit to get the tests back to work
* replaces deprecated generic methods from Market with methods for specific event types
* Refactors binary search
* adds market tests for querying past SlotFilled events and binary search
* Takes into account that <<earliest>> block available is not necessarily the genesis block
* Adds more logging and makes testing earliest block boundary more reliable
* adds validation tests for historical state restoration
* adds mockprovider to simplify and improve testing of the edge conditions
* adds slot reservation to the new tests after rebasing
* adds validation groups and group index in logs of validator
* adds integration test with two validators
* adds comment on how to enable logging in integration test executable itself
* testIntegration: makes list is running nodes injected and available in the body of the test
* validation: adds integration test for historical state
* adds more logging to validator
* integration test: validator only looks 30 days back for historical state
* adds logging of the slotState when removing slots during validation
* review and refactor validator integration tests
* adds validation to the set of integration tests
* Fixes mistyped name of the mock provider module in testMarket
* Fixes a typo in the name of the validation suite in integration tests
* Makes validation unit test a bit easier to follow
* better use of logScopes to reduce duplication
* improves timing and clarifies the test conditions
* uses http as default RPC provider for nodes running in integration tests as a workaround for dropped subscriptions
* simplifies the validation integration tests by waiting for failed request instead of tracking slots
* adds config option allowing selectively to set different provider url
* Brings back the default settings for RPC provider in integration tests
* use http RPC provider for clients in validation integration tests
* fine-tune the tests
* Makes validator integration test more robust - adds extra tracking
* brings tracking of marketplace event back to validator integration test
* refactors integration tests
* deletes tmp file
* adds <<return>> after forcing integration test to fail preliminarily
* re-enables all integration tests and matrix
* stops debug output in CI
* allows to choose a different RPC provider for a given integration test suite
* fixes signature of <<getBlock>> method in mockProvider
* adds missing import which seem to be braking integration tests on windows
* makes sure that clients, SPs, and validators use the same provider url
* makes validator integration tests using http at 127.0.0.1:8545
* testvalidator: stop resubscribing as we are now using http polling as rpc provider
* applying review comments
* groups queryPastStorage overrides together (review comment)
* groups the historical validation tests into a sub suite
* removes the temporary extensions in marketplacesuite and multinodesuite allowing to specify provider url
* simplifies validation integration tests
* Removes debug logs when waiting for request to fail
* Renaming waitForRequestFailed => waitForRequestToFail
* renames blockNumberForBlocksAgo to pastBlockTag and makes it private
* removes redundant debugging logs
* refines logging in validation
* removes dev logging from mockmarket
* improves exception handling in provider helper procs and prepares for extraction to a separate module
* Uses chronos instead of std/times for Duration
* extracts provider and binary search helpers to a separate module
* removes redundant log entry params from validator
* unifies the notation to consistently use method call syntax
* reuses ProviderError from nim-ethers in the provider extension
* clarifies the comment in multinodesuite
* uses == operator to check the predefined tags and raises exception when `BlockTag.pending` is requested.
* when waiting for request to fail, we break on any request state that is not Started
* removes tests that were moved to testProvider from testMarket
* extracts tests that use MockProvider to a separate async suite
* improves performance of the historical state restoration
* removing redundant log messages in validator (groupIndex and groups)
* adds testProvider to testContracts group
* removes unused import in testMarket
* Use http subscriptions instead of websocket for tests
To work around this issue when subscriptions are
inactive for more than 5 minutes:
https://github.com/NomicFoundation/hardhat/issues/2053
Use 100 millisecond polling; default polling interval
of 4 seconds is too close to the 5 second timeout for
`check eventually`.
* use .confirm(1) instead of confirm(0)
confirm(0) doesn't wait at all, confirm(1) waits
for the transaction to be mined
* speed up partial payout integration test
* update nim-ethers to version 0.10.0
includes fixes for http polling and .confirm()
* fix timing of marketplace tests
allow for a bit more time to withdraw funds
* use .confirm(1) in marketplace tests
to ensure that the transaction has been processed
before continuing with the test
* fix timing issue in validation unit test
* fix proof integration test
there were two logic errors in this test:
- a slot is freed anyway at the end of the contract
- when starting the request takes a long time, the
first slot can already be freed because there were
too many missing proofs
* fix intermittent error in contract tests
currentTime() doesn't always correctly reflect
the time of the next transaction
* reduce number of slots in integration test
otherwise the windows runner in the CI won't
be able to start the request before it expires
* fix timing in purchasing test
allow for a bit more time for a request to
be submitted
* fix timing of request submission in test
windows ci is so slow, it can take up to 40 seconds
just to submit a storage request to hardhat
* increase proof period to 90 seconds
* adjust timing of integration tests
reason: with the increased period length of 90 seconds, it
can take longer to wait for a stable challenge at the
beginning of a period.
* increase CI timeout to 2 hours
* Fix slow builds on windows
apparently it takes windows 2-3 seconds to
resolve "localhost" to 127.0.0.1 for every
json-rpc connection that we make 🤦
* integration: move REST API tests into their own module
* integration: move upload and download tests into their own module
* integration: move purchasing tests into their own module
* integration: move marketplace tests to the right module
* integration: mine a block *after* starting nodes
To ensure that tests involving multiple nodes do
not start with out-of-sync clocks
* Fix: do not swallow CancellationErrors
* integration: avoid underflow in UInt256
* network: remove unnecessary error handling
No Exceptions can occur, only Defects, because everything
is asyncSpawned.
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
* network: do not raise in asyncSpawned proc
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
---------
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
* rework cli to accept circuit params
* check circom files extension
* adding new required cli changes
* don't use ufcs
* persistence is a command now
* use `nimOldCaseObjects` switch for nim confutils compat
* misc
* Update cli integration tests
* Fix: simulateProofFailures option is not for validator
* moving circom params under `prover` command
* update tests
* Use circuit assets from codex-contract-eth in tests
* Add "prover" cli command to tests
* use correct stores
* make `verifier` a cmd option
* update circuit artifacts path
* fix cli tests
* Update integration tests to use cli commands
Integration tests have been updated to use the new cli commands. The api for usage in the integration tests has also changed a bit.
Proofs tests have been updated to use 5 nodes and 8 blocks of data. The remaining integration tests also need to be updated.
* remove parsedCli from CodexConfig
Instead, parse the cli args on the fly when needed
* remove unneeded gcsafes
* graceful shutdowns
Where possible, do not raise assert, as other nodes in the test may already be running. Instead, raise exceptions, catch them in multinodes.nim, and attempt to do a teardown before failing the test.
`abortOnError` is set to true so that `fail()` will quit immediately, after teardown has been run.
* update testmarketplace to new api, with valid EC params
---------
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
* Update codex-contracts-eth
* contracts: update G2Point definition
* integration: disable automatic advancing of time
reason: makes reasoning about timing in tests harder,
because the period is set to 60 seconds in the
marketplace configuration, but this code switches to
a new period every 500 milliseconds
* integration: fix parameters of marketplace payouts test
* integration: update test settings
* integration: fix typo
* integration: workaround for hardhat issue
Subscriptions expire after 5 minutes when using
websockets. Use http and polling instead.
* integration: remove origDatasetSizeInBlocks
* integration: fix proof parameters for test
* integration: do not log output by default
* integration: fix failure rate in test
* integration: fix warning
* integration: include clock in logs
* integration: allow for more periods
5 periods was cutting it close, if we get too much
pointer downtime, then the test would fail
* market: use `pending` blocktag when querying onchain state
* clock: use wall clock in integration tests
reason: we'll need to wait for the next period in
integration tests, and we can't do that if the
time doesn't advance
* clock: remove unused field
* integration: use pending block time to get current time
* clock: fix on-chain clock for hardhat
Only use 'latest' block for updates
Only update the first time you see a block
* integration: do not start tests with a very outdated block
* integration: allow for longer expiry period
* refactor multi node test suite
Refactor the multinode test suite into the marketplace test suite.
- Arbitrary number of nodes can be started with each test: clients, providers, validators
- Hardhat can also be started locally with each test, usually for the purpose of saving and inspecting its log file.
- Log files for all nodes can be persisted on disk, with configuration at the test-level
- Log files, if persisted (as specified in the test), will be persisted to a CI artifact
- Node config is specified at the test-level instead of the suite-level
- Node/Hardhat process starting/stopping is now async, and runs much faster
- Per-node config includes:
- simulating proof failures
- logging to file
- log level
- log topics
- storage quota
- debug (print logs to stdout)
- Tests find next available ports when starting nodes, as closing ports on Windows can lag
- Hardhat is no longer required to be running prior to starting the integration tests (as long as Hardhat is configured to run in the tests).
- If Hardhat is already running, a snapshot will be taken and reverted before and after each test, respectively.
- If Hardhat is not already running and configured to run at the test-level, a Hardhat process will be spawned and torn down before and after each test, respectively.
* additional logging for debug purposes
* address PR feedback
- fix spelling
- revert change from catching ProviderError to SignerError -- this should be handled more consistently in the Market abstraction, and will be handled in another PR.
- remove method label from raiseAssert
- remove unused import
* Use API instead of command exec to test for free port
Use chronos `createStreamServer` API to test for free port by binding localhost address and port. Use `ServerFlags.ReuseAddr` to enable reuse of same IP/Port on multiple test runs.
* clean up
* remove upraises annotations from tests
* Update tests to work with updated erasure coding slot sizes
* update dataset size, nodes, tolerance to match valid ec params
Integration tests now have valid dataset sizes (blocks), tolerances, and number of nodes, to work with valid ec params. These values are validated when requested storage.
Print the rest api failure message (via doAssert) when a rest api call fails (eg the rest api may validate some ec params).
All integration tests pass when the async `clock.now` changes are reverted.
* dont use async clock for now
* fix workflow
* move integration logs uplod to reusable
---------
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>