Solana on-chain programs for the ResQ platform. Implements delivery coordination (resq-delivery) and airspace management (resq-airspace) as Anchor programs, with a shared Rust library and JavaScript test/client layer.
resq-delivery/— Delivery coordination program: job lifecycle, drone assignment, escrow.resq-airspace/— Airspace management program: zone registry, flight authorisation, conflict detection.Cargo.toml— Workspace root; shared dependencies and patch overrides.Anchor.toml— Program IDs, cluster config, and test script.package.json— JS test runner and Anchor client dependencies (Bun).
anchor build # Compile all programs (.so artifacts)
anchor test # Run tests against localnet
anchor deploy --provider.cluster devnet # Deploy to devnet
cargo fmt --all # Format Rust
cargo clippy --workspace -- -D warnings # Lint
./agent-sync.sh --check # Verify AGENTS.md and CLAUDE.md are in sync- Framework: Anchor 0.30; account validation via
#[account]constraints. - Programs are
no_std-compatible BPF targets compiled totarget/deploy/*.so. - Shared logic (math, validation, seeds) lives in a
resqlib crate within each program workspace. - Tests use
@coral-xyz/anchorTypeScript client against a local validator spun up byanchor test. - PDAs follow the pattern
[b"domain", entity_key.as_ref()]— seeds documented inAnchor.toml.
- All instructions must validate signer authority and account ownership explicitly.
- Use
require!/require_eq!macros for constraint checks — never panic. - Arithmetic via
checked_*methods oranchor_lang::prelude::*safe math. - No
unsafeblocks. Nounwrap()in instruction handlers. - All source files carry the Apache-2.0 license header.
- Keep
AGENTS.mdandCLAUDE.mdin sync using./agent-sync.sh.
- Re-validate all accounts even when Anchor generates checks — defence in depth.
- PDA bump seeds must be stored in account state and verified on every instruction.
- Never trust client-provided amounts for escrow — recompute from on-chain state.
- Run
cargo auditbefore every deploy (./agent-sync.shcovers this via pre-commit).
- Do not commit
target/ornode_modules/. - Program IDs in
Anchor.tomlanddeclare_id!()must match — verify before deploy. - Devnet deploys require a funded keypair at
~/.config/solana/id.json.
Canonical hooks from resq-software/dev.
Install:
curl -fsSL https://raw.githubusercontent.com/resq-software/dev/main/scripts/install-hooks.sh | shContract: resq-software/dev/AGENTS.md#git-hooks. This repo's .git-hooks/local-pre-push runs cargo check --workspace --quiet and fails fast if cargo is unavailable, so Anchor programs never push in a broken state.