Skip to content

fix: harden order lifecycle safety#14

Merged
wtfsayo merged 2 commits into
developfrom
fix/order-safety-parity
May 16, 2026
Merged

fix: harden order lifecycle safety#14
wtfsayo merged 2 commits into
developfrom
fix/order-safety-parity

Conversation

@wtfsayo
Copy link
Copy Markdown
Contributor

@wtfsayo wtfsayo commented May 16, 2026

Summary

Order lifecycle commands now carry the same acting-account context after creation, so subaccount and vault users can manage TP/SL, cancels, modifies, TWAPs, and schedule-cancel flows with --on-behalf-of instead of falling back to the selected signer account.

This also hardens orders schedule-cancel: short durations below Hyperliquid's 5 second minimum are rejected before signing, mainnet set/clear flows require confirmation unless --yes is provided, and the scheduled timestamp is recomputed after confirmation so prompt time does not stale the request.

What changed

  • Added --on-behalf-of / vaultAddress parity to order lifecycle commands beyond create/scale/batch-create.
  • Updated TP/SL and order lookup paths to query the acting account when a vault/subaccount selector is provided.
  • Switched lifecycle dry-runs to include signed context (signer, acting_as, vault_address) with the acting account reported consistently.
  • Marked schedule-cancel as prompt-confirmed in the command catalog and refreshed schema/registry fixtures.
  • Added integration coverage for schedule-cancel validation, mainnet confirmation, vaultAddress forwarding, and cancel-on-behalf lookup/signing behavior.

Validation

  • cargo fmt
  • cargo check --message-format=short
  • cargo clippy -- -D warnings
  • cargo test --quiet

Compound Engineering

Copilot AI review requested due to automatic review settings May 16, 2026 12:55
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 16, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
hyperliquid-feedback 5b43263 May 16 2026, 01:52 PM

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends --on-behalf-of / vaultAddress plumbing to order lifecycle commands (TP/SL, cancel, cancel-all, modify, TWAP create/cancel, schedule-cancel) so subaccount/vault users can manage orders with the correct acting account, and hardens orders schedule-cancel with a 5-second minimum duration check, mainnet confirmation prompt, and post-confirmation timestamp recomputation.

Changes:

  • Threaded vault_address: Option<Address> through order lifecycle handlers and switched their L1 action submissions and dry-run details to include the acting account context.
  • Added on_behalf_of and (for schedule-cancel) yes args, plus matching catalog/contract/registry fixture entries; enforced a 5s minimum --in duration in prepare_schedule_cancel_plan.
  • Added a mainnet confirmation prompt for orders schedule-cancel and recomputes the scheduled timestamp after confirmation; added integration tests covering validation, confirmation, vault forwarding, and cancel lookup-by-vault.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/commands/orders.rs Plumb vault_address into TP/SL, cancel(-all), modify, TWAP create/cancel, schedule-cancel; add mainnet confirmation helper and post-confirmation plan refresh.
src/commands/orders/args.rs Add on_behalf_of to lifecycle args structs and --yes to ScheduleCancelArgs.
src/commands/orders/planning.rs Take user: Address for position TP/SL lookup; enforce 5s minimum --in; include on_behalf_of in dry-run previews.
src/cli_runtime.rs Validate on-behalf-of selectors, resolve vault address per command, recognize schedule-cancel for prompt bypass / --yes, and emit signed dry-run details for lifecycle commands.
src/command_catalog.json Register on_behalf_of (and yes for schedule-cancel); flip schedule-cancel confirmation to prompt.
tests/fixtures/contracts/*.json Mirror catalog updates in schema/registry/inventory fixtures.
tests/cli_integration.rs Cover 5s minimum rejection, signer/vault context in schedule-cancel dry-run.
tests/orders_cancel_modify.rs Verify cancel --on-behalf-of queries and signs with the vault address.
tests/orders_list_twap.rs Cover mainnet schedule-cancel prompt abort/--yes bypass and vault address forwarding for set/clear.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@wtfsayo wtfsayo merged commit 9bf98d6 into develop May 16, 2026
3 of 4 checks passed
@wtfsayo wtfsayo deleted the fix/order-safety-parity branch May 16, 2026 17:06
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.

2 participants