I know this is a big commit…
There are some tests that aren’t testable yet, such as testing that an active state transitions to cancelled/failed states. This is due to the inability to wait during some states like SaleFilling. The tests would likely need to be redesigned, but I don’t think it’s worth pursuing the fully declarative model further as it is too hard to debug.
The declarative state machine DOES work, however.
The main point for keeping this commit is for the learnings about the state machine to bring fwd into the branch used in 306.
- multiple source states allowed in transition removed need for boilerplate subscription handling
TODO:
1. fix compilation for multiple transition source states
2. add tests for:
- no transitioning to self
- multiple source states in transition
3. Check how CancelledError gets caught in future callback
4. Remove Future[?State] from run return type?
- restoring and not restoring state both use the same setup for SalesAgent, by setting the SalesAgent’s state during instantiation, allowing it to react according to its state
- remove returning of next State from run (actual types yet to be changed)
- subscribe to onchain events, and use TransitionProperties to react (TODO: do not react from AnyState, but set to only states that make sense)
- create setError method in asyncstatemachine that handles setting of error properties
- check declared transitions after state change
- make `Event` and `transition` public to enable external usage
- add exported machine.state proc
- add tests for machine.state
- add test TODO for not being able to check exception in run
- add test for checking declarative transitions after state transition
- remove onMoveToNextStateEvent as it was too confusing. Easier to read `Event.transition(state2, state3)`
Heavy work in progress, doesn't even compile yet,
this commit will be replaced by new cleaned up small commits
- callbacks are sync again
- agent.start(slots) is replaced by new state SaleStart
- disables explicit state transition tests for now; need to be replaced
Allows events to be scheduled synchronously.
See https://github.com/status-im/nim-codex/pull/344
Co-Authored-By: Ben Bierens <thatbenbierens@gmail.com>
Co-Authored-By: Eric Mastro <eric.mastro@gmail.com>
- add slotIndex to `SalesAgent` constructor
- remove `SalesAgent.init`
- rename `SalesAgent.init` to `start` and `SalesAgent.deinit` to `stop`.
- rename `SalesAgent. populateRequest` to `SalesAgent.retreiveRequest`.
- move availability removal to the downloading state. once availability is persisted to disk, it should survive node restarts.
-
* initial implementation of repo store
* allow isManifest on multicodec
* rework with new blockstore
* add raw codec
* rework listBlocks
* remove fsstore
* reworking with repostore
* bump datastore
* fix listBlocks iterator
* adding store's common tests
* run common store tests
* remove fsstore backend tests
* bump datastore
* add `listBlocks` tests
* listBlocks filter based on block type
* disabling tests in need of rewriting
* allow passing block type
* move BlockNotFoundError definition
* fix tests
* increase default advertise loop sleep to 10 mins
* use `self`
* add cache quota functionality
* pass meta store and start repo
* add `CacheQuotaNamespace`
* pass meta store
* bump datastore to latest master
* don't use os `/` as key separator
* Added quota limits support
* tests for quota limits
* add block expiration key
* remove unnesesary space
* use idleAsync in listBlocks
* proper test name
* re-add contrlC try/except
* add storage quota and block ttl config options
* clarify comments
* change expires key format
* check for block presence before storing
* bump datastore
* use dht with fixed datastore `has`
* bump datastore to latest master
* bump dht to latest master
* setup and persist private key
* return dht record spr
* helper to remap multiaddr ip and port
* set/update discovery and announce addrs
* add nat and discovery IPs
* allow for announce and DHT addresses separatelly
* update tests
* check for nat or discoveryIp
* fix integration tests
* misc align
* don't share data dirs and and set bootstrap node
* add log scope
* remap announceAddrs after node start
* simplify discovery initialization
* make nat and disc-ip required
* add log scope don't init dht spr in constructor
* bump dht
* dissallow `0.0.0.0` for `--nat`
* add format for cid
* cid formatIt change
* track nim-libp2p-unstable
* rework probuf serialization for por
* add missing include
* removing nim protobuf serialization
* rollback to dht to main
* remove protobuf serialization import