-
Notifications
You must be signed in to change notification settings - Fork 119
Add batch price update instruction to Oracle #142
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
Conversation
c53b763 to
62d85c8
Compare
jayantk
left a comment
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.
LGTM. I think there may be an issue with the compute limit (see inline), but addressing that would be a small change to the client code so not a big deal. Please let @Reisen review as well before merging.
program/src/oracle/oracle.c
Outdated
| } | ||
|
|
||
| // Verify that the correct number of accounts have been passed | ||
| if ( (prm->ka_num != 3 && prm->ka_num != 4) ) { |
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.
(not related to this change) would you happen to know why this lets you submit 4 accounts ? seems like a weird feature.
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.
Good question - I'm not sure. AFAICT pythd only ever sends 3 accounts, and the Oracle program doesn't ever use the 4th one. I can't see anywhere this is used, but maybe I'm missing something.
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.
I think an old version of the onchain program took a 'parameter' account which was removed in cd9dc8c
jayantk
left a comment
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.
Nice this should definitely work. Again would still like @Reisen to review before merging.
faf49d1 to
c3d96c8
Compare
jayantk
left a comment
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.
well, at this point, it's a tiny change, so feel free to merge even without @Reisen
Overview
This PR adds a new instruction to the Oracle:
cmd_upd_price_no_fail_on_error. This is exactly the same ascmd_upd_price, but never fails the instruction, and therefore the transaction, even if the update is unsuccessful. This is because we will soon send update instructions in batches, and want to prevent a failure in one price feed blocking updates of other prices.Approach
cmd_upd_price_no_fail_on_errorinstruction.pythdto sendcmd_upd_price_no_fail_on_errorJPRC requests instead ofcmd_upd_price.Testing
pythdchanges: the existingpythdintegration tests for the JRPCupdate_pricerequest will now cover the newe_cmd_upd_price_no_fail_on_errorcode paths.cmd_upd_price_no_fail_on_errorinstructions have been added, demonstrating the optimistic failure semantics.Caveats
All price update transactions will appear on-chain, even if they are unsuccessful. This means publishers will have to rely on inspecting publishing slots to be sure if their updates were successful.