-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Adds a streaming snapshot paser #259
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
630d92b
Add snapshot parser with minimal changes
buddhisthead cbf1c58
Update documentation and add remanining test driver and script that g…
buddhisthead 087606c
Fix formatting and also a comment that was misleading about the type
buddhisthead 35e8d94
Fix a couple of nits from co-pilot
buddhisthead 4aed652
Fix snapshot parser to report accurate deposits and UTXO count
buddhisthead 65e5618
Apply some small suggestions from co-pilot reviewer
buddhisthead bdc357f
WIP to convert to streaming snapshot parser in chunks
buddhisthead b1e1013
WIP: read meta-data first in 256MB chunk, seek to UTXOs and ready rem…
buddhisthead a450f94
feat: optimize UTXO streaming with 64MB buffer for balanced performance
buddhisthead 9e4eaef
Cleanup unused code and dependency
buddhisthead fd7d2ac
Add block pool production stats for previous and current epochs
buddhisthead 017fbe8
Swapped out the hash::StakeCredential for the one in types and change…
buddhisthead 053cad2
Replaced printlns with info tracing calls
buddhisthead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # Makefile for Acropolis workspace | ||
|
|
||
| .DEFAULT_GOAL := build | ||
|
|
||
| SHELL := bash | ||
| CARGO := cargo | ||
| PYTHON := python3 | ||
| PROCESS_PKG := acropolis_process_omnibus | ||
|
|
||
| # Test snapshots | ||
| SNAPSHOT_SMALL ?= tests/fixtures/snapshot-small.cbor | ||
| MANIFEST_SMALL ?= tests/fixtures/test-manifest.json | ||
|
|
||
| # Real Cardano Haskell node snapshot (Conway era, epoch 507) | ||
| SNAPSHOT ?= tests/fixtures/134092758.670ca68c3de580f8469677754a725e86ca72a7be381d3108569f0704a5fca327.cbor | ||
| MANIFEST ?= tests/fixtures/134092758.670ca68c3de580f8469677754a725e86ca72a7be381d3108569f0704a5fca327.json | ||
|
|
||
| SECTIONS_ALL := --params --governance --pools --accounts --utxo | ||
|
|
||
| .PHONY: help all build test run fmt clippy | ||
| .PHONY: snapshot-summary snapshot-sections-all snapshot-bootstrap | ||
| .PHONY: snap-test-streaming | ||
|
|
||
| help: | ||
| @echo "Acropolis Makefile Targets:" | ||
| @echo "" | ||
| @echo "Build & Test:" | ||
| @echo " all Format, lint, and test" | ||
| @echo " build Build the omnibus process" | ||
| @echo " test Run all tests" | ||
| @echo " fmt Run cargo fmt" | ||
| @echo " clippy Run cargo clippy -D warnings" | ||
| @echo "" | ||
| @echo "Snapshot Commands:" | ||
| @echo " snap-test-streaming Test streaming parser with large snapshot (2.4GB)" | ||
| @echo "" | ||
| @echo "Variables:" | ||
| @echo " SNAPSHOT=<path> Path to snapshot file (default: Conway epoch 507)" | ||
| @echo "" | ||
| @echo "Examples:" | ||
| @echo " make snap-test-streaming" | ||
| @echo " make snap-test-streaming SNAPSHOT=path/to/snapshot.cbor" | ||
|
|
||
| all: fmt clippy test | ||
|
|
||
| build: | ||
| $(CARGO) build -p $(PROCESS_PKG) | ||
|
|
||
| test: | ||
| $(CARGO) test | ||
|
|
||
| run: | ||
| $(CARGO) run -p $(PROCESS_PKG) | ||
|
|
||
| fmt: | ||
| $(CARGO) fmt --all | ||
|
|
||
| clippy: | ||
| $(CARGO) clippy --workspace -- -D warnings | ||
|
|
||
| # Streaming snapshot parser test | ||
| snap-test-streaming: | ||
| @echo "Testing Streaming Snapshot Parser" | ||
| @echo "==================================" | ||
| @echo "Snapshot: $(SNAPSHOT)" | ||
| @echo "Size: $$(du -h $(SNAPSHOT) | cut -f1)" | ||
| @echo "" | ||
| @test -f "$(SNAPSHOT)" || (echo "Error: Snapshot file not found: $(SNAPSHOT)"; exit 1) | ||
| @echo "This will parse the entire snapshot and collect all data with callbacks..." | ||
| @echo "Expected time: ~1-3 minutes for 2.4GB snapshot with 11M UTXOs" | ||
| @echo "" | ||
| @$(CARGO) run --release --example test_streaming_parser -- "$(SNAPSHOT)" | ||
|
|
||
| # Pattern rule: generate .json manifest from .cbor snapshot | ||
| # Usage: make tests/fixtures/my-snapshot.json | ||
| # Extracts header metadata from CBOR and computes SHA256 + file size | ||
| %.json: %.cbor | ||
| @echo "Generating manifest for $< -> $@" | ||
| @echo "Note: Manifest generation script not yet ported" | ||
| @echo "TODO: Port scripts/generate_manifest.py from original project" | ||
| @ERA_FLAG=$${ERA:+--era $$ERA}; \ | ||
| BH_FLAG=$${BLOCK_HASH:+--block-hash $$BLOCK_HASH}; \ | ||
| BHGT_FLAG=$${BLOCK_HEIGHT:+--block-height $$BLOCK_HEIGHT}; \ | ||
| if [ -f scripts/generate_manifest.py ]; then \ | ||
| $(PYTHON) scripts/generate_manifest.py $$ERA_FLAG $$BH_FLAG $$BHGT_FLAG $< > $@; \ | ||
| else \ | ||
| echo "Error: scripts/generate_manifest.py not found"; \ | ||
| exit 1; \ | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script expects the positional snapshot argument before flags (./generate_manifest.py [flags]); current order passes flags first. Fix ordering:$(PYTHON) scripts/generate_manifest.py $ < $$ERA_FLAG $$BH_FLAG $$BHGT_FLAG > $@