-
Notifications
You must be signed in to change notification settings - Fork 116
Add price rust #220
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
Add price rust #220
Conversation
…t into migrate_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.
lgtm, will approve once you merge/rebase
program/rust/src/rust_oracle.rs
Outdated
) -> OracleResult { | ||
if instruction_data.len() < size_of::<cmd_add_price_t>() { | ||
return Err(ProgramError::InvalidArgument); | ||
} |
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 we should put this check into load
program/rust/src/rust_oracle.rs
Outdated
if product_data.magic_ != PC_MAGIC | ||
|| product_data.ver_ != cmd_args.ver_ | ||
|| product_data.type_ != PC_ACCTYPE_PRODUCT | ||
|| price_data.magic_ != 0 |
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.
One thing i've noticed from doing this translation exercise is that the check for whether an account is uninitialized differs in all of the instructions. init_mapping
checks both the magic and ver fields, but add_account
only checks the magic. I think it should be fine for us to standardize on one of these and encode that in validate_fresh_account
.
program/rust/src/rust_oracle.rs
Outdated
.next_ | ||
.k1_ | ||
.copy_from_slice(&next_mapping.key.to_bytes()); | ||
pubkey_assign(cur_mapping.next_, &next_mapping.key.to_bytes()); |
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.
🙇
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.
nice
Add price instruction in Rust.