linera-protocol
linera-protocol copied to clipboard
[matching engine] Track pending orders on user chains
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
Cancelorders byModifywith new quantity equal to0 - Simplify
ModifyQuantityto avoid code duplication
Test Plan
CI
Release Plan
- These changes should be backported to the latest
testnetbranch
@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_ordersis that we have to parse the view and theBTreeMap. But yes, the managing of the orders is done by the contract.
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.
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
- We're only modifying the state of the application in user chains (acting as a client)
- We're not tracking new information