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

crypto: fixes to TradingPair allocation and division of Amounts #2555

Merged
merged 7 commits into from
May 17, 2023

Conversation

redshiftzero
Copy link
Member

@redshiftzero redshiftzero commented May 12, 2023

Closes #2350

This PR:

  • Reworks the allocation of TradingPairVar (represents a TradingPair in R1CS), to note that we are intentionally not checking that the asset IDs are ordered as expected in the canonical representation of the out of circuit TradingPair. This is because we are only using the TradingPair's two asset IDs in the swap commitment integrity check, which will fail if the asset IDs are switched.
  • Fixes two issues with the R1CS implementation of Euclidean division of AmountVars, where we now ensure that the remainder cannot equal the divisor, and that the divisor is non-zero.
  • Adds tests for all circuits to ensure that the parameters and circuits are in sync, i.e. that a circuit-breaking change has not unintentionally been made.

@redshiftzero redshiftzero force-pushed the zk-trading-pair-order branch from 059367f to 3ad3231 Compare May 12, 2023 19:19
@redshiftzero redshiftzero changed the title crypto: fixes to TradingPair allocation and division of Amounts wip: fixes to TradingPair allocation and division of Amounts May 12, 2023
@redshiftzero redshiftzero force-pushed the zk-trading-pair-order branch from 3ad3231 to 77521fd Compare May 16, 2023 18:15
@redshiftzero redshiftzero temporarily deployed to smoke-test May 16, 2023 18:15 — with GitHub Actions Inactive
@redshiftzero redshiftzero force-pushed the zk-trading-pair-order branch from 77521fd to cfc4332 Compare May 17, 2023 03:23
@redshiftzero redshiftzero force-pushed the zk-trading-pair-order branch from cfc4332 to e1cd4df Compare May 17, 2023 03:26
@redshiftzero redshiftzero temporarily deployed to smoke-test May 17, 2023 03:26 — with GitHub Actions Inactive
@redshiftzero redshiftzero changed the title wip: fixes to TradingPair allocation and division of Amounts crypto: fixes to TradingPair allocation and division of Amounts May 17, 2023
@redshiftzero redshiftzero merged commit 4165077 into main May 17, 2023
@redshiftzero redshiftzero deleted the zk-trading-pair-order branch May 17, 2023 04:08
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

Successfully merging this pull request may close these issues.

check and document all constraints added after out of circuit computation
1 participant