-
Notifications
You must be signed in to change notification settings - Fork 45
Implement AMM 2.0-light #1092
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
Merged
Merged
Implement AMM 2.0-light #1092
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Chralt98
reviewed
Oct 2, 2023
Contributor
|
This pull request is now in conflicts. Could you fix it @maltekliemann? 🙏 |
Chralt98
reviewed
Oct 4, 2023
Chralt98
reviewed
Oct 4, 2023
Chralt98
previously approved these changes
Oct 4, 2023
sea212
reviewed
Oct 6, 2023
Contributor
sea212
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, however I would separate the weight updates into another PR as they bloat the merge commit with unrelated changes.
Contributor
|
This pull request is now in conflicts. Could you fix it @maltekliemann? 🙏 |
sea212
approved these changes
Oct 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does it do?
Implements AMM 2.0-light according to internal design documents.
What important points should reviewers know?
do_*function, which should contain absolutely no signing or weight logic. Sometimes this results in a double DB reads. A solution is proposed here: Research performance cost of duplicate reads and implement a solution if necessary #1081exitrequires a market to exist. Thus, destroying the underlying market makes the pool defunct. I see no need to make any changes to market destruction.extra_weightstuff because it's Rikiddo-only.Poolstruct to avoid griefing attacks: Sending funds to the pool can be used to change balances and thus prices. Doesn't seem to be profitable, but certainly very annoying.< EDis sent to an empty pool account and the entire transaction errors out. This doesn't affect non-native collateral because we're just whitelisting these accounts from dust collection. Native currency doesn't seem to support whitelisting, although I'm getting mixed signals (or I'm just dumb): Add a dust removal whitelist topallet-balancesparitytech/polkadot-sdk#227, https://substrate.stackexchange.com/questions/9824/reaping-vs-dusting-and-how-to-whitelist-an-account.Is there something left for follow-up PRs?
Follow-up PRs will do the following:
math.rs.zrml-prediction-marketsbenchmarks and definezrml-neo-swapsbenchmarksWhat alternative implementations were considered?
None.
Are there relevant PRs or issues?
Strangely enough, this PR doesn't close any issues. Please refer to the design document for more details.
References
Things I've Learned
Config. Don't be a hero and try to make the struct independent ofConfig. Otherwise, type inferrence and error handling is an utter mess.Pool.