Skip to content

[2.6] update_orderbook: handler, validation, state reconciliation, tests - #50

Merged
0xfave merged 1 commit into
mainfrom
update_orderbook-20
Jun 16, 2026
Merged

[2.6] update_orderbook: handler, validation, state reconciliation, tests#50
0xfave merged 1 commit into
mainfrom
update_orderbook-20

Conversation

@0xfave

@0xfave 0xfave commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Implements the update_orderbook instruction (Ticket 2.6).

Changes:

  • src/instruction.rs — Added UpdateOrderbookAccounts struct + TryFrom
  • src/processor.rs — Full handler with authority check, PDA validation, still-delegated guard, order_count reconciliation
  • tests/flux_dex_tests.rs — 3 tests: happy path, non-authority rejection, still-delegated rejection
  • docs/epics/epic-2-smart-contract.md — Marked ticket 2.6 as Done

Spec deviations:

  • Added still-delegated guard (reject if is_delegated == true) beyond the original spec — callers must undelegate first
  • Full order-by-order diff reconciliation deferred to Epic 4 (MagicBlock SDK)

Verification:

  • cargo fmt --check
  • cargo clippy ✓ (0 warnings)
  • cargo build-sbf
  • cargo test — 74/74 tests pass
  • CU: 6,403 (target: <20,000)

Closes #20

@0xfave
0xfave merged commit 165e963 into main Jun 16, 2026
3 checks passed
@0xfave
0xfave deleted the update_orderbook-20 branch June 16, 2026 10:09
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.6] update_orderbook()

1 participant