-
Notifications
You must be signed in to change notification settings - Fork 16
Aggregation v2 #296
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
Aggregation v2 #296
Conversation
ali-behjati
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.
Nice.
| ); | ||
| pub static ref ORACLE_PID: Pubkey = env_pubkey_or( | ||
| "ORACLE_PID", | ||
| "FsJ3A3u2vn5cTVofAjvy6y5kwABJAqYWpe4975bi2epH" |
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.
not for now, but seeing this i'm wondering whether in the future it makes sense to move the entire code in this file to pythnet_sdk
| // Insert into message buffer in reverse order to test that accumulator | ||
| // sorts first. |
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.
where are you reversing it :?
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 was left over after copy-paste. Removed.
| // TODO: New test functionality here. | ||
| // 1. Create Price Feed Accounts owned by ORACLE_PUBKEY | ||
| // 2. Populate Price Feed Accounts | ||
| // 3. Call update_v2() | ||
| // - Cases: | ||
| // - No V1 Messages, Only Price Accounts with no V2 | ||
| // - No V1 Messages, Some Price Accounts with no V2 | ||
| // - Some V1 Messages, No Price Accounts with no V2 | ||
| // - Some V1 Messages, Some Price Accounts with no V2 | ||
| // - Simulate PriceUpdate that WOULD trigger a real V1 aggregate before End of Slot | ||
| // - Simulate PriceUpdate that doesn't trigger a real V1 aggregate, only V2. |
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 this is outdated :?
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.
Yes. Removed.
ali-behjati
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.
Nice!
runtime/src/bank/pyth_accumulator.rs
Outdated
| ] | ||
| } | ||
|
|
||
| pub fn update_v1<'a>( |
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.
lifetime seems unnecessary
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.
Fixed.
| PostedMessageUnreliableData::deserialize(&mut wormhole_message_account.data()).unwrap(); | ||
|
|
||
| // Create MerkleAccumulator by hand to verify that the Wormhole message | ||
| // contents are correctg. |
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.
typo: correctg
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.
Fixed.
| .sorted_unstable() | ||
| .dedup() | ||
| .collect::<Vec<_>>(); | ||
|
|
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.
nitpick: I'd assert the length of messages here, to confirm they haven't been deduplicated
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.
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
* feat: accumulator v2 (wip 1) * feat: accumulator v2 (wip 2) * chore: fix some warnings and fix validator build * feat: accumulator v2 (wip 3) * feat: skip message buffer aggregation if all price feeds use v2 aggregation * feat: combine v1 and v2 aggregation price feed messages in the merkle tree * refactor: clean up and avoid extra vector * fix: don't aggregate if already aggregated in the program * test: bring back old pyth tests (wip) * test: fix old pyth tests * test: add initial v2 tests to validator * refactor: unify env var handling * chore: fix build for stable Rust by ignoring lints * test: fix and expand accumulator-v2 tests * chore: clean up comments * chore: update dependency * chore: fix clippy and fmt * test: add extra check * chore: bump version to 1.14.175 * feat: add more traces for accumulator * fix: load program accounts by index * feat: add checks to make sure indexes are set * chore: bump oracle Co-authored-by: Reisen <[email protected]>
bank.rsto a submodule and remove unnecessary arguments