xdrlint
xdrlint (lint/) is a set of analyzers on golang.org/x/tools/go/analysis v0.52.0 for Go code that reads ledgers
with go-stellar-sdk’s xdr, ingest, processors/token_transfer and strkey packages. It tracks values from those
packages to sinks (SQL calls, participant sets, map keys, allocations) and reports where an assumption about the
ledger is made without a check.
Source:
lint/docs/README.md. Each rule has a page with a reported and a compliant example taken from its fixtures:
Lint rules.
Running it. Standalone (xdrlint ./...), as a go vet -vettool, or as a golangci-lint v2.15.0 module plugin.
Output as text, -json, -sarif FILE (for code scanning), or -report FILE (xcc.report/v1 rows). Exit 0 when
nothing at or above -fail-on is left, 1 otherwise, 2 when no package imports go-stellar-sdk’s xdr package (a run
that analyses nothing is not reported as clean).
Accepting a report. A report you checked is suppressed with a reason; XDR000 fails a suppression without one.
-expect FILE compares the run with a frozen list (rule, file, function, suppressed, count) and fails on any
difference in either direction.
How the linter is checked
The before/after table is the evidence that a rule detects a real defect class: the pattern is present at a commit
wallet-backend later fixed, and absent after.
For your indexer. Run
xdrlint ./... in your module, fix or suppress with a reason, then freeze the result
with -expect in CI. Guide: xdrlint.
The indexer-hardening guide
guide/indexer-hardening.mdx is written for developers.stellar.org (proposed path
docs/data/indexers/build-your-own/indexer-hardening.mdx in stellar-docs). It tells an indexer author what to trust
in a ledger and what not to.
Kept equal to the corpus.
- The field table is generated from
corpus/fields.yaml(53 fields: 35 validated, 14 partially validated, 4 passed through) joined with the manifest’s field citations. Its “demonstrated by” column lists the corpus entries that show each field, so the table cannot cite an entry that does not exist. - Every normative sentence carries a claim tag (
{/* claim: C-6101 */}) that resolves to a record inguide/claims.yamlwith its source: stellar-core code at a pinned commit, a CAP or SEP section, a corpus entry, or an executed probe. A sentence with “must”, “never”, “should” or “do not” and no tag fails the check. make verify-guideregenerates the tables and fails on a difference, checks every claim and every cited entry, then runs stellar-docs’ own checks (pnpm format:mdx,pnpm check,pnpm check:links) in a clone at the pinned commit48259204, offline.
guide/claims.yaml holds 462 claims: 407 facts and 55 recommendations. The authors’ verification of each claim is
guide/VERIFICATION.md (Verification).
Limits
- The guide is not reviewed. All 462 claims are
reviewer_status: unreviewed. Publication waits for review by a stellar-core or platform engineer, recorded per claim. - The linter covers Go on go-stellar-sdk only. Indexers in other languages use the guide’s checklist.
- Static analysis has limits. Each rule page lists what the rule cannot see (a check in another package, a sanitizer the configuration does not name).