-
Notifications
You must be signed in to change notification settings - Fork 119
Upd price in rust #248
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
Upd price in rust #248
Conversation
| #[error("InvalidWritableAccount")] | ||
| InvalidWritableAccount = 607, | ||
| #[error("InvalidWritableAccount")] | ||
| #[error("InvalidFreshAccount")] |
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 message was a typo
| # Compile C code to system architecture for use by rust's cargo test | ||
| $(CC) -c ./src/oracle/for_cargo_test/cpyth_test.c -o ./target/cpyth_test.o | ||
| gcc -c ./src/oracle/for_cargo_test/cpyth_test.c -o ./target/cpyth_test.o | ||
| # Bundle C code compiled to system architecture for use by rust's cargo test |
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.
Had to change this back... maybe $CC in the context of this makefile has the bpf flags?
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.
hmmm ok weird. i'm not really sure how this whole makefile process works, tbh.
jayantk
left a comment
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.
awesome. Left you some minor comments
Also, are you going to delete the now unused C implementations?
| # Compile C code to system architecture for use by rust's cargo test | ||
| $(CC) -c ./src/oracle/for_cargo_test/cpyth_test.c -o ./target/cpyth_test.o | ||
| gcc -c ./src/oracle/for_cargo_test/cpyth_test.c -o ./target/cpyth_test.o | ||
| # Bundle C code compiled to system architecture for use by rust's cargo test |
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.
hmmm ok weird. i'm not really sure how this whole makefile process works, tbh.
| ) | ||
| } | ||
|
|
||
| pub fn is_component_update(cmd_args: &cmd_upd_price_t) -> Result<bool, ProgramError> { |
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.
why "component"?
also, the argument to this is confusing because if you have a cmd_upd_price_t, you would expect its cmd_ field to be the corresponding int.
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.
Component as opposed to aggregate.
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 one is tricky : the dispatcher routes upd_price, upd_price_no_fail_on_error and agg_price to this function . The first two update the individual publisher's price, unlike agg_price which only tries to update the aggregate.
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.
ah gotcha. this is fine
jayantk
left a comment
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.
awesome!
| ) | ||
| } | ||
|
|
||
| pub fn is_component_update(cmd_args: &cmd_upd_price_t) -> Result<bool, ProgramError> { |
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.
ah gotcha. this is fine
upd_pricein rust.Also moved 3 unit tests from C to Rust.
The boundary between C and Rust becomes the
upd_aggregatefunction