Quick start
Commands for checking the corpus, running an SDK over it, replaying chains into an indexer, linting Go indexer code, applying the guide to stellar-docs and regenerating the corpus.
Check the corpus
shapekit registry check
shapekit manifest validate # every entry decodes and re-encodes to the same bytes
shapekit coverage --check # per-CAP coverage is current and every gap has a reason
shapekit goldens agree # structural agreement with stellar-core's goldensAny pipeline can read the corpus without shapekit: corpus/manifest.json lists every entry with
its XDR type, files, CAPs, protocol and expected values; the schema is
schema/manifest.schema.json. To browse the entries, with their decoded XDR-JSON and what
each SDK version and the reference indexer did with them, use the
corpus entries.
Run an SDK over the corpus
Each SDK needs its own toolchain: cargo for rust, soroban and stellar-cli, go, node for js, uv
with CPython 3.15.2 for python, JDK 27 and Maven for java and kmp, Flutter for dart, PHP and
Composer for php, and the .NET SDK for dotnet. shapekit doctor sdk --sdk <sdk> lists what is
missing. For python, java and kmp, export PATH="$(scripts/python-toolchain.sh):$PATH" and
export PATH="$(scripts/java-toolchain.sh):$PATH" fetch the pinned versions into
target/toolchains/ and check each download against its sha256 (the java and kmp builds set
JAVA_HOME to the pinned JDK themselves); for dart,
export PATH="$(scripts/flutter-toolchain.sh):$PATH" does the same for Flutter.
shapekit check sdk --sdk js # current version, @stellar/stellar-sdk 17.4.0
shapekit check sdk --sdk go --all-versions # every version in conformance/versions.toml
shapekit check sdk # every SDK at its current versionThe divergence matrix is written to target/conformance/MATRIX.md. shapekit check sdk is
shapekit conformance run with the options most runs need; shapekit conformance run --help
lists the rest. To run the corpus in an SDK repository's own CI against the pull request's
code, for any of the eleven SDKs above, see Running the corpus in an SDK's CI.
Replay chains into an indexer
Needs Linux and Docker. The harness binds the replay server to the gateway of an internal
Docker network, and the adapter connects to its containers' addresses. On macOS, Docker runs
in a VM and neither is reachable from the host, so check indexer and harness run stop with
that error there. The CI workflows run on Linux runners. The first run of a wallet-backend
commit clones it and builds its image; after that it runs offline.
docker pull "$(scripts/pin.sh image timescaledb)"
shapekit check indexer --adapter "adapters/bin/wb-adapter --commit $(scripts/pin.sh git wallet-backend)" \
--chain cap40.signed-payload-signer.p30Without --chain or --family every chain in the corpus is replayed. Results are in
harness-out/HARNESS.md. shapekit check indexer is shapekit harness run with the options
most runs need; shapekit harness run --help lists the rest.
stellar-rpc runs from its release image, pinned by digest, and serves the chains it backfilled from their SEP-54 lakes:
docker pull "$(scripts/pin.sh image stellar-rpc)"
(cd adapters && go build -o bin/rpc-adapter ./stellarrpc/cmd/rpc-adapter)
shapekit check indexer --adapter "adapters/bin/rpc-adapter --events-from events" --network bothAn indexer that runs in Docker and stores in PostgreSQL connects through a mapping file, with no
adapter code: the file says how to build and start it, how ledgers reach it, and which tables
and columns hold which facts. wallet-backend's is adapters/walletbackend/adapter.toml:
shapekit check indexer --mapping adapters/walletbackend/adapter.toml \
--var commit=$(scripts/pin.sh git wallet-backend) --chain cap40.signed-payload-signer.p30Connecting a PostgreSQL indexer with a mapping file describes the file.
stellar-etl is built from its pinned release tag on first use, like wallet-backend, and reads the chains from a GCS emulator:
docker pull "$(scripts/pin.sh image fake-gcs-server)"
(cd adapters && go build -o bin/etl-adapter ./stellaretl/cmd/etl-adapter)
shapekit check indexer --adapter "adapters/bin/etl-adapter --commit $(scripts/pin.sh git stellar-etl)" \
--chain cap40.signed-payload-signer.p30For any other indexer, write an adapter as described in Adapter interface. To replay the corpus in an indexer repository's own CI, see Running the corpus in an indexer's CI.
Read the results
shapekit report harness-out # writes harness-out/report.html
shapekit report target/conformance --known-failures conformance/known-failuresThe page groups the failures of one run by finding, and gives each group its smallest corpus entry, its upstream issue, the guide sections for the fields involved and the command that reruns it. With a baseline it marks failures as new, changed, fixed or unchanged. See Reading a run: shapekit report.
Lint Go indexer code
shapekit lint <your indexer> # indexerlint ./... in that module
shapekit lint <your indexer> --baseline <baseline file> --jsonshapekit lint starts indexerlint, so the linter binary has to be on PATH (or named with
--linter), and the Go toolchain too, since the linter loads packages with it. Run on its own,
indexerlint ./... does the same. A relative --baseline path is read from the directory you
run shapekit lint in, not from the indexer's directory. Rules, suppressions and the baseline file are described in
indexerlint. The same checks are a checklist in the guide for indexers in
other languages.
Put your own indexer or SDK behind shapekit
shapekit init adapter --lang go --target my-indexer --target-version <commit> # go, ts or python
shapekit init testee --lang python # go, ts or pythonEach writes a skeleton that speaks the protocol and a README that says what to fill in and how
to run it with shapekit check indexer or shapekit check sdk. See "Writing an adapter" in
Adapter interface and "Writing a
testee" in Testee protocol.
Internal commands
shapekit --help lists the commands above. The corpus generator, its checks, the upstream
reproductions and the other maintenance tools (gen, twin, conformance, harness,
registry and the rest) work the same way but are left out of that list; shapekit dev lists
them with one line each.
The guide as a stellar-docs change
docs/guide/stellar-docs.patch adds the guide to stellar/stellar-docs as
docs/data/indexers/build-your-own/indexer-hardening.mdx, with a link from the Build Your Own
index and an entry in docs.json. It is made from the guide in this commit with the
publication-gate comment lines removed and corpus entries linked at the v0.2.0 tag (shapekit guide table --corpus-url https://github.com/ErenTopaal/shapekit/blob/v0.2.0/corpus), on top
of stellar-docs main at 62f29bbb. The two patched .mdx files pass stellar-docs' prettier
configuration and its scripts/pad-component-tags.mjs --check; mint validate and mint broken-links have not been run on them. To apply the patch and repeat those two checks:
cd stellar-docs && git switch -c indexer-hardening-guide 62f29bbb
git am /path/to/shapekit/docs/guide/stellar-docs.patch
pnpm install
pnpm exec prettier --config .prettierrc.js --check docs/data/indexers/build-your-own/*.mdx
node scripts/pad-component-tags.mjs --check docs/data/indexers/build-your-own/*.mdxTo make the patch again after the guide changes, continue on that branch with SK set to the
root of this repository:
f=docs/data/indexers/build-your-own/indexer-hardening.mdx
sed '2,5d' "$SK/docs/guide/indexer-hardening.mdx" > "$f" # drops the publication-gate comment
(cd "$SK" && shapekit guide table --file "$OLDPWD/$f" \
--corpus-url https://github.com/ErenTopaal/shapekit/blob/v0.2.0/corpus)
git commit -a --amend --no-edit
git format-patch -1 --stdout > "$SK/docs/guide/stellar-docs.patch"shapekit guide table runs from the repository root because it reads registry/ and
corpus/manifest.json from there.
Regenerate the corpus
Needs Docker and the pinned stellar-core image.
docker pull "$(scripts/pin.sh image stellar-core)"
shapekit gen verify-repro --family cap40.signed-payload-signer # regenerate under both passphrases and compare byte for byte
shapekit gen chains --family cap40.signed-payload-signer --network bothGenerated from README.md
Edit on GitHub