Skip to content

Conversation

@Riateche
Copy link
Contributor

@Riateche Riateche commented Jul 9, 2024

  • Include oracle program as a dependency
  • Move all pyth functions from bank.rs to a submodule and remove unnecessary arguments
  • Aggregate prices and create price feed messages for price feeds with v2 aggregation enabled
  • Merge v1 and v2 messages and generate message accounts and wormhole accounts for all of them

Copy link
Collaborator

@ali-behjati ali-behjati left a 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"
Copy link
Collaborator

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

Comment on lines 739 to 740
// Insert into message buffer in reverse order to test that accumulator
// sorts first.
Copy link
Collaborator

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 :?

Copy link
Contributor Author

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.

Comment on lines 763 to 773
// 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.
Copy link
Collaborator

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 :?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Removed.

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

]
}

pub fn update_v1<'a>(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lifetime seems unnecessary

Copy link
Contributor Author

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: correctg

Copy link
Contributor Author

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<_>>();

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@Riateche Riateche merged commit a378583 into pyth-v1.14.17 Jul 24, 2024
@Riateche Riateche deleted the accumulator-v2 branch July 24, 2024 17:59
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Dec 19, 2024
* 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]>
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Dec 20, 2024
* 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]>
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Feb 1, 2025
* 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]>
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Feb 1, 2025
* 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]>
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Feb 4, 2025
* 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]>
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Feb 4, 2025
* 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]>
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Feb 4, 2025
* 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]>
ilya-bobyr pushed a commit to ilya-bobyr/pythnet that referenced this pull request Mar 6, 2025
* 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]>
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.

5 participants