-
Notifications
You must be signed in to change notification settings - Fork 110
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
Support aggregation in validator #410
Conversation
Riateche
commented
Jul 9, 2024
•
edited
Loading
edited
- Change dependency versions to make the crate compatible with pythnet validator
- Add flags to price account to track transition from v1 to v2
- Implement transition between v1 and v2 by calling add_publisher with a special pubkey
- Skip aggregation and message buffer update in the oracle program if v2 aggregation is enabled
- Clear message buffers after transition to v2
- Expose aggregation as a library function to be used in the validator
…ggregation errors
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.
left a few minor comments and one maybe significant question -- see inline
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 as Jayant said, would be nice to test the validator update code path too.
…ges until v1 buffer is cleared
I think there might be an edgecase where the price stops aggregating (both v1 and v2).
Next slot:
And so on... |
Good catch! I've changed the code so that the |
9065d7b
to
216eee6
Compare
update_clock_slot(&mut clock_account, 2); | ||
|
||
validator::aggregate_price(2, 102, price_account.key, *price_account.data.borrow_mut()) | ||
.unwrap(); |
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.
nit: can we once verify the output of this as well?
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.
Added some output checks.
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!
] | ||
}; | ||
|
||
// Append a TWAP message if available |
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.
this comment seems like it doesn't apply to anything
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.
Looks like it's no longer relevant. Removed.