Closed koxu1996 closed 2 months ago
File | Coverage | |
---|---|---|
All files | 51% |
:x: |
kairos-crypto/src/implementations/casper.rs | 6% |
:x: |
kairos-server/src/config.rs | 0% |
:x: |
kairos-server/src/errors.rs | 12% |
:x: |
kairos-server/src/lib.rs | 87% |
:white_check_mark: |
kairos-server/src/utils.rs | 22% |
:x: |
kairos-server/src/routes/deposit.rs | 88% |
:white_check_mark: |
kairos-server/src/routes/transfer.rs | 90% |
:white_check_mark: |
kairos-server/src/state/transactions.rs | 57% |
:x: |
kairos-server/src/state/trie.rs | 35% |
:x: |
kairos-server/src/l1_sync/event_manager.rs | 12% |
:x: |
kairos-server/src/l1_sync/interval_trigger.rs | 0% |
:x: |
kairos-server/src/l1_sync/service.rs | 56% |
:x: |
kairos-test-utils/src/cctl.rs | 87% |
:white_check_mark: |
kairos-server/src/state/transactions/batch_state.rs | 42% |
:x: |
kairos-test-utils/src/cctl/parsers.rs | 66% |
:white_check_mark: |
kairos-tx/src/asn.rs | 48% |
:x: |
kairos-tx/src/error.rs | 0% |
:x: |
kairos-server/tests/transactions.rs | 85% |
:white_check_mark: |
Minimum allowed coverage is 60%
Generated by :monkey: cobertura-action against 70c7057e3516ecd853e5fccbfa051baf4bba2e7f
@Avi-D-coder @marijanp Ready for re-review.
This PR adds periodic L1 synchronization :arrows_clockwise:, based on casper-event-toolkit.
Details
The core component is
EventManager
, which allows tracking events from a specified smart contract. The process begins with the setup of CES-related data - schemas, toolkit fetcher, and the number of events - usinginitialize()
. Subsequently,process_new_events()
checks for new events based on its internal counter,next_event_id
.L1SyncService
operates the event manager as a Tokio task and provides a safe API for shared access within an Axum server.Future work
main
, we will be able to parse deposit data from events - currently, this data is mocked - and push it to the batch manager (trie).Demo :movie_camera:
https://github.com/cspr-rad/kairos/assets/6506780/d7793f3c-6a98-41ec-8cb7-f8204588c075
If you want to reproduce it locally, please see the next section.
Test environment
I used dockerized NCTL with bunch of shell scripts to run this demo - all available in this gist.
1. Cleanup old resources and compile example smart contract
2. Run NCTL and deploy WASM
At this point you have contract hash that is ready to be used in the next steps.
3. Initialize Casper Event Standard
4. Call deposit/batch entrypoint to emit test events
Additional changes for demo
In order to record nice and quick demo, I updated subscribed to include relevant logs:
I also reduced synchronization interval from 30 to 10 seconds: