Skip to content

Commit

Permalink
Merge branch 'master' into secp256r1-precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRigel authored Nov 6, 2024
2 parents 1522fcc + 03f0b00 commit 7f54c62
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 477 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/downstream-project-spl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ env:

jobs:
check:
if: github.repository == 'anza-xyz/agave'
# if: github.repository == 'anza-xyz/agave'
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -61,6 +62,7 @@ jobs:
cargo check
test:
if: false
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -123,6 +125,7 @@ jobs:
done
cargo-test-sbf:
if: false
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ members = [
"core",
"cost-model",
"curves/*",
"define-syscall",
"dos",
"download-utils",
"entry",
"faucet",
"fee",
"frozen-abi",
"frozen-abi/macro",
"genesis",
"genesis-utils",
"geyser-plugin-interface",
Expand All @@ -57,7 +54,6 @@ members = [
"local-cluster",
"log-analyzer",
"log-collector",
"logger",
"measure",
"memory-management",
"merkle-root-bench",
Expand Down Expand Up @@ -112,17 +108,21 @@ members = [
"sdk/commitment-config",
"sdk/cpi",
"sdk/decode-error",
"sdk/define-syscall",
"sdk/derivation-path",
"sdk/epoch-rewards",
"sdk/epoch-schedule",
"sdk/feature-set",
"sdk/fee-calculator",
"sdk/fee-structure",
"sdk/frozen-abi",
"sdk/frozen-abi/macro",
"sdk/gen-headers",
"sdk/hash",
"sdk/inflation",
"sdk/instruction",
"sdk/keypair",
"sdk/logger",
"sdk/macro",
"sdk/msg",
"sdk/native-token",
Expand All @@ -147,6 +147,7 @@ members = [
"sdk/serde-varint",
"sdk/serialize-utils",
"sdk/sha256-hasher",
"sdk/short-vec",
"sdk/signature",
"sdk/signer",
"sdk/slot-hashes",
Expand All @@ -156,7 +157,6 @@ members = [
"sdk/time-utils",
"sdk/transaction-error",
"send-transaction-service",
"short-vec",
"stake-accounts",
"storage-bigtable",
"storage-bigtable/build-proto",
Expand Down Expand Up @@ -430,7 +430,7 @@ solana-cost-model = { path = "cost-model", version = "=2.2.0" }
solana-cpi = { path = "sdk/cpi", version = "=2.2.0" }
solana-curve25519 = { path = "curves/curve25519", version = "=2.2.0" }
solana-decode-error = { path = "sdk/decode-error", version = "=2.2.0" }
solana-define-syscall = { path = "define-syscall", version = "=2.2.0" }
solana-define-syscall = { path = "sdk/define-syscall", version = "=2.2.0" }
solana-derivation-path = { path = "sdk/derivation-path", version = "=2.2.0" }
solana-download-utils = { path = "download-utils", version = "=2.2.0" }
solana-entry = { path = "entry", version = "=2.2.0" }
Expand All @@ -442,8 +442,8 @@ solana-feature-set = { path = "sdk/feature-set", version = "=2.2.0" }
solana-fee-calculator = { path = "sdk/fee-calculator", version = "=2.2.0" }
solana-fee = { path = "fee", version = "=2.2.0" }
solana-fee-structure = { path = "sdk/fee-structure", version = "=2.2.0" }
solana-frozen-abi = { path = "frozen-abi", version = "=2.2.0" }
solana-frozen-abi-macro = { path = "frozen-abi/macro", version = "=2.2.0" }
solana-frozen-abi = { path = "sdk/frozen-abi", version = "=2.2.0" }
solana-frozen-abi-macro = { path = "sdk/frozen-abi/macro", version = "=2.2.0" }
solana-tps-client = { path = "tps-client", version = "=2.2.0" }
solana-genesis = { path = "genesis", version = "=2.2.0" }
solana-genesis-utils = { path = "genesis-utils", version = "=2.2.0" }
Expand All @@ -461,7 +461,7 @@ solana-ledger = { path = "ledger", version = "=2.2.0" }
solana-loader-v4-program = { path = "programs/loader-v4", version = "=2.2.0" }
solana-local-cluster = { path = "local-cluster", version = "=2.2.0" }
solana-log-collector = { path = "log-collector", version = "=2.2.0" }
solana-logger = { path = "logger", version = "=2.2.0" }
solana-logger = { path = "sdk/logger", version = "=2.2.0" }
solana-measure = { path = "measure", version = "=2.2.0" }
solana-merkle-tree = { path = "merkle-tree", version = "=2.2.0" }
solana-metrics = { path = "metrics", version = "=2.2.0" }
Expand Down Expand Up @@ -518,7 +518,7 @@ solana-sdk = { path = "sdk", version = "=2.2.0" }
solana-sdk-macro = { path = "sdk/macro", version = "=2.2.0" }
solana-secp256k1-recover = { path = "curves/secp256k1-recover", version = "=2.2.0", default-features = false }
solana-send-transaction-service = { path = "send-transaction-service", version = "=2.2.0" }
solana-short-vec = { path = "short-vec", version = "=2.2.0" }
solana-short-vec = { path = "sdk/short-vec", version = "=2.2.0" }
solana-stable-layout = { path = "sdk/stable-layout", version = "=2.2.0" }
solana-stake-program = { path = "programs/stake", version = "=2.2.0" }
solana-storage-bigtable = { path = "storage-bigtable", version = "=2.2.0" }
Expand Down
11 changes: 2 additions & 9 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use {
MAX_REPLAY_WAKE_UP_SIGNALS,
},
blockstore_metric_report_service::BlockstoreMetricReportService,
blockstore_options::BlockstoreOptions,
blockstore_options::{BlockstoreOptions, BLOCKSTORE_DIRECTORY_ROCKS_LEVEL},
blockstore_processor::{self, TransactionStatusSender},
entry_notifier_interface::EntryNotifierArc,
entry_notifier_service::{EntryNotifierSender, EntryNotifierService},
Expand Down Expand Up @@ -2339,14 +2339,7 @@ fn cleanup_blockstore_incorrect_shred_versions(
// not critical, so swallow errors from backup blockstore operations.
let backup_folder = format!(
"{}_backup_{}_{}_{}",
config
.blockstore_options
.column_options
.shred_storage_type
.blockstore_directory(),
incorrect_shred_version,
start_slot,
end_slot
BLOCKSTORE_DIRECTORY_ROCKS_LEVEL, incorrect_shred_version, start_slot, end_slot
);
match Blockstore::open_with_options(
&blockstore.ledger_path().join(backup_folder),
Expand Down
20 changes: 3 additions & 17 deletions ledger-tool/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use {
crate::{
error::{LedgerToolError, Result},
ledger_path::canonicalize_ledger_path,
ledger_utils::{get_program_ids, get_shred_storage_type},
ledger_utils::get_program_ids,
output::{output_ledger, output_slot, CliDuplicateSlotProof, SlotBounds, SlotInfo},
},
chrono::{DateTime, Utc},
Expand All @@ -21,7 +21,7 @@ use {
ancestor_iterator::AncestorIterator,
blockstore::{Blockstore, PurgeType},
blockstore_db::{self, Column, ColumnName, Database},
blockstore_options::{AccessType, BLOCKSTORE_DIRECTORY_ROCKS_FIFO},
blockstore_options::AccessType,
shred::Shred,
},
solana_sdk::{
Expand Down Expand Up @@ -669,22 +669,8 @@ fn do_blockstore_process_command(ledger_path: &Path, matches: &ArgMatches<'_>) -
let target_db = PathBuf::from(value_t_or_exit!(arg_matches, "target_db", String));

let source = crate::open_blockstore(&ledger_path, arg_matches, AccessType::Secondary);

// Check if shred storage type can be inferred; if not, a new
// ledger is being created. open_blockstore() will attempt to
// to infer shred storage type as well, but this check provides
// extra insight to user on how to create a FIFO ledger.
let _ = get_shred_storage_type(
&target_db,
&format!(
"No --target-db ledger at {:?} was detected, default compaction \
(RocksLevel) will be used. Fifo compaction can be enabled for a new \
ledger by manually creating {BLOCKSTORE_DIRECTORY_ROCKS_FIFO} directory \
within the specified --target_db directory.",
&target_db
),
);
let target = crate::open_blockstore(&target_db, arg_matches, AccessType::Primary);

for (slot, _meta) in source.slot_meta_iterator(starting_slot)? {
if slot > ending_slot {
break;
Expand Down
27 changes: 1 addition & 26 deletions ledger-tool/src/ledger_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use {
blockstore::{Blockstore, BlockstoreError},
blockstore_options::{
AccessType, BlockstoreOptions, BlockstoreRecoveryMode, LedgerColumnOptions,
ShredStorageType,
},
blockstore_processor::{
self, BlockstoreProcessorError, ProcessOptions, TransactionStatusSender,
Expand Down Expand Up @@ -442,24 +441,14 @@ pub fn open_blockstore(
.map(BlockstoreRecoveryMode::from);
let force_update_to_open = matches.is_present("force_update_to_open");
let enforce_ulimit_nofile = !matches.is_present("ignore_ulimit_nofile_error");
let shred_storage_type = get_shred_storage_type(
ledger_path,
&format!(
"Shred storage type cannot be inferred for ledger at {ledger_path:?}, using default \
RocksLevel",
),
);

match Blockstore::open_with_options(
ledger_path,
BlockstoreOptions {
access_type: access_type.clone(),
recovery_mode: wal_recovery_mode.clone(),
enforce_ulimit_nofile,
column_options: LedgerColumnOptions {
shred_storage_type,
..LedgerColumnOptions::default()
},
column_options: LedgerColumnOptions::default(),
},
) {
Ok(blockstore) => blockstore,
Expand Down Expand Up @@ -515,20 +504,6 @@ pub fn open_blockstore(
}
}

pub fn get_shred_storage_type(ledger_path: &Path, message: &str) -> ShredStorageType {
// TODO: the following shred_storage_type inference must be updated once
// the rocksdb options can be constructed via load_options_file() as the
// value picked by passing None for `max_shred_storage_size` could affect
// the persisted rocksdb options file.
match ShredStorageType::from_ledger_path(ledger_path, None) {
Some(s) => s,
None => {
info!("{}", message);
ShredStorageType::RocksLevel
}
}
}

/// Open blockstore with temporary primary access to allow necessary,
/// persistent changes to be made to the blockstore (such as creation of new
/// column family(s)). Then, continue opening with `original_access_type`
Expand Down
34 changes: 5 additions & 29 deletions ledger-tool/tests/basic.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use {
assert_cmd::prelude::*,
solana_ledger::{
blockstore, blockstore::Blockstore, blockstore_options::ShredStorageType,
create_new_tmp_ledger_auto_delete, create_new_tmp_ledger_fifo_auto_delete,
blockstore, blockstore::Blockstore, create_new_tmp_ledger_auto_delete,
genesis_utils::create_genesis_config, get_tmp_ledger_path_auto_delete,
},
std::{
fs,
path::Path,
process::{Command, Output},
},
Expand Down Expand Up @@ -46,13 +44,6 @@ fn nominal_default() {
nominal_test_helper(ledger_path.path().to_str().unwrap());
}

#[test]
fn nominal_fifo() {
let genesis_config = create_genesis_config(100).genesis_config;
let (ledger_path, _blockhash) = create_new_tmp_ledger_fifo_auto_delete!(&genesis_config);
nominal_test_helper(ledger_path.path().to_str().unwrap());
}

fn insert_test_shreds(ledger_path: &Path, ending_slot: u64) {
let blockstore = Blockstore::open(ledger_path).unwrap();
let (shreds, _) = blockstore::make_many_slot_entries(
Expand All @@ -63,25 +54,18 @@ fn insert_test_shreds(ledger_path: &Path, ending_slot: u64) {
blockstore.insert_shreds(shreds, None, false).unwrap();
}

fn ledger_tool_copy_test(src_shred_compaction: &str, dst_shred_compaction: &str) {
#[test]
fn ledger_tool_copy_test() {
let genesis_config = create_genesis_config(100).genesis_config;

let (ledger_path, _blockhash) = match src_shred_compaction {
"fifo" => create_new_tmp_ledger_fifo_auto_delete!(&genesis_config),
_ => create_new_tmp_ledger_auto_delete!(&genesis_config),
};
let (ledger_path, _blockhash) = create_new_tmp_ledger_auto_delete!(&genesis_config);

const LEDGER_TOOL_COPY_TEST_SHRED_COUNT: u64 = 25;
const LEDGER_TOOL_COPY_TEST_ENDING_SLOT: u64 = LEDGER_TOOL_COPY_TEST_SHRED_COUNT + 1;
insert_test_shreds(ledger_path.path(), LEDGER_TOOL_COPY_TEST_ENDING_SLOT);
let ledger_path = ledger_path.path().to_str().unwrap();

let target_ledger_path = get_tmp_ledger_path_auto_delete!();
if dst_shred_compaction == "fifo" {
let rocksdb_fifo_path = target_ledger_path
.path()
.join(ShredStorageType::rocks_fifo(None).blockstore_directory());
fs::create_dir_all(rocksdb_fifo_path).unwrap();
}
let target_ledger_path = target_ledger_path.path().to_str().unwrap();
let output = run_ledger_tool(&[
"-l",
Expand All @@ -103,11 +87,3 @@ fn ledger_tool_copy_test(src_shred_compaction: &str, dst_shred_compaction: &str)
assert!(!src_slot_output.stdout.is_empty());
}
}

#[test]
fn copy_test() {
ledger_tool_copy_test("level", "level");
ledger_tool_copy_test("level", "fifo");
ledger_tool_copy_test("fifo", "level");
ledger_tool_copy_test("fifo", "fifo");
}
Empty file removed ledger/ledger.lock
Empty file.
Loading

0 comments on commit 7f54c62

Please sign in to comment.