fix: harden order lifecycle safety#14
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
hyperliquid-feedback | 5b43263 | May 16 2026, 01:52 PM |
There was a problem hiding this comment.
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_ofand (for schedule-cancel)yesargs, plus matching catalog/contract/registry fixture entries; enforced a 5s minimum--induration inprepare_schedule_cancel_plan. - Added a mainnet confirmation prompt for
orders schedule-canceland 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-ofinstead 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--yesis provided, and the scheduled timestamp is recomputed after confirmation so prompt time does not stale the request.What changed
--on-behalf-of/vaultAddressparity to order lifecycle commands beyond create/scale/batch-create.signer,acting_as,vault_address) with the acting account reported consistently.Validation
cargo fmtcargo check --message-format=shortcargo clippy -- -D warningscargo test --quiet