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

Make account checks optional to enable multiple slabs operate against a single orderbook and event_queue account #57

Open
crocodiledundalk opened this issue May 3, 2022 · 2 comments

Comments

@crocodiledundalk
Copy link

Our use case (for multi-outcome prediction markets) involves multiple homogenous orderbooks 'stacked', where a market instance consist of N prediction contracts (the base assets) traded against a quote asset. The most common case stems from sports where you have 3 outcomes (and orderbooks) for Home/Away/Draw - however, you can imagine more extreme scenarios like F1 or horse racing, where 30+ outcomes in the same market is not unusual.

Other than differentiating that each orderbook is in respect of a different 'outcome' in the market, the orderbooks are the same, and properties stored within the orderbook account are common for all slabs - i.e. callback_id_len, callback_info_len, fee_budget, initial_lamports, min_base_order_size, tick_size, cranker_reward could will all be consistent for all orderbook instances in the same market.

Similarly, the only distinction implied by having N event_queues is which outcome a given event relates to, which must be known in order to appropriately settle the correct user balances. It would streamline our calling program and cranking process massively if instead we could write all events (regardless of which slab they stemmed from) to the same event_queue, and instead identify the outcome with a u8 value which could be stored in callback_info.

To facilitate this, we would need to make the following checks within check_accounts optional and ensure consistency between slab accounts and their intended use within the calling program.
check_account_key(accounts.bids, &market_state.bids, AoError::WrongBidsAccount)?;
check_account_key(accounts.asks, &market_state.asks, AoError::WrongAsksAccount)?;

@Henry-E
Copy link

Henry-E commented May 5, 2022

Making accounts check optional seems dangerous. You should look into writing your own new order function maybe?

Cool idea to have a single event queue for multiple order books though. The event queue is pretty generic so this should work no problem?

@tomland123
Copy link

Extremely cool idea, but I dont think there is any feature that would make me feel comfortable with making those accounts optional.

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

3 participants