-
Notifications
You must be signed in to change notification settings - Fork 340
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
Add CloseMarket function to redeem rent from permissioned markets #191
base: master
Are you sure you want to change the base?
Conversation
Added an anchor test directory that initializes a market and shuts it down again, then checks that the sol is retrieved. It's not ready for merging yet though. There needs to be more discussion of what checks are needed before the rent is retrieved. Right now though the core functions are there and there's a working test. So fitting in any requested changes ought to be straightforward. We will see though! Next up
Ok, it looks like it's possible to load up request queue and event queue then check their headers to ensure Update: Added checks that load the headers for all four queue structs and checks that their counts are empty. |
What the code currently does is correct. The event queue can check the header count and the bid/asks slabs can check the leaf_count. |
Ok, added the disabled flag. Going to start adding more comprehensive testing. It looks like the permissioned markets set of tests are failing because they're not using solana 1.9.0 |
…nto CloseMarkets
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.
Finished add close market and a more full set of tests
@armaniferrante Ran a full set of tests on the new close market functionality. close_markets doesn't allow markets to be closed while
And even more importantly
|
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.
Need to add the tests to travis CI
**bids_acc.lamports.borrow_mut() = 0; | ||
**asks_acc.lamports.borrow_mut() = 0; | ||
|
||
market.account_flags = market.account_flags | (AccountFlag::Disabled as u64); |
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.
Should use Closed
instead of Disabled
.
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.
Serum already has the functionality for Disabled
built in from the ability to manually shutdown. I didn't find anything similar for Closed
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.
https://github.com/project-serum/serum-dex/blob/master/dex/src/state.rs#L1884 - Here's where new order
already checks for whether a market is disabled. Is this functionality different from closing? It's possible I haven't fully understood the full extent of what the disable
flag affects
Travis CI tests added. Arguably we still haven't come to a good conclusion on the use of I wanted to keep the actual changes made to the dex as minimal as possible. However, if it's necessary we can re-use the |
bump sers @Henry-E @armaniferrante pls help 🥏 |
up @Henry-E @armaniferrante |
bump |
what's the status of this? Any forthcoming plans to try to include this feature soon? |
bump |
Currently a placeholder pull request for adding a close market function.
Still TODO
Questions for @armaniferrante
market closed
flag to markets so that it's clear the market is shutdown?Things I will add
Add CloseMarkets to the permissioned markets proxy exampleAdd a test to the permissioned markets javascript testsPlus any other code review and additional checks that need to be added to the function.
The pull request is mainly based on existing examples from how
CloseOpenOrders
andPrune
functions were implemented.