Skip to content

Commit 0bb6502

Browse files
committed
chore: fix some warnings and fix validator build
1 parent e54872f commit 0bb6502

File tree

5 files changed

+70
-44
lines changed

5 files changed

+70
-44
lines changed

Cargo.lock

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

core/src/validator.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! The `validator` module hosts all the validator microservices.
22
33
pub use solana_perf::report_target_features;
4+
use solana_runtime::bank::pyth_accumulator;
45
use {
56
crate::{
67
accounts_hash_verifier::AccountsHashVerifier,
@@ -1521,15 +1522,12 @@ fn load_blockstore(
15211522
}
15221523
}
15231524

1524-
{
1525-
let bank = bank_forks.write().unwrap().working_bank();
1526-
for (key_name, pk_res) in bank.get_accumulator_keys() {
1527-
match pk_res {
1528-
Ok(pk) => info!("Accumulator {}: {}", key_name, pk),
1529-
Err(err) => {
1530-
error!("Failed to get Accumulator {}: {:?}", key_name, err);
1531-
std::process::abort();
1532-
}
1525+
for (key_name, pk_res) in pyth_accumulator::get_accumulator_keys() {
1526+
match pk_res {
1527+
Ok(pk) => info!("Accumulator {}: {}", key_name, pk),
1528+
Err(err) => {
1529+
error!("Failed to get Accumulator {}: {:?}", key_name, err);
1530+
std::process::abort();
15331531
}
15341532
}
15351533
}

ledger/src/blockstore.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4323,11 +4323,13 @@ pub fn make_chaining_slot_entries(
43234323
}
43244324

43254325
#[cfg(not(unix))]
4326+
#[allow(dead_code)] // No longer called.
43264327
fn adjust_ulimit_nofile(_enforce_ulimit_nofile: bool) -> Result<()> {
43274328
Ok(())
43284329
}
43294330

43304331
#[cfg(unix)]
4332+
#[allow(dead_code)] // No longer called.
43314333
fn adjust_ulimit_nofile(enforce_ulimit_nofile: bool) -> Result<()> {
43324334
// Rocks DB likes to have many open files. The default open file descriptor limit is
43334335
// usually not enough

runtime/src/bank.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ use {
158158
ops::{Deref, RangeInclusive},
159159
path::PathBuf,
160160
rc::Rc,
161-
str::FromStr,
162161
sync::{
163162
atomic::{
164163
AtomicBool, AtomicI64, AtomicU64, AtomicUsize,
@@ -199,7 +198,7 @@ mod builtin_programs;
199198
mod sysvar_cache;
200199
mod transaction_account_state_info;
201200

202-
mod pyth_accumulator;
201+
pub mod pyth_accumulator;
203202

204203
pub const SECONDS_PER_YEAR: f64 = 365.25 * 24.0 * 60.0 * 60.0;
205204

runtime/src/bank/pyth_accumulator.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use {
2020
pub const ACCUMULATOR_RING_SIZE: u32 = 10_000;
2121

2222
#[derive(Debug, thiserror::Error)]
23-
pub enum AccumulatorUpdateV2Error {
23+
pub enum AccumulatorUpdateErrorV2 {
2424
#[error("no oracle pubkey")]
2525
NoOraclePubkey,
2626
#[error("get_program_accounts failed to return accounts: {0}")]
@@ -282,13 +282,10 @@ fn post_accumulator_attestation(
282282
>,
283283
ring_index: u32,
284284
) -> std::result::Result<(), AccumulatorUpdateErrorV1> {
285-
use {
286-
pythnet_sdk::{
287-
pythnet,
288-
wormhole::{AccumulatorSequenceTracker, MessageData, PostedMessageUnreliableData},
289-
ACCUMULATOR_EMITTER_ADDRESS,
290-
},
291-
solana_sdk::borsh::try_from_slice_unchecked,
285+
use pythnet_sdk::{
286+
pythnet,
287+
wormhole::{AccumulatorSequenceTracker, MessageData, PostedMessageUnreliableData},
288+
ACCUMULATOR_EMITTER_ADDRESS,
292289
};
293290

294291
let accumulator_sequence_addr = env_pubkey_or(
@@ -392,14 +389,14 @@ fn post_accumulator_attestation(
392389
Ok(())
393390
}
394391

395-
pub fn update_v2(bank: &Bank) -> std::result::Result<(), AccumulatorUpdateV2Error> {
392+
pub fn update_v2(bank: &Bank) -> std::result::Result<(), AccumulatorUpdateErrorV2> {
396393
// 1. Find Oracle
397-
let oracle_pubkey = ORACLE_PUBKEY.ok_or(AccumulatorUpdateV2Error::NoOraclePubkey)?;
394+
let oracle_pubkey = ORACLE_PUBKEY.ok_or(AccumulatorUpdateErrorV2::NoOraclePubkey)?;
398395

399396
// 2. Find Oracle Accounts
400397
let accounts = bank
401398
.get_program_accounts(&oracle_pubkey, &ScanConfig::new(true))
402-
.map_err(AccumulatorUpdateV2Error::GetProgramAccounts)?;
399+
.map_err(AccumulatorUpdateErrorV2::GetProgramAccounts)?;
403400

404401
// 3. Filter for Price Accounts
405402
let accounts = accounts.iter().filter(|(_, account)| true);

0 commit comments

Comments
 (0)