Skip to content

Pin toolchain, document crates, add deploy scripts and threat model - #1221

Merged
yusuftomilola merged 2 commits into
DistinctCodes:mainfrom
northersubair:feat/sc-53-56-toolchain-docs-deploy-security
Jul 27, 2026
Merged

Pin toolchain, document crates, add deploy scripts and threat model#1221
yusuftomilola merged 2 commits into
DistinctCodes:mainfrom
northersubair:feat/sc-53-56-toolchain-docs-deploy-security

Conversation

@northersubair

Copy link
Copy Markdown
Contributor

Closes #1217
Closes #1218
Closes #1219
Closes #1220

SC-53: pin the toolchain
- Add contracts/rust-toolchain.toml pinning Rust 1.96.0 with rustfmt, clippy
  and the wasm32-unknown-unknown target.
- Every contracts CI job now reads the channel from that file instead of
  floating `stable`, so a new stable release cannot spontaneously break CI and
  local builds match CI exactly.

SC-54: per-crate documentation
- Add a README to each of the five crates covering purpose, invariants,
  storage layout, an entrypoint table with auth requirements, emitted events,
  errors, and a worked example.
- Add a workspace README with the crate map and an explicit explanation of the
  assetsup/contrib relationship.
- Add crate-level //! docs to every lib.rs; cargo doc --no-deps is now
  warning-free.

SC-55: reproducible deployment
- Add scripts/deploy.sh handling build, optimize, deploy, initialize and
  verify, wiring cross-contract addresses in dependency order.
- Contract ids are written to a git-ignored deployments/<network>.json with a
  committed example. No key material is read, written, or logged.

SC-56: threat model and checklist
- Add contracts/SECURITY.md with the trust model, per-contract assets at risk,
  known accepted risks, a pre-deployment checklist, and a disclosure process.
- Add a PR template that references the checklist for contract changes.

The entrypoint tables record the authorization gaps found while documenting:
assetsup's register_asset, update_asset_metadata, transfer_asset_ownership and
retire_asset check a caller-supplied address without calling require_auth on
it, and several asset-maintenance entrypoints have no authorization at all.
These are documented here and tracked for fixing in SC-42.

Closes DistinctCodes#1217
Closes DistinctCodes#1218
Closes DistinctCodes#1219
Closes DistinctCodes#1220
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

@northersubair is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@northersubair Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Verifying the documentation against the compiled crates turned up three
inaccuracies in the tables added earlier in this branch.

contrib is mostly dead code. Its lib.rs declares only audit, pause, types,
insurance and lease; escrow, KYC, staking, oracle, tokenization,
detokenization, restrictions and error.rs have no mod declaration and are not
part of the crate — about 1,670 lines. The deployed ContribContract therefore
has none of those capabilities and no typed errors at all, so describing
contrib as "the crate that owns escrow and KYC" was wrong. The crate README now
leads with this, and the workspace README, entrypoint tables, event table and
SECURITY.md are corrected to match. Recorded as an accepted risk since anyone
reading the source would reasonably assume otherwise.

asset-maintenance: update_maintenance_schedule and
complete_scheduled_maintenance were listed as having no authorization. They do
authenticate, indirectly, by delegating to schedule_maintenance and
add_maintenance_record. The genuinely unguarded entrypoints are init,
add_warranty_information, update_warranty_information, file_warranty_claim and
create_maintenance_alert; SECURITY.md is narrowed to those.

multisig-wallet: emergency_unfreeze and set_daily_limit require an owner and
return NotAnOwner, not Unauthorized.

Refs DistinctCodes#1218
Refs DistinctCodes#1220

@yusuftomilola yusuftomilola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent infrastructure work! Toolchain pinning ensures reproducible builds, comprehensive documentation aids maintenance, deploy scripts streamline releases, and threat model documentation enhances security posture.

@yusuftomilola
yusuftomilola merged commit 8d56705 into DistinctCodes:main Jul 27, 2026
7 of 8 checks passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 27, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants