cardano-node icon indicating copy to clipboard operation
cardano-node copied to clipboard

[FEATURE] - query each stake snapshot independently [Draft]

Open CarlosLopezDeLara opened this issue 1 year ago • 13 comments

What

A command to query each stake snaphost independently; for example

cardano-cli query stake-snapshot --mark-snapshot ... cardano-cli query stake-snapshot --go-snapshot ...

the output should contain all 3 maps

[ "delegations", "poolParams", "stake" ]

Why

Currently, many tools rely on dumping the entire ledger-state to then extract the required snapshot values which is expensive and inefficient and there is no alternative good solution yet.

Personas

  • [ ] SPOs
  • [ ] dApp Devs
  • [ ] Exchanges
  • [x] Wallets
  • [x] 3rd party tools
  • [ ] ADA holders

Definition of Done (DoD)

  • [ ] Acceptance Criteria + User Stories & DoD created and singed-off (by PO, dev & test owners)
  • [ ] Builds successfully on CI
  • [ ] Code & Test review (as per Acceptance Criteria)
  • [ ] There is documentation and/or examples for the new functionality (usage/response)
  • [ ] Log/record changes on Vnext (or similar depending on what we adopt)
  • [ ] Ticket number(s) included in PR description
  • [ ] All Acceptance Criteria met and covered by dev/unit/property/integration tests
  • [ ] System/E2E automated tests + System Test Engineer Owner Sign-off

NOTE: Ideally, we should merge only fully implemented and tested features into the master branch. So all the above steps are required for the PR to be merged.
In order to avoid the PRs becoming stale and requiring to be rebased on master, these can be merged after a reasonable time (current agreement is 3 days) if the System Test Engineer Owner's sign-off was not provided (last step in the DoD).

IMPORTANT: Any deviation from the plan should be discussed and agreed as a comment in the Feature file.

Sign-off

  • [ ] Product Owner
  • [ ] Dev Owner
  • [ ] System Test Engineer Owner

Related PRs

  1. PR # here

Acceptance Criteria

Acceptance Criteria & User Stories define here (or in a separate file (linked here) for a big feature)

CarlosLopezDeLara avatar Mar 13 '23 19:03 CarlosLopezDeLara

the output should contain all 3 maps

might be good to split the maps further by specifying arguments (unless it is going to be lumped at source and then filtered on client) to further reduce the output size to parse.

rdlrt avatar Mar 14 '23 00:03 rdlrt

Looks perfect. @CarlosLopezDeLara

ashisherc avatar Mar 14 '23 07:03 ashisherc

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

github-actions[bot] avatar Apr 14 '23 01:04 github-actions[bot]

!

ashisherc avatar Apr 15 '23 05:04 ashisherc

Any updates on this issue? Still relying on a full ledger state dump is very painful.

AndrewWestberg avatar May 13 '23 14:05 AndrewWestberg

@newhoggy you asked how it was with 8.0.0; unfortunately not very good.

 time cardano-cli query stake-snapshot --mainnet --all-stake-pools > stakesnapshot.json

real	35m48.363s
user	0m0.041s
sys	0m0.006s

CarlosLopezDeLara avatar May 16 '23 18:05 CarlosLopezDeLara

FYI We need to see how this PR improves current performance before we proceed with queries for each snapshot.

CarlosLopezDeLara avatar May 17 '23 16:05 CarlosLopezDeLara

pinging this issue again here. Ledger state is still very painful at 2.4gb.

A command to query each stake snaphost independently; for example

cardano-cli query stake-snapshot --mark-snapshot ... cardano-cli query stake-snapshot --go-snapshot ...

the output should contain all 3 maps

[ "delegations", "poolParams", "stake" ]

papacarp avatar Aug 06 '23 17:08 papacarp

@papacarp this is not on the high priorities at the moment. Integrating CIP1694 is on top, but I'll make sure its taken care of as soon as possible.

CarlosLopezDeLara avatar Aug 10 '23 00:08 CarlosLopezDeLara

Even with binary cbor from the node, we're now at 2.26gb every epoch for the ledger state dump. Please continue to prioritize this. It can take upwards of 5 minutes to download and parse this cbor from the node. Most of this data, we don't use at all.

AndrewWestberg avatar Feb 01 '24 18:02 AndrewWestberg

2.27gb

AndrewWestberg avatar Feb 06 '24 14:02 AndrewWestberg

2.28gb

AndrewWestberg avatar Feb 09 '24 21:02 AndrewWestberg

2.30gb

AndrewWestberg avatar Mar 11 '24 16:03 AndrewWestberg