project-serum / serum-dex

Project Serum Rust Monorepo
https://projectserum.com
Apache License 2.0
629 stars 329 forks source link

Settlement compute optimization #132

Open armaniferrante opened 3 years ago

armaniferrante commented 3 years ago

As suggested by @dafyddd,

It would help if Serum DEX did a slight optimization for us on their SettleFunds instruction. They would need to check if fee rebate token account is same as user's quote currency account and only send one Token Transfer instruction in that case. Right now they send two and it costs more compute

dafyddd commented 3 years ago

I actually think this is not a priority now. I was able to get around our compute issue by sending a Settle instruction first then sending our PlaceAndSettle instruction.

dafyddd commented 3 years ago

The latest commit in our repo makes this recommended change and also increments the open_orders. referrer_rebates_accrued at the time of trade instead of at the time of event queue processing. Here's the commit: https://github.com/blockworks-foundation/serum-dex/commit/b76d4f9ec597e73ed1d73dab46fc51b0e3a41c9c

dafyddd commented 3 years ago

I'm kind of trash with git--what's the easiest way to send just that commit to you as a PR?

dafyddd commented 3 years ago

Ok here is the pull request with the cherry picked commit: https://github.com/project-serum/serum-dex/pull/149