Skip to main content
A reprice is only useful if it actually lands before a stale price can be traded against. ordr.trade uses two separate protections together to make that true: one that runs inside the program itself, and one that runs at the block-building layer through Jito.

The sequence number, on chain

Every market account stores last_seqno, the sequence number of the most recent accepted update_mid call. Each update_mid instruction carries its own incoming sequence number, and the program only accepts it if that number is strictly greater than the one already stored. This matters because a maker’s reprice transactions are not guaranteed to land in the order they were sent. A transaction can be dropped and retried, or simply arrive late. Without a check, a late transaction carrying an old mid price could land after a newer one and silently roll the book back to a stale price, which is exactly the opening a sniping bot would want. With the check, that late transaction is rejected instead: the book’s price can only ever move forward in sequence, never backward. This check is cheap enough to live entirely in the hand-written assembly behind update_mid, alongside checks that the new mid is non-zero and that the caller is the market’s authority. The whole instruction, including the sequence number check, runs in 33 compute units. The sequence number also marks time for the same-slot flow protection described on the Matching Engine page: the amount of flow that curve has seen is only ever counted since the current sequence number, so it resets to zero the instant a maker reprices.

Priority ordering, through Jito’s ACE

A correct sequence number does not help if a maker’s cancel or reprice transaction never gets a fair chance to land ahead of a taker’s transaction in the same slot. For that, ordr.trade uses ACE (Application Controlled Execution), a feature from Jito, to make sure a maker’s own cancel and reprice transactions are given priority ordering ahead of other transactions trying to trade against that same market in the same block. Put together, the two protections cover both directions: ACE gives a maker’s reprice the best chance of landing first, and the on-chain sequence number check makes sure that even if something still lands out of order, an old price can never overwrite a newer one.