Skip to content

refactor order circuit #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lispc opened this issue Mar 21, 2021 · 0 comments
Closed

refactor order circuit #126

lispc opened this issue Mar 21, 2021 · 0 comments
Assignees

Comments

@lispc
Copy link
Member

lispc commented Mar 21, 2021

decouple order id and merkle tree idx

Order id is like nonce, always incremental. User signed this id.

Meanwhile trade circuit uses idx of order merkle tree to fetch the order info then check trade price/amount against order info.

They are not same thing. After decoupling these two items, we can implement this #104

rewrite the order state transition login

These are the only valid transition methods:

  1. from empty slot to a new order
  2. from an old slot to a new order. Order with bigger id is newer.

The above two can be combined if we assume order_id:0 means empty order, real order starts with order id 1.

@lispc lispc changed the title refactor: decouple order id and merkle tree idx refactor order circuit Mar 26, 2021
@lispc lispc self-assigned this Mar 26, 2021
lispc added a commit that referenced this issue Apr 6, 2021
@lispc lispc closed this as completed Apr 25, 2021
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

No branches or pull requests

1 participant