Skip to content

feat: make the REST API and Vault opt-in, and keep volumes on stop - #46

Merged
polymesh-bot merged 4 commits into
mainfrom
feat/compose-profiles
Sep 1, 2026
Merged

feat: make the REST API and Vault opt-in, and keep volumes on stop#46
polymesh-bot merged 4 commits into
mainfrom
feat/compose-profiles

Conversation

@F-OBrien

@F-OBrien F-OBrien commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

Makes the dev environment cheaper to run and safer to stop.

The REST API and Vault now sit behind a rest-api compose profile instead of starting unconditionally, so a run that never signs through them does not pay for five extra containers. --profile evm no longer drags them in either; --profile rest-api,evm restores the old everything-on behaviour. environment-ready gates on POLYMESH_WAIT_FOR_REST_API so it reports ready on core services when the profile is off, rather than waiting forever for a marker that is never written.

stop-env.sh now keeps named volumes by default. Losing chain data by accident costs a full re-sync, so removal is opt-in via --volumes (-v). yarn test and CI pass it explicitly, since the suite leaves on-chain state a rerun trips over.

Two Blockscout fixes found along the way:

  • Internal-tx fetcher disabled — eth-rpc exposes native Substrate extrinsics as untraceable pseudo-Ethereum transactions, so the fetcher retried those blocks forever and flooded the logs.
  • Frontend RPC URLNEXT_PUBLIC_NETWORK_RPC_URL defaults to the published eth-rpc port, which the browser needs for Contract Read/Write and "Add to wallet".

Docs updated across README.md, tests/README.md and all env files. test:stop:evm removed — stop-env.sh force-enables both profiles, so it was a duplicate of test:stop.

Validated with docker compose config across all profile combinations, with resolved values spot-checked. The integration suite has not been run end-to-end against these commits.

Breaking Changes

  • docker compose up -d no longer starts the REST API or Vault. Add --profile rest-api, plus POLYMESH_WAIT_FOR_REST_API=true when driving compose directly.
  • --profile evm alone no longer starts Vault and the REST APIs. Use --profile rest-api,evm for the previous behaviour.
  • stop-env.sh no longer removes named volumes by default. Pass --volumes (or -v). --keep-volumes still accepted as a no-op.
  • yarn test:stop:evm removed; use yarn test:stop.

JIRA Link

Checklist

  • Updated the Readme.md (if required) ?

pallet-revive's eth-rpc surfaces native Substrate extrinsics as
pseudo-Ethereum transactions: SCALE-encoded input, a `modl*` pallet
account as `to`, and zero gas. They carry no EVM call frames, so
debug_traceTransaction answers "No Ethereum extrinsic found" and the
internal transaction fetcher retries those blocks forever, flooding the
logs.

Nothing is lost by turning it off, since debug_traceBlockByNumber
returns [] regardless. Exposed as
POLYMESH_BLOCKSCOUT_DISABLE_INTERNAL_TX_FETCHER (default true) so it can
be re-enabled if a future eth-rpc image supports tracing.
The frontend's Contract Read/Write tabs and its "Add to wallet" network
config are driven by wagmi/viem in the browser, so the RPC endpoint has
to resolve from the host rather than from inside the Docker network.
Without NEXT_PUBLIC_NETWORK_RPC_URL those calls have no endpoint to use.

Defaults to http://localhost:<POLYMESH_ETH_RPC_PORT> and is overridable
via POLYMESH_BLOCKSCOUT_NETWORK_RPC_URL for setups that publish the
eth-rpc port elsewhere or run the browser on another host.
Starting everything meant five containers for the REST APIs and Vault
even when a workflow never signs through them, which is a real cost on a
constrained machine. They are now opt-in via `--profile rest-api`,
leaving the node, Postgres and the Subquery indexer as the default set.

`environment-ready` waited on a marker written by the REST API account
init, which no longer runs in the default set, so it would have hung
forever. It now gates that wait on POLYMESH_WAIT_FOR_REST_API and
otherwise reports ready once the core services are healthy, which its
new depends_on guarantees. `start-env.sh` sets the variable to match the
profiles it was given; running `docker compose` directly needs it set by
hand.

`--profile evm` no longer implies Vault and the REST APIs, so working on
contracts no longer pays for them. `--profile rest-api,evm` restores the
previous behaviour. `stop-env.sh` force-enables both optional profiles
on teardown so nothing is left running, and the test scripts enable
`rest-api` themselves since the suite signs with Vault.
`stop-env.sh` removed chain data, Vault keys and the Blockscout database
on every stop, so resuming from existing state meant remembering
`--keep-volumes` and forgetting it meant re-syncing from genesis. Losing
that data by accident is a lot more expensive than typing a flag when
you actually want a clean slate, so the default is inverted: `--volumes`
now opts into removal.

`--keep-volumes` is still accepted as a no-op so existing invocations
keep working.

The full `yarn test` cycle owns the environment it creates and leaves
identities and assets on chain that a rerun would trip over, so it now
passes `--volumes` explicitly, as does CI via a new `test:stop:clean`.
@F-OBrien
F-OBrien requested review from a team as code owners September 1, 2026 11:12
@F-OBrien F-OBrien changed the title Feat/compose profiles feat: make the REST API and Vault opt-in, and keep volumes on stop Sep 1, 2026
@F-OBrien

F-OBrien commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

/fast-forward

@polymesh-bot
polymesh-bot merged commit 366d010 into main Sep 1, 2026
2 checks passed
@polymesh-bot
polymesh-bot deleted the feat/compose-profiles branch September 1, 2026 12:40
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.

3 participants