Skip to content
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

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open

feat(oracle): WIP add scores account #407

wants to merge 39 commits into from

Conversation

keyvankhademi
Copy link

No description provided.

@@ -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
Copy link
Collaborator

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?

Copy link
Contributor

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

Copy link
Author

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.

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],
Copy link
Contributor

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

self.publisher_permissions[x][y / 64] |= 1 << (y % 64);
} else {
self.publisher_permissions[x][y / 64] &= !(1 << (y % 64));
}
Copy link
Contributor

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

Copy link
Author

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.

pub symbols: [Pubkey; PC_MAX_SYMBOLS as usize],
}

impl PublisherScoresAccount {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -93,139 +102,26 @@ pub fn add_publisher(
price_data.num_ += 1;

// Sort the publishers in the list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants