* update nim-ethers to version 2.0.0
To allow for gas estimation of contract calls
* contracts: add 10% extra gas to contract calls
These calls could otherwise run out of gas because
the on-chain state may have changed between the time
of the estimate and the time of processing the
transaction.
* makes sure we do not call "get" on unverified result
* make handling of failed blocks in fetchBatched even more explicit
* simplifies allFinishedValues and makes it independent from allFinishedFailed
* only sleep if not iter.finished in fetchBatched
* Catch Marketplace_SlotIsFree and continue the cancelled process
* Add log message when the slot if free during failed state
* Reduce log level to debug for slot free error
* Separate slot mock errors
* Initialize variable in setyp
* Improve tests
* Remove non-meaningful checks and rename test
* Remove the Option in the error setters
* Return collateral when the state is cancelled only if the slot is filled by the host
* Do not propagate AsyncLockError
* Wrap contract error into specific error type
* Remove debug message
* Catch only SlotStateMismatchError in cancelled
* Fix error
* Remove returnBytesWas
* Use MarketError after raises pragma were defined
* Fix typo
* Fix lint
* Add availability enabled parameter
* Return bytes to availability when finished
* Add until parameter
* Remove debug message
* Clean up and fix tests
* Update documentations and cleanup
* Avoid swallowing CancelledError
* Move until validation to reservations module
* Call onAvailabilityAdded callabck when the availability is enabled in sales
* Remove until validation in restapi when creating an availability
* Add openapi documentation
* Use results instead of stew/results (#1112)
* feat: request duration limit (#1057)
* feat: request duration limit
* Fix tests and duration type
* Add custom error
* Remove merge issue
* Update codex contracts eth
* Update market config and fix test
* Fix SlotReservationsConfig syntax
* Update dependencies
* test: remove doubled test
* chore: update contracts repo
---------
Co-authored-by: Arnaud <arnaud@status.im>
* fix(statemachine): do not raise from state.run (#1115)
* fix(statemachine): do not raise from state.run
* fix rebase
* fix exception handling in SaleProvingSimulated.prove
- re-raise CancelledError
- don't return State on CatchableError
- expect the Proofs_InvalidProof custom error instead of checking a string
* asyncSpawn salesagent.onCancelled
This was swallowing a KeyError in one of the tests (fixed in the previous commit)
* remove error handling states in asyncstatemachine
* revert unneeded changes
* formatting
* PR feedback, logging updates
* chore(integration): simplify block expiration integration test (#1100)
* chore(integration): simplify block expiration integration test
* clean up
* fix after rebase
* perf: contract storage optimizations (#1094)
* perf: contract storage optimizations
* Apply optimization changes
* Apply optimizing parameters sizing
* Update codex-contracts-eth
* bump latest changes in contracts branch
* Change requestDurationLimit to uint64
* fix tests
* fix tests
---------
Co-authored-by: Arnaud <arnaud@status.im>
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
* bump contracts to master (#1122)
* Add availability enabled parameter
* Return bytes to availability when finished
* Add until parameter
* Clean up and fix tests
* Move until validation to reservations module
* Apply suggestion changes: return the reservation module error
* Apply suggestion changes for until dates
* Apply suggestion changes: reorganize tests
* Fix indent
* Remove test related to timing issue
* Add raises errors to async pragram and remove useless try except
* Update open api documentation
* Fix wording
* Remove the httpClient restart statements
* Use market.getRequestEnd to set validUntil
* Remove returnBytes
* Use clock.now in testing
* Move the api validation file to the right file
---------
Co-authored-by: Adam Uhlíř <adam@uhlir.dev>
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
* Use 422 http code when there is a validation error
* Update the open api description
* Fix typo
* Add more tests for total size
* Catch CancelledError because TrackedFuture raise no error
* Split rest api validation test to a new file
* Change the way of testing negative numbers
* Rename client variable and fix test status code
* Try to reduce the number of requests in CI when asserting in tests
* Fix rebase and remove safeEventually
* Add request validations
* Define expiry as required field in storage request params and fix tests
* Fix error messages
* Enable logs to figure out the issue with recurring failing test on macos
* Add custom errors raised by contract
* Remove custom error non existing anymore
* Update asynctest module
* Update timer tests after updating asynctest
* Add missing custom errors
* Separate mock state errors
* Remove the Option in the error setters
* Wrap the contract errors in MarketError
* Remove async raises (needs to address it in another PR)
* Wrap contract errors into specific error types
* Rename SlotNotFreeError to SlotStateMismatchError
* WiP: migrating CodexClient to chronos http client
* fix(api): fixes#1163
* feat: fully working API integration tests
* convert most of the tests in testupdownload
* feat: working updownload tests on async client
* feat: make testsales work with async codexclient
* feat: make testpurchasing work with async codexclient
* feat: make testblockexpiration work with async codexclient
* feat: make marketplacesuite work with async codexclient
* make testproofs work with async codexclient
* chore: refactor client to express higher level in terms of lower level operations
* fix: set correct content-length for erasure-coded datasets
* feat: make testecbug work with async client
* feat: make testvalidator work with async client
* refactor: simplify request aliases, add close operation
* wire back client.close at node shutdown
* refactor: remove unused exception
* fix: use await instead of waitFor on async call sites
* cleanup imports and logs
* add BlockHandle type
* revert deps
* refactor: async error handling and future tracking improvements
- Update async procedures to use explicit raises annotation
- Modify TrackedFutures to handle futures with no raised exceptions
- Replace `asyncSpawn` with explicit future tracking
- Update test suites to use `unittest2`
- Standardize error handling across network and async components
- Remove deprecated error handling patterns
This commit introduces a more robust approach to async error handling and future management, improving type safety and reducing potential runtime errors.
* bump nim-serde
* remove asyncSpawn
* rework background downloads and prefetch
* imporove logging
* refactor: enhance async procedures with error handling and raise annotations
* misc cleanup
* misc
* refactor: implement allFinishedFailed to aggregate future results with success and failure tracking
* refactor: update error handling in reader procedures to raise ChunkerError and CancelledError
* refactor: improve error handling in wantListHandler and accountHandler procedures
* refactor: simplify LPStreamReadError creation by consolidating parameters
* refactor: enhance error handling in AsyncStreamWrapper to catch unexpected errors
* refactor: enhance error handling in advertiser and discovery loops to improve resilience
* misc
* refactor: improve code structure and readability
* remove cancellation from addSlotToQueue
* refactor: add assertion for unexpected errors in local store checks
* refactor: prevent tracking of finished futures and improve test assertions
* refactor: improve error handling in local store checks
* remove usage of msgDetail
* feat: add initial implementation of discovery engine and related components
* refactor: improve task scheduling logic by removing unnecessary break statement
* break after scheduling a task
* make taskHandler cancelable
* refactor: update async handlers to raise CancelledError
* refactor(advertiser): streamline error handling and improve task flow in advertise loops
* fix: correct spelling of "divisible" in error messages and comments
* refactor(discovery): simplify discovery task loop and improve error handling
* refactor(engine): filter peers before processing in cancelBlocks procedure
* Call onAvailabilityAdded when freeSize, duration or minPricePerBytePerSecond is increased
* Rename onAvailabilityAdded to onAvailabilitySaved
* Rename OnAvailabilitySaved to OnAvailabilityUpserted
* Go back to OnAvailabilitySaved
* Add headers to support on progress on download
* Replace http session by http client in downloadBytes
* Use int instead of int64 for datasetSize
* Rename variable to avoid shallowing client
* Indicate that slot is being repaired when trying to download
* Fix tests
* Apply nph
* Calculate the repair collateral when adding the item into the queue
* Add slotCollateral calculation with getRequest cache and remove populationItem function
* Update with pricePerByte
* Simplify StorageAsk parameter
* Minor fixes
* Move cache request to another PR
* Rename SlotQueueItem collateral and required in init
* Use override func to optimise calls when the slot state is known
* Remove unused code
* Cosmetic change
* Use raiseMarketError helper
* Add exceptions to async pragma
* Cosmetic change
* Use raiseMarketError helper
* Let slotCollateral determines the slot sate
* Use configSync to avoid async pragma in onStorageRequested
* Add loadConfig function
* Add CatchableError to async pragma
* Add missing pragma raises errors
* Move loadConfig
* Avoid swallow CancelledError
* Avoid swallowing CancelledError
* Avoid swallowing CancelledError
* Update error messages
* Except MarketError instead of CatchableError
* Fix merge issue
* Log fatal when configuration cannot be loaded
* Propagate MarketError in slotCollateral
* Remove useless configSync
* Use result with explicit error
* Fix syntax
---------
Signed-off-by: Arnaud <arnaud@status.im>
* adding basic retry functionality
* avoid duplicate requests and batch them
* fix cancelling blocks
* properly resolve blocks
* minor cleanup - use `self`
* avoid useless asyncSpawn
* track retries
* limit max inflight and set libp2p maxIncomingStreams
* cleanup
* add basic yield in readLoop
* use tuple instead of object
* cleanup imports and logs
* increase defaults
* wip
* fix prefetch batching
* cleanup
* decrease timeouts to speedup tests
* remove outdated test
* add retry tests
* should track retries
* remove useless test
* use correct block address (index was off by 1)
* remove duplicate noop proc
* add BlockHandle type
* Use BlockHandle type
* add fetchLocal to control batching from local store
* add format target
* revert deps
* adjust quotaMaxBytes
* cleanup imports and logs
* revert deps
* cleanup blocks on cancelled
* terminate erasure and prefetch jobs on stream end
* split storing and retrieving data into separate tests
* track `b.discoveryLoop` future
* misc
* remove useless check
* fix(statemachine): do not raise from state.run
* fix rebase
* fix exception handling in SaleProvingSimulated.prove
- re-raise CancelledError
- don't return State on CatchableError
- expect the Proofs_InvalidProof custom error instead of checking a string
* asyncSpawn salesagent.onCancelled
This was swallowing a KeyError in one of the tests (fixed in the previous commit)
* remove error handling states in asyncstatemachine
* revert unneeded changes
* formatting
* PR feedback, logging updates
* chore(deps): bump ethers to propagate cancellations
Ethers was swallowing canellations and turning them into EthersErrors, which was causing the sales statemachine to error when it should have been simply cancelling the current state's run. Hopefully fixes the intermittently failing marketplace integration test.
* Add missing errors in async raises pragma
* bump to version of ethers that supports cancellations
---------
Co-authored-by: Arnaud <arnaud@status.im>
* feat(codex-node): add dataset deletion API to Codex node
* feat(api): add deletion of local datasets to API
* fix: logging, remove garbage, drop some CORS headers from DELETE request
* fix: change empty response return code to 204 instead of 200
* fix: add time-based idling to avoid locking up the node during deletes, fix API status code
* fix: uncomment commented tests committed by accident
* fix: return correct code when missing CID is a Manifest CID; add back CORS headers
* fix: remove lingering echo
* openAPI: StorageRequestCreation: reward => pricePerByte, collateral => collateralPerByte
* purchasing: reward => pricePerByte, collateral => collateralPerByte
* Updates availabilities and reservations to use totalCollateral, minPricePerByte, and maxCollateralPerByte
* Uses correct div operator when operating on UInt256
* proposal updating totalCollateral in availability
* makes sure that reading currentCollateral happens before freeing slot
* Updates naming
* fixes tests: unit and contracts
* uses feat/price-per-byte branch for codex-contracts-eth
* temporarily disables integration tests on CI
* introduces high level <<totalCollateral>> property for a cleaner external interface
* updates integration tests
* Applies review comments
* Updates description of totalCollateral in SalesAvailability
* updates codex-contracts-eth (price-per-byte)
* Move to version 2.0.6
* Update nim-confutils submodule to latest version
* Update dependencies
* Update Nim version to 2.0.12
* Add gcsafe pragma
* Add missing import
* Update specific conf for Nim 2.x
* Fix method signatures
* Revert erasure coding attempt to fix bug
* More gcsafe pragma
* Duplicate code from libp2p because it is not exported anymore
* Fix camelcase function names
* Use alreadySeen because need is not a bool anymore
* newLPStreamReadError does not exist anymore so use another error
* Replace ValidIpAddress by IpAddress
* Add gcsafe pragma
* Restore maintenance parameter deleted by mistake when removing esasure coding fix attempt code
* Update method signatures
* Copy LPStreamReadError code from libp2p which was removed
* Fix camel case
* Fix enums in tests
* Fix camel case
* Extract node components to a variable to make Nim 2 happy
* Update the tests using ValidIpAddress to IpAddress
* Fix cast for value which is already an option
* Set nim version to 2.0.x for CI
* Set nim version to 2.0.x for CI
* Move to miniupnp version 2.2.4 to avoid symlink error
* Set core.symlinks to false for Windows for miniupnp >= 2.2.5 support
* Update to Nim 2.0.14
* Update CI nim versions to 2.0.14
* Try with GCC 14
* Replace apt-fast by apt-get
* Update ubuntu runner to latest
* Use Ubuntu 20.04 for coverage
* Disable CI cache for coverage
* Add coverage property description
* Remove commented test
* Check the node value of seen instead of using alreadySeen
* Fix the merge. The taskpool work was reverted.
* Update nim-ethers submodule
* Remove deprecated ValidIpAddress. Fix missing case and imports.
* Fix a weird issue where nim-confutils cannot find NatAny
* Fix tests and remove useless static keyword
* sends wantBlock to peers with block. wantHave to everyone else
* Cleanup cheapestPeer. Fixes test for peers lists
* Fixes issue where peerWants are only stored for type wantBlock.
* Review comments by Dmitriy
* consistent logging of addresses
* prevents duplicate scheduling. Fixes cancellation
* fast
* Marks cancel-presence situation with todo comment.
* fixtest: testsales enable logging
* Review by Dmitriy: Remember peerWants only if we don't have them.
* rework `wantListHandler` handling
---------
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>