Path: Learning Path > 21 Troubleshooting
- Check
pnpm script chain:localnet:start --check-only. - Localnet version handling is in
packages/dapp/src/scripts/chain/localnet-start.ts.
Code spotlight: localnet health check
packages/dapp/src/scripts/chain/localnet-start.ts
if (checkOnly) {
if (probeResult.status === "running") {
logSimpleGreen("Localnet running")
logRpcSnapshot(probeResult.snapshot, withFaucet)
return
}
throw new Error(
`Localnet RPC unavailable at ${tooling.network.url}: ${probeResult.error}`
)
}Auto-funding fails on localnet ("Faucet request failed" / "Failed to execute transaction after 2 retries")
- This means the local faucet cannot execute its funding transaction, so auto-funding will fail too.
- Fix by regenesis (resets faucet treasury objects):
pnpm script chain:localnet:stoppnpm script chain:localnet:start --with-faucet --force-regenesis- Re-run your script (e.g.
pnpm script mock:setup --buyer-address <0x...> --network localnet).
- If you need to preserve state, start localnet with a fresh config dir instead:
SUI_LOCALNET_CONFIG_DIR=~/.sui/localnet-fresh pnpm script chain:localnet:start --with-faucet
- Optional sanity check for the local faucet endpoint:
curl -s -X POST http://127.0.0.1:9123/v2/gas \ -H 'Content-Type: application/json' \ -d '{"FixedAmountRequest":{"recipient":"<0x...>"}}'
- Cause: the package path resolves to a folder without Move sources (or stale build metadata after regenesis).
- Fix:
- Ensure you are targeting the Move package directory (for localnet:
--package-path oracle-market). - Re-publish with
--re-publish:pnpm dapp move:publish --package-path oracle-market --network localnet --re-publish.
- Ensure you are targeting the Move package directory (for localnet:
- Cause: localnet regenesis reset on-chain objects, but local artifacts still point at an old mock Pyth package ID.
- Fix (localnet):
- (optional) Delete
packages/dapp/deployments/mock.localnet.json. - (optional) Delete
packages/dapp/contracts/pyth-mock/Published.toml. - Re-publish mocks:
pnpm dapp mock:setup --re-publish. - Re-publish the oracle package:
pnpm dapp move:publish --package-path oracle-market --network localnet --re-publish.
- (optional) Delete
- Ensure the owner cap is in your wallet. See
packages/domain/core/src/models/shop.ts.
- Register with
pnpm script owner:currency:addor re-runpnpm script owner:shop:seed.
- Cause: the connected buyer wallet has no spendable
0x2::sui::SUIcoin objects, so the transaction builder cannot auto-select gas payment. - Quick recovery: disconnect and reconnect Slush (or switch account away and back) to refresh wallet/account state in the app before deeper debugging.
- Common localnet pitfall:
mock:setup --buyer-addressfunded mock coins for one address, but your UI wallet is connected to a different address. - Verify balances for the exact connected wallet address:
pnpm script chain:describe-coin-balances --address <0x...> --network localnet- If
0x2::sui::SUIis missing, fund the same address from local faucet:curl -s -X POST http://127.0.0.1:9123/v2/gas -H 'Content-Type: application/json' -d '{"FixedAmountRequest":{"recipient":"<0x...>"}}'
- After funding, reconnect wallet or reload the UI and retry purchase.
- This repo's buy flow expects a dedicated payment coin when paying with SUI. Split a SUI coin so you have one for gas and one for payment (or adjust the flow to split from gas). See
packages/domain/core/src/flows/buy.ts.
- Re-run
pnpm script mock:update-priceson localnet. - Guardrails are implemented in
packages/dapp/contracts/oracle-market/sources/currency.move.
Code spotlight: guardrails clamp buyer overrides
packages/dapp/contracts/oracle-market/sources/currency.move
let requested_max_age = max_price_age_secs.destroy_or!(
accepted_currency.max_price_age_secs_cap,
);
let effective_max_age = requested_max_age.min(accepted_currency.max_price_age_secs_cap);
let requested_confidence_ratio = max_confidence_ratio_bps.destroy_or!(
accepted_currency.max_confidence_ratio_bps_cap,
);
let effective_confidence_ratio = requested_confidence_ratio.min(accepted_currency.max_confidence_ratio_bps_cap);- Previous: 20 Security & Gotchas
- Next: 22 Glossary
- Back to map: Learning Path Map