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

Create Swap Instruction #30

Merged
merged 10 commits into from Mar 22, 2022
Merged

Create Swap Instruction #30

merged 10 commits into from Mar 22, 2022

Conversation

jhlx
Copy link
Contributor

@jhlx jhlx commented Dec 20, 2021

todo:

  • add swap to typescript sdk
  • add to performance tests (right now only in functional test)


check_accounts(program_id, &market_state, &accounts).unwrap();
let callback_info = CallBackInfo {
user_account: Pubkey::default(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe can change callbackinfo to use Option instead, but that felt messy (had to update a bunch of places, change CALLBACK_INFO_LEN, etc.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good you didn't do it, there really is no benefit in using an Option here :

  • Requires an extra byte to encode (which means every node in the critbit tree is just that little bit larger => more expensive to deploy new markets)
  • The only benefit of using an option is that option::is_some is inherently faster than Pubkey::eq, but we actually never perform the expensive comparison between that key and Pubkey::default

@ellttBen
Copy link
Contributor

For now this LGTM, I'll wait for the TS side to be done as well before final review and merge.

@dr497 dr497 merged commit bf23fc2 into Bonfida:main Mar 22, 2022
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.

None yet

3 participants