Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement stake snapshot local state query #394

Merged
merged 7 commits into from
Feb 6, 2024

Conversation

falcucci
Copy link
Contributor

@falcucci falcucci commented Feb 3, 2024

In case we search for specific pools: currently we have one pool per request limit. Empty pools means all pools.

the cardano-cli has the same behavior due to this limitation.

fixes #395

- add a new function `get_stake_snapshots` in the `localstate` queries to make queries about stake snapshots.
- add display details to `minicbor` encoding/decoding process in `utils.rs` to aid in debugging.
- modify `blockquery` enum to accommodate stake screenshot queries.
- rename variable `x` to `pools` in `localstate` queries to reflect its intended usage clearly.
- add new types `pools`, `stakesnapshot`, `snapshots`, `stakes` to signify the snapshot of staking state.
- the `pools`, `stakesnapshot`, `snapshots`, `stakes` are now encoded and decoded using minicbor in the `queries_v16/mod.rs`.
- `get_stake_snapshots` function now returns `stakesnapshot` which has detailed snapshot information of stake pools.
- implement a change in the `do_localstate_query` function where a new query of stake snapshots is fired and the result is logged.
- add the ability to query stake snapshots for specified stake pools in the `get_stake_snapshots` function
- remove unnecessary code in the `anycbor` struct
- remove unnecessary code in the `utils.rs` file
- fix a typo in the `queries_v16/mod.rs` file
- update the `pallas` dependency to fix a bug in the `n2c-miniprotocols/src/main.rs` file
- change the way the `pool_idx` is initialized in `do_localstate_query` function
- add `bytes` import to `protocols.rs` file in the `pallas-network/tests` directory
- add a new query to the server's receive query statements in `local_state_query_server_and_client_happy_path` function
- add assertions for the new query in `local_state_query_server_and_client_happy_path` function
- add stake snapshots and result sending statements to the server's send result statements in `local_state_query_server_and_client_happy_path` function
- add sending a query and receiving the result statements to the client's `local_state_query_server_and_client_happy_path` function
- removed code related to stake pool id/verification key hash
- changed the `pools` variable to an empty vector
@falcucci falcucci marked this pull request as ready for review February 3, 2024 15:01
- change the comment to clarify that the stake pool id/verification key hash can be either bech32-decoded or hex-decoded
- modify the comment to reflect that an empty vector means all pools
- remove unused import of `codec::utils::bytes`
@scarmuega scarmuega merged commit 43cdb74 into txpipe:main Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: implement GetStakeSnapshots local state query
2 participants