Skip to content
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

research(contracts): Order.Data struct (aka GPv2Order.Data) #3

Open
3 tasks
mfw78 opened this issue Oct 30, 2023 · 2 comments
Open
3 tasks

research(contracts): Order.Data struct (aka GPv2Order.Data) #3

mfw78 opened this issue Oct 30, 2023 · 2 comments

Comments

@mfw78
Copy link
Contributor

mfw78 commented Oct 30, 2023

Problem

There have been some limitations observed in the current GPv2Order.Data struct that have led to issues such as circular hashing.

Acceptance criteria

  • Proposed struct parameters meet current and future use cases
  • Free of circular hashing problems
  • Capable of being generated on-chain (ie. no fields are the result of some arbitrary off-chain calculation / hashing).

Details

TBD

Possible Solutions

TBD

Research track

  • Developer experience
@mfw78
Copy link
Contributor Author

mfw78 commented Oct 30, 2023

Suggest to include a field that is a nullifier. IE. on a a discrete order being settled by the settlement contract, storage slot nullifiers[from][nullifierFromOrderData] = true.

This would allow for easily reasoned "one-cancels-the-other", and would actually be supported by any signing scheme.

Optionally, could also introduce a trade flag that allows for this logic to be inverted (only trade if the nullifer has been nullified). This allows for logic such as "one-creates-another".

Overall this would drastically reduce the complexity required when reasoning about conditional orders that generally either require some storage slot used on some specific handler contract, or relies upon the filledAmount in the settlement contract (which in and of itself creates issues with freeFilledAmountStorage).

@fleupold
Copy link

Suggest to include a field that is a nullifier. IE. on a a discrete order being settled by the settlement contract, storage slot nullifiers[from][nullifierFromOrderData] = true.

Wouldn't this potentially cause problems with programmatic orders where a malicious observer could potentially front run any orders placed by a watch tower with random other orders for the same nullifier?

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

2 participants