Skip to content

Feat/task issues - #150

Open
cyberpunk30 wants to merge 2 commits into
stellar-vortex-protocol:mainfrom
cyberpunk30:feat/task-issues
Open

Feat/task issues#150
cyberpunk30 wants to merge 2 commits into
stellar-vortex-protocol:mainfrom
cyberpunk30:feat/task-issues

Conversation

@cyberpunk30

Copy link
Copy Markdown

Title: feat: src-chain allowlist, rescue tokens, pause scope, allowlist
defaults (#34 #35 #36 #37)

────────────────────────────────────────────────────────────────────────

Description:

Summary

Implements all four open issues in a single cohesive change. Each issue
is self-contained but they share the same allowlist pattern and security
model, so landing them together keeps the contract internally
consistent.

────────────────────────────────────────────────────────────────────────

Changes

Closes #34 — Validate src_chain against an admin-maintained allowlist

  • Added AllowedSrcChain(String) and SrcChainAllowlistEnabled storage
    keys
  • Added Error::SrcChainNotAllowed (22)
  • Five new admin functions mirroring the existing dst-token allowlist:
    add_allowed_src_chain, remove_allowed_src_chain, is_src_chain_allowed,
    set_src_chain_allowlist_enabled, is_src_chain_allowlist_enabled
  • submit_intent now validates src_chain against the list when
    enforcement is on
  • Flag defaults to false — no migration needed for existing deployments
  • 5 tests: disabled-by-default, allows-any-when-off, blocks-unlisted,
    allows-listed, removal-blocks, re-disable restores open submission

Closes #35 — rescue_tokens for non-bond tokens accidentally sent to the
contract

  • Added Error::RescueProtectedToken (23)
  • New admin-only rescue_tokens(token, to, amount) entrypoint
  • Blocks rescue of bond_token (collateral protection); all other SEP-41
    tokens are recoverable
  • 4 tests: happy-path move, bond_token blocked, zero-amount rejected,
    admin auth enforced

Closes #36 — Gate register_solver / deregister_solver / withdraw_bond
behind pause()

  • All three bond-management functions now call require_not_paused
  • pause() rustdoc documents the rationale: solvers must not be able to
    shed collateral during a live incident
  • cancel_intent remains open during a pause (user escape hatch)
  • README Security Model section updated with the full reasoning
  • 4 tests: each bond function blocked while paused, all three restored
    after unpause, cancel still works while paused

Closes #37 — Document DstAllowlistEnabled off-by-default decision

  • Added dst_allowlist_enabled_defaults_to_false CI sentinel test — will
    catch any future change to the default before it reaches mainnet
  • README and code comment document the false default and the required
    pre-launch admin action (add_allowed_dst_token +
    set_dst_allowlist_enabled(true))
  • Same section now also documents the src_chain allowlist default (added
    in Validate src_chain against an admin-maintained set of supported chains #34)

────────────────────────────────────────────────────────────────────────

Testing

cargo fmt --all -- --check ✅
cargo clippy --all-targets -- -D warnings ✅
cargo test ✅ 71 passed, 0 failed
cargo build --target wasm32-unknown-unknown --release ✅

────────────────────────────────────────────────────────────────────────

Pre-launch checklist (mainnet)

  • Call add_allowed_dst_token() for every supported output token,
    then set_dst_allowlist_enabled(true)
  • Call add_allowed_src_chain() for every supported source chain
    (e.g. "ethereum", "base", "polygon"), then
    set_src_chain_allowlist_enabled(true)

…ocol#37

stellar-vortex-protocol#34 — src_chain allowlist
- Add AllowedSrcChain(String) and SrcChainAllowlistEnabled DataKey variants
- Add Error::SrcChainNotAllowed (22)
- Add add_allowed_src_chain / remove_allowed_src_chain / is_src_chain_allowed /
  set_src_chain_allowlist_enabled / is_src_chain_allowlist_enabled admin fns
- Enforce in submit_intent behind the feature flag (off by default)
- Tests: disabled-by-default, allows-any-when-off, blocks-unlisted,
  allows-listed, removal-blocks, re-disable restores open submission

stellar-vortex-protocol#35 — rescue_tokens
- Add Error::RescueProtectedToken (23)
- Add rescue_tokens(token, to, amount) admin entrypoint
- Blocks bond_token (collateral protection); allows all other SEP-41 tokens
- Tests: happy-path move, bond_token blocked, zero-amount fails, admin auth required

stellar-vortex-protocol#36 — pause scope
- Gate register_solver, deregister_solver, withdraw_bond behind require_not_paused
- Expand pause() rustdoc explaining the decision (solver collateral backstop)
- cancel_intent remains open during a pause (user escape hatch)
- README Security Model section documents the rationale
- Tests: pause blocks each bond fn, unpause restores all three, cancel works while paused

stellar-vortex-protocol#37 — dst_allowlist default documented
- Add dst_allowlist_enabled_defaults_to_false CI sentinel test
- README Security Model documents the default and pre-launch action required
- Same section covers src_chain_allowlist_enabled (also off by default)

Closes stellar-vortex-protocol#34, Closes stellar-vortex-protocol#35, Closes stellar-vortex-protocol#36, Closes stellar-vortex-protocol#37
- Use non-try submit_intent in src_chain_unlisted_accepted_after_disabling_enforcement
  to silence unused-must-use lint (-D warnings)
- Run cargo fmt --all to normalise test.rs whitespace
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@cyberpunk30 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment