-
Notifications
You must be signed in to change notification settings - Fork 115
Rust/add publisher #229
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
Rust/add publisher #229
Conversation
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 good to me, just a couple nitpicks.
program/rust/src/rust_oracle.rs
Outdated
) -> OracleResult { | ||
let cmd_args = load::<cmd_add_publisher_t>(instruction_data)?; | ||
|
||
if instruction_data.len() != size_of::<cmd_add_publisher_t>() || pubkey_is_zero(&cmd_args.pub_) |
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.
use pyth_assert for these checks
program/rust/src/rust_oracle.rs
Outdated
return Err(ProgramError::InvalidArgument); | ||
} | ||
|
||
let [_funding_account, price_account] = match accounts { |
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.
_ prefix indicates the variable isn't used later in the function, but _funding_account is
return Err(ProgramError::InvalidArgument); | ||
} | ||
|
||
for i in 0..(price_data.num_ 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.
(i'm going to look at whether we can override some of the field definitions in the struct so they're usize instead of u32 so we don't have to do these casts all the time)
Adding publishers in rust.