Copycat L3 indexer and GraphQL#903
Draft
speeddragon wants to merge 61 commits into
Draft
Conversation
c435962 to
c63b65b
Compare
- Return tagged tuples from latest_height and normalize_height
- Propagate errors through parse_range using maybe block
- Return {error, unavailable} (HTTP 503) on upstream failures
- Validate resolved heights are non-negative in parse_range
- Log original upstream error reason before collapsing to unavailable
- Add regression tests with mock server for both failure paths
…ritting faster than OS is writting in disk
…ave, tests fixed on hb_store_arweave
- dev_copycat_arweave: cap bundle_header reads at Size - dev_copycat_arweave: route through lib_arweave_common - hb_store: dedupe start/stop/scope via COMMON_POLICIES
- the previous code called into a module that no longer exists - routes the tag lookup to the existing helper instead - tag include and exclude filtering works again
- keep range/list/auto-stop setup writes at direct bundle-item depth - avoid exercising full recursive chunk indexing in marker-focused tests
1aa7a57 to
964ecb2
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR continues #837. It extends the Arweave copycat L3 indexer with pending TX indexing, parent containment lookups, and Arweave-compatible GraphQL queries backed by locally indexed TX headers.
Summary
Copycat L3 indexer
~copycat@1.0/arweaveblock-range indexing for Arweave L1 TXs, L2 bundle items, and nested bundle items.mode=listandmode=inventoryfor local index inspection.id=..., optionalquery-l1-offset=true, and L1-level owner/tag filtering on that explicitid=...path.~arweave@2.9/parent=<id>for looking up whether an item is contained by a block or bundle.Pending TX / mempool indexing
mode=mempoolto scan/tx/pendingand index reachable unconfirmed TXs.sender=<address>filtering.Offset index format
GraphQL
~query@1.0/graphqlArweave transaction support.fee { winston ar }.Storage / infrastructure
hb_store_arweave.latest_heightfrom silently returning0on network errors.overlay_countPrometheus gauge for pending LMDB overlay writes.Operator Notes
How To Use
Index blocks
Index a range of blocks at depth 3:
curl "http://localhost:8005/~copycat@1.0/arweave?from=1890000&to=1889000&depth=3"Depth 2 indexes L1 TXs plus direct L2 bundle items through the lightweight block path. Depth 3 adds nested bundle recursion. If
depthis omitted, copycat usesdepth=full, capped bycopycat-depth-recursion-cap.For long-running indexing, run it through cron so the HTTP request does not own the indexing job lifetime:
curl "http://localhost:8005/~cron@1.0/once?cron-path=~copycat@1.0/arweave&from=-1&to=1862995&depth=3"Index one L1 TX
curl "http://localhost:8005/~copycat@1.0/arweave?id=<txid>&depth=3&query-l1-offset=true"Optional owner filter:
curl "http://localhost:8005/~copycat@1.0/arweave?id=<txid>&depth=3&include-owner=<address>"Optional tag filters:
Index the mempool
curl "http://localhost:8005/~copycat@1.0/arweave?mode=mempool"Optional sender filter:
curl "http://localhost:8005/~copycat@1.0/arweave?mode=mempool&sender=<address>"Inspect indexed blocks
Counts per depth:
curl "http://localhost:8005/~copycat@1.0/arweave?from=1890000&to=1889990&mode=list"Full item IDs per depth:
curl "http://localhost:8005/~copycat@1.0/arweave?from=1890000&to=1889990&mode=inventory"Example inventory response:
{ "1890000": { "depth": 3, "items": { "1": ["txid1", "txid2"], "2": ["bundleitem1", "bundleitem2"], "3": ["nesteditem1"] } } }Look up an item's parent
curl "http://localhost:8005/~arweave@2.9/parent=<item-id>"Bundle-contained item:
{"parents":[{"type":"bundle","id":"<parent-txid>"}]}L1 transaction contained by a block:
{"parents":[{"type":"block","height":1890000}]}Query via GraphQL
What Gets Indexed
<item-id>to codec, offset, and length. Offsets may be global, pending-root, or relative to another indexed ID.block/<height>/depthrecords the achieved indexed depth.block/<height>/items/<depth>stores concatenated raw item IDs for each depth.parent/<item-id>stores compact entries decoded as either{block, height}or{bundle, parent-id}.index-headersis enabled.block/marker-cutover-heightmarks when block depth markers become authoritative over legacy per-TX fallback checks.Configuration
arweave-block-workers3arweave-index-workers1copycat-memory-budget6 GiBcopycat-depth-recursion-cap6depth=fullor an oversized depth is requestedcopycat-scope[offset,parent]index-headerstruearweave-mempool-progressfalsearweave-pending-chunk-poll-attempts0arweave-pending-chunk-poll-ms500arweave-pending-chunk-poll-min-ms20000Use the hyphenated config keys shown above in node config.
Pending chunk polling is disabled unless
arweave-pending-chunk-poll-attemptsis greater than0; the delay and minimum-window keys only matter once polling is enabled.Validation
rebar3 device test --device-roots dev_copycatpasses: all 65 tests.depth=2because they validate block markers, listing, and stop behavior, not full nested recursion.