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

adding tool to dump the ledger at a given slot #15620

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open

Conversation

svv232
Copy link
Member

@svv232 svv232 commented May 9, 2024

Explain your changes:

  • Adding a new app that dumps the archive database ledger for a given slot. If the slot does not have a block, the most recent block before that slot is dumped.

Explain how you tested your changes:

  • I ran the tool on a local archive db and received output, here is some for example
{"timestamp":"2024-05-09 04:02:19.570262Z","level":"Info","source":{"module":"Dune__exe__Dump_slot_ledger","location":"File \"src/app/dump_slot_ledger/dump_slot_ledger.ml\", line 124, characters 8-19"},"message":"$dump\n","metadata":{"dump":"{ Dump_slot_ledger.Ledger_entry.delegate_key =\n  (Some \"B62qjkjpZtKLrVFyUE4i4hAhYEqaTQYYuJDoQrhisdFbpm61TEm1tE5\");\n  ledger_index = 221; balance = \"387\"; nonce = 0;\n  receipt_chain_hash = \"2mzbV7WevxLuchs2dAMY4vQBS6XttnCUF8Hvks4XNBQ5qiSGGBQe\";\n  ledger_hash = \"jx3aun2kXmfEpT2CahSqU1VY1e5GWUEY53WVCpqp6wtZbWKBc1a\";\n  token_symbol = (Some \"\"); timestamp = \"1714771429000\" }"}}
{"timestamp":"2024-05-09 04:02:19.570269Z","level":"Info","source":{"module":"Dune__exe__Dump_slot_ledger","location":"File \"src/app/dump_slot_ledger/dump_slot_ledger.ml\", line 124, characters 8-19"},"message":"$dump\n","metadata":{"dump":"{ Dump_slot_ledger.Ledger_entry.delegate_key =\n  (Some \"B62qrqndewerFzXSvc2JzDbFYNvoFTrbLsya4hTsy5bLTXmb9owUzcd\");\n  ledger_index = 207; balance = \"265\"; nonce = 0;\n  receipt_chain_hash = \"2mzbV7WevxLuchs2dAMY4vQBS6XttnCUF8Hvks4XNBQ5qiSGGBQe\";\n  ledger_hash = \"jx3aun2kXmfEpT2CahSqU1VY1e5GWUEY53WVCpqp6wtZbWKBc1a\";\n  token_symbol = (Some \"\"); timestamp = \"1714771429000\" }"}}
{"timestamp":"2024-05-09 04:02:19.570285Z","level":"Info","source":{"module":"Dune__exe__Dump_slot_ledger","location":"File \"src/app/dump_slot_ledger/dump_slot_ledger.ml\", line 124, characters 8-19"},"message":"$dump\n","metadata":{"dump":"{ Dump_slot_ledger.Ledger_entry.delegate_key =\n  (Some \"B62qrGPBCRyP4xiGWn8FNVveFbYuHWxKL677VZWteikeJJjWzHGzczB\");\n  ledger_index = 9; balance = \"269\"; nonce = 0;\n  receipt_chain_hash = \"2mzbV7WevxLuchs2dAMY4vQBS6XttnCUF8Hvks4XNBQ5qiSGGBQe\";\n  ledger_hash = \"jx3aun2kXmfEpT2CahSqU1VY1e5GWUEY53WVCpqp6wtZbWKBc1a\";\n  token_symbol = (Some \"\"); timestamp = \"1714771429000\" }"}}```

Checklist:

  • Does this close issues? List them

@svv232 svv232 requested a review from a team May 9, 2024 04:06
@svv232
Copy link
Member Author

svv232 commented May 9, 2024

!ci-build-me

@svv232
Copy link
Member Author

svv232 commented May 9, 2024

!ci-build-me

@svv232
Copy link
Member Author

svv232 commented May 9, 2024

!ci-build-me

@svv232 svv232 requested a review from a team May 9, 2024 15:42
@svv232
Copy link
Member Author

svv232 commented May 9, 2024

!ci-build-me

This query dumps all the ledger information tied to each account.
The assumption here is the chain state for a slot corresponds to the
closest block before the slot occured. This is because every block
has is produced during a slot, but not every slot implies a block was
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to fix this awkward grammar


## Overview

The Ledger Dumper Tool is queries the archive database for ledger entries associated with a specific slot, which is a unit of time in mina. The data fetched includes various details such as delegate keys, balances, nonces, receipt chain hashes, and more.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix grammar

(let%map_open.Command postgres = Cli_lib.Flag.Uri.Archive.postgres
and slot =
flag "--slot" ~aliases:[ "slot" ]
~doc:"the global slot since genesis tha tyou would like to dump"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix spelling error

@dkijania
Copy link
Member

Any automated tests ? Generally this is new code so we should not create quality debt

@svv232
Copy link
Member Author

svv232 commented May 13, 2024

Any automated tests ? Generally this is new code so we should not create quality debt

not yet, i can try adding some

@svv232 svv232 requested review from a team as code owners May 14, 2024 18:47
@svv232
Copy link
Member Author

svv232 commented May 14, 2024

!ci-build-me

@svv232
Copy link
Member Author

svv232 commented May 14, 2024

!ci-build-me

@svv232
Copy link
Member Author

svv232 commented May 14, 2024

!ci-build-me

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.

App to dump ledger at given slot
3 participants