[Serum] Populate seqNum on Event and implement loadFillsSince#195
Open
lidatong wants to merge 2 commits intoproject-serum:masterfrom
Open
[Serum] Populate seqNum on Event and implement loadFillsSince#195lidatong wants to merge 2 commits intoproject-serum:masterfrom
seqNum on Event and implement loadFillsSince#195lidatong wants to merge 2 commits intoproject-serum:masterfrom
Conversation
seqNum on Event and implement loadFillsSince
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
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.
Thank you for implementing this client library for Serum! I really appreciate the open-source efforts to make the Dex accessible, and I'd like to make my own contribution.
Description
This PR makes two changes:
seqNumon theEventtype indecodeEventQueueloadFillsSinceWhy
It appears based on
git blamethatseqNumwas added afterdecodeEventQueue, anddecodeEventQueuewas never updated.I think it would be useful to populate the
seqNumgiven it is available as a field, and there isn't a way to uniquely determine whether you've processed aFillwithout it.I also implemented an additional
loadFillsSinceAPI function, since there is already functionality todecodeEventsSince, and I think it would useful to be able toloadFillsSincea givenseqNumTesting
I manually against the Serum Validator node:
https://solana-api.projectserum.com
Goal was to test that the
seqNumis calculated correctly, being careful to make sure it handles theu32overflowcase.Here is a sample test output. Notice that head
seqNumis26178226,countis4, user-requestedlimitis5.Doing the logic and calculating the expected case by hand:
Header seqNum:
26178226Count:
4Ending seqNum:
26178226 + 4 - 1 = 26178229Starting seqNum:
endSeqNum - limit = 26178225The test output below correctly indicates the modified
decodeEventQueuereturns5 fill eventswith theseqNumstarting from26178225: