Skip to content

Conversation

guibescos
Copy link
Contributor

@guibescos guibescos commented Aug 8, 2022

Adding publishers in rust.

@guibescos guibescos marked this pull request as ready for review August 8, 2022 20:41
Copy link
Contributor

@jayantk jayantk left a 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.

) -> 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_)
Copy link
Contributor

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

return Err(ProgramError::InvalidArgument);
}

let [_funding_account, price_account] = match accounts {
Copy link
Contributor

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) {
Copy link
Contributor

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)

@guibescos guibescos merged commit b515715 into main Aug 9, 2022
@guibescos guibescos deleted the rust/add-publisher branch August 9, 2022 15:26
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.

2 participants