-
Notifications
You must be signed in to change notification settings - Fork 102
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
feat(oracle): WIP add scores account #407
base: main
Are you sure you want to change the base?
Conversation
@@ -21,6 +21,8 @@ extern "C" { | |||
#define PC_PUBKEY_SIZE 32 | |||
#define PC_PUBKEY_SIZE_64 (PC_PUBKEY_SIZE/sizeof(uint64_t)) | |||
#define PC_MAP_TABLE_SIZE 640 | |||
#define PC_MAX_PUBLISHERS 256 | |||
#define PC_MAX_SYMBOLS 1024 |
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.
what we do if we exceed this numbers?
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.
That sounds like a Pythnet v2 problem anyway
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.
The program doesn't allow exceeding these numbers, we will probably face a lot of issues if we decide to increase these numbers. We are hoping to go to pythnet V2 before we need to increase these numbers. From the trasactions limit that we currently have, i don't think this will an issue.
But if you think there is a chance that we exceed these number before pythnet v2, we better address it now.
program/rust/src/accounts/score.rs
Outdated
pub publisher_permissions: [[u64; PC_MAX_SYMBOLS_64 as usize]; PC_MAX_PUBLISHERS as usize], | ||
pub scores: [f64; PC_MAX_PUBLISHERS as usize], | ||
pub publishers: [Pubkey; PC_MAX_PUBLISHERS as usize], | ||
pub symbols: [Pubkey; PC_MAX_SYMBOLS as usize], |
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.
We actually already have something similar to this (a list of all symbols) in the mapping account but the product accounts (and not the price accounts) are listed there
program/rust/src/accounts/score.rs
Outdated
self.publisher_permissions[x][y / 64] |= 1 << (y % 64); | ||
} else { | ||
self.publisher_permissions[x][y / 64] &= !(1 << (y % 64)); | ||
} |
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.
get_publisher_permission
and set_publisher_permission
could almost be in their own struct PermissionTable, that we can proptest
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 will try this at some point to see how much it will change the program size, my current guess is that it will increase it.
program/rust/src/accounts/score.rs
Outdated
pub symbols: [Pubkey; PC_MAX_SYMBOLS as usize], | ||
} | ||
|
||
impl PublisherScoresAccount { |
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 struct is begging for a prop test like in this https://github.com/pyth-network/pyth-client/blob/main/program/rust/src/tests/test_twap.rs#L50
@@ -93,139 +102,26 @@ pub fn add_publisher( | |||
price_data.num_ += 1; | |||
|
|||
// Sort the publishers in the list |
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.
Update this comment
No description provided.