linera-protocol icon indicating copy to clipboard operation
linera-protocol copied to clipboard

[matching engine] Track pending orders on user chains

Open ma2bd opened this issue 2 weeks ago • 3 comments

Motivation

Allow users to display their pending orders without following the entire CLOB appchain

Proposal

  • Add a new type of message and a field of user chains
  • Replace Cancel orders by Modify with new quantity equal to 0
  • Simplify ModifyQuantity to avoid code duplication

Test Plan

CI

Release Plan

  • These changes should be backported to the latest testnet branch

ma2bd avatar Nov 16 '25 07:11 ma2bd

@MathieuDutSik: I think what you're suggesting would create a lot more overhead: Each user would have to read all events, rather than get notified about only the messages that concern their own orders.

Well, It depends on what we want to achieve:

  • Typically, when doing transactions, there aren't really that many transactions. The 1M achievement is just that, an achievement that has little relation to real usage. There are about 60K visa card transactions per second. So, the 1M is a little irrelevant. What is more important for payment is the latency.
  • So publishing all the transactions and reading them does not strike me as a bad idea.
  • The inconvenience of accessing pending_orders is that we have to parse the view and the BTreeMap. But yes, the managing of the orders is done by the contract.

MathieuDutSik avatar Nov 18 '25 14:11 MathieuDutSik

Sure, I'm not against also publishing all transactions in an event stream. I agree that could be useful, and I didn't mean to suggest that the overhead for the network would be large.

I just mean that for an individual user making an order it makes sense to me that there should be a low-overhead way to know their order status. This implementation provides that using a message. Subscribing to and filtering the event stream would be a lot more work for the client.

afck avatar Nov 18 '25 14:11 afck

This design of keeping track of the order structure inside of the Matching Engine is not the standard way that this is done.

I don't understand this comment

  1. We're only modifying the state of the application in user chains (acting as a client)
  2. We're not tracking new information

ma2bd avatar Nov 18 '25 14:11 ma2bd