Skip to content

Commit 836ff8a

Browse files
RiatecheReisen
authored andcommitted
Aggregation v2 (pyth-network#296)
* 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 <reisen@morphism.org>
1 parent e32dbbb commit 836ff8a

File tree

14 files changed

+2087
-1350
lines changed

14 files changed

+2087
-1350
lines changed

Cargo.lock

Lines changed: 317 additions & 481 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ exclude = [
9797
# This prevents a Travis CI error when building for Windows.
9898
resolver = "2"
9999

100-
[patch.crates-io]
101-
serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1" }
100+
# At the moment, there is no `oracle-v2.33.1` release in the
101+
# `pyth-network/pyth-client` repository. This is an unreleased version that is
102+
# almost identical to `oracle-v2.33.0`, except that it removes strict version
103+
# constraints from the Solana dependencies.
104+
#
105+
[patch."https://github.com/pyth-network/pyth-client".pyth-oracle]
106+
git = "https://github.com/ilya-bobyr/pyth-client"
107+
branch = "pythnet-update-oracle-v2.33.1"
102108

109+
[patch.crates-io]
103110
# We include a number of crates as our dependencies above from crates.io:
104111
#
105112
# * spl-associated-token-account

core/src/validator.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ use {
7676
accounts_db::{AccountShrinkThreshold, AccountsDbConfig},
7777
accounts_index::AccountSecondaryIndexes,
7878
accounts_update_notifier_interface::AccountsUpdateNotifier,
79-
bank::Bank,
79+
bank::{pyth_accumulator, Bank},
8080
bank_forks::BankForks,
8181
commitment::BlockCommitmentCache,
8282
cost_model::CostModel,
@@ -1535,15 +1535,12 @@ fn load_blockstore(
15351535
}
15361536
}
15371537

1538-
{
1539-
let bank = bank_forks.write().unwrap().working_bank();
1540-
for (key_name, pk_res) in bank.get_accumulator_keys() {
1541-
match pk_res {
1542-
Ok(pk) => info!("Accumulator {}: {}", key_name, pk),
1543-
Err(err) => {
1544-
error!("Failed to get Accumulator {}: {:?}", key_name, err);
1545-
std::process::abort();
1546-
}
1538+
for (key_name, pk_res) in pyth_accumulator::get_accumulator_keys() {
1539+
match pk_res {
1540+
Ok(pk) => info!("Accumulator {}: {}", key_name, pk),
1541+
Err(err) => {
1542+
error!("Failed to get Accumulator {}: {:?}", key_name, err);
1543+
std::process::abort();
15471544
}
15481545
}
15491546
}

0 commit comments

Comments
 (0)