-
Notifications
You must be signed in to change notification settings - Fork 15
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
Batch publish #313
Batch publish #313
Conversation
Riateche
commented
Jul 31, 2024
•
edited
Loading
edited
- Read published prices from publishers' accounts and apply them to price feed accounts
- Add minimal CI
a1fd3c8
to
6982f90
Compare
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.
It looks very good to me. I like to see how the program will work.
runtime/src/bank/pyth/accumulator.rs
Outdated
@@ -132,6 +146,7 @@ pub fn get_accumulator_keys() -> Vec<( | |||
"STAKE_CAPS_PARAMETERS_ADDR", | |||
Ok(*STAKE_CAPS_PARAMETERS_ADDR), | |||
), | |||
("BATCH_PUBLISH_PID", Ok(*BATCH_PUBLISH_PID)), |
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 recommend we rename this function and move it to mod.rs
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.
Done.
@@ -427,21 +442,34 @@ pub fn update_v2(bank: &Bank) -> std::result::Result<(), AccumulatorUpdateErrorV | |||
v2_messages.push(publisher_stake_caps_message); | |||
} | |||
|
|||
let mut measure = Measure::start("update_v2_aggregate_price"); | |||
let mut new_prices = batch_publish::extract_batch_publish_prices(bank).unwrap_or_else(|err| { |
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.
let's have a measure for this too.
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.
Added.
}; | ||
|
||
#[test] | ||
fn test_batch_publish() { |
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.
if feed index of 0 is permitted we can add tests with that and make sure that it doesn't work.
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.
Expanded the test to make sure prices with feed_index == 0 are not applied.
--- Batch publish (pyth-network#313) * feat: batch publish * feat: batch publish 2 (wip) * feat: verify that price feed index is set * refactor: add pyth module * feat: integrate pyth-price-publisher * refactor: rename and move get_accumulator_keys * test: make sure batch publish does not apply prices when price_index == 0 * chore: fix format * fix: update deps --- Update dependency, program id and test for pyth-price-store (pyth-network#314) * test: modify batch publish tests * chore: use real batch publish pid as default * chore: update pyth-price-store dependency --- Rename price store env var and bump version (pyth-network#315) * chore: rename variable for pyth store pid * chore: bump pythnet version to 1.14.179
--- Batch publish (pyth-network#313) * feat: batch publish * feat: batch publish 2 (wip) * feat: verify that price feed index is set * refactor: add pyth module * feat: integrate pyth-price-publisher * refactor: rename and move get_accumulator_keys * test: make sure batch publish does not apply prices when price_index == 0 * chore: fix format * fix: update deps --- Update dependency, program id and test for pyth-price-store (pyth-network#314) * test: modify batch publish tests * chore: use real batch publish pid as default * chore: update pyth-price-store dependency --- Rename price store env var and bump version (pyth-network#315) * chore: rename variable for pyth store pid * chore: bump pythnet version to 1.14.179