Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ci/testnet-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Deploys a CD testnet
- Attempt to generate a TLS certificate using this DNS name
--fullnode-additional-disk-size-gb [number]
- Size of additional disk in GB for all fullnodes
--no-snapshot
--no-snapshot-fetch
- If set, disables booting validators from a snapshot

Note: the SOLANA_METRICS_CONFIG environment variable is used to configure
Expand Down Expand Up @@ -137,7 +137,7 @@ while [[ -n $1 ]]; do
elif [[ $1 == --machine-type* ]]; then # Bypass quoted long args for GPUs
shortArgs+=("$1")
shift
elif [[ $1 = --no-snapshot ]]; then
elif [[ $1 = --no-snapshot-fetch ]]; then
maybeNoSnapshot="$1"
shift 1
else
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ kvstore = ["solana-kvstore"]
bincode = "1.1.4"
bs58 = "0.2.0"
byteorder = "1.3.2"
bzip2 = "0.3.3"
chrono = { version = "0.4.7", features = ["serde"] }
core_affinity = "0.5.9"
crc = { version = "1.8.1", optional = true }
crossbeam-channel = "0.3"
dir-diff = "0.3.1"
flate2 = "1.0.9"
fs_extra = "1.1.0"
indexmap = "1.0"
itertools = "0.8.0"
Expand Down
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ extern crate solana_metrics;
#[macro_use]
extern crate matches;

extern crate bzip2;
extern crate crossbeam_channel;
extern crate dir_diff;
extern crate flate2;
extern crate fs_extra;
extern crate tar;
extern crate tempfile;
4 changes: 2 additions & 2 deletions core/src/rpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ impl RequestMiddleware for RpcRequestMiddleware {
fn on_request(&self, request: hyper::Request<hyper::Body>) -> RequestMiddlewareAction {
trace!("request uri: {}", request.uri());
match request.uri().path() {
"/snapshot.tgz" => self.get("snapshot.tgz"),
"/genesis.tgz" => self.get("genesis.tgz"),
"/snapshot.tar.bz2" => self.get("snapshot.tar.bz2"),
"/genesis.tar.bz2" => self.get("genesis.tar.bz2"),
_ => RequestMiddlewareAction::Proceed {
should_continue_on_invalid_cors: false,
request,
Expand Down
7 changes: 3 additions & 4 deletions core/src/snapshot_package.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::result::{Error, Result};
use crate::service::Service;
use flate2::write::GzEncoder;
use flate2::Compression;
use bzip2::write::BzEncoder;
use solana_runtime::accounts_db::AccountStorageEntry;
use std::fs;
use std::path::Path;
Expand Down Expand Up @@ -77,11 +76,11 @@ impl SnapshotPackagerService {
// Create the tar builder
let tar_gz = tempfile::Builder::new()
.prefix("new_state")
.suffix(".tgz")
.suffix(".tar.bz2")
.tempfile_in(tar_dir)?;

let temp_tar_path = tar_gz.path();
let enc = GzEncoder::new(&tar_gz, Compression::default());
let enc = BzEncoder::new(&tar_gz, bzip2::Compression::Default);
let mut tar = tar::Builder::new(enc);

// Create the list of paths to compress, starting with the snapshots
Expand Down
8 changes: 4 additions & 4 deletions core/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::result::{Error, Result};
use crate::snapshot_package::SnapshotPackage;
use crate::snapshot_package::{TAR_ACCOUNTS_DIR, TAR_SNAPSHOTS_DIR};
use bincode::{deserialize_from, serialize_into};
use flate2::read::GzDecoder;
use bzip2::bufread::BzDecoder;
use fs_extra::dir::CopyOptions;
use solana_runtime::bank::Bank;
use solana_runtime::status_cache::SlotDelta;
Expand Down Expand Up @@ -198,15 +198,15 @@ pub fn bank_from_archive<P: AsRef<Path>>(
}

pub fn get_snapshot_tar_path<P: AsRef<Path>>(snapshot_output_dir: P) -> PathBuf {
snapshot_output_dir.as_ref().join("snapshot.tgz")
snapshot_output_dir.as_ref().join("snapshot.tar.bz2")
}

pub fn untar_snapshot_in<P: AsRef<Path>, Q: AsRef<Path>>(
snapshot_tar: P,
unpack_dir: Q,
) -> Result<()> {
let tar_gz = File::open(snapshot_tar)?;
let tar = GzDecoder::new(tar_gz);
let tar_bz2 = File::open(snapshot_tar)?;
let tar = BzDecoder::new(BufReader::new(tar_bz2));
let mut archive = Archive::new(tar);
archive.unpack(&unpack_dir)?;
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion multinode-demo/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ $solana_genesis "${args[@]}"
(
cd "$SOLANA_CONFIG_DIR"/bootstrap-leader
set -x
tar zcvfS genesis.tgz genesis.bin rocksdb
tar jcvfS genesis.tar.bz2 genesis.bin rocksdb
)
76 changes: 6 additions & 70 deletions multinode-demo/validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ label=
identity_keypair_path=
voting_keypair_path=
no_restart=0
# TODO: Enable boot_from_snapshot when snapshots work
#boot_from_snapshot=1
boot_from_snapshot=0
reset_ledger=0
gossip_entrypoint=
ledger_dir=

Expand All @@ -57,9 +53,6 @@ while [[ -n $1 ]]; do
elif [[ $1 = --no-restart ]]; then
no_restart=1
shift
elif [[ $1 = --no-snapshot ]]; then
boot_from_snapshot=0
shift
elif [[ $1 = --poll-for-new-genesis-block ]]; then
poll_for_new_genesis_block=1
shift
Expand Down Expand Up @@ -91,6 +84,9 @@ while [[ -n $1 ]]; do
elif [[ $1 = --node-lamports ]]; then
node_lamports="$2"
shift 2
elif [[ $1 = --no-snapshot-fetch ]]; then
args+=("$1")
shift
elif [[ $1 = --no-voting ]]; then
args+=("$1")
shift
Expand All @@ -115,9 +111,6 @@ while [[ -n $1 ]]; do
elif [[ $1 = --no-airdrop ]]; then
airdrops_enabled=0
shift
elif [[ $1 = --reset-ledger ]]; then
reset_ledger=1
shift
elif [[ $1 = --ledger ]]; then
ledger_dir=$2
shift 2
Expand Down Expand Up @@ -187,14 +180,10 @@ if ((airdrops_enabled)); then
default_arg --rpc-drone-address "$drone_address"
fi

accounts_dir="$ledger_dir"/accounts
snapshot_dir="$ledger_dir"/snapshots

default_arg --identity "$identity_keypair_path"
default_arg --voting-keypair "$voting_keypair_path"
default_arg --storage-keypair "$storage_keypair_path"
default_arg --ledger "$ledger_dir"
default_arg --accounts "$accounts_dir"
#default_arg --snapshot-interval-slots 100

if [[ -n $SOLANA_CUDA ]]; then
Expand All @@ -213,14 +202,14 @@ new_genesis_block() {
return
fi

rm -f "$ledger_dir"/new-genesis.tgz
rm -f "$ledger_dir"/new-genesis.tar.bz2
(
set -x
curl -f "$rpc_url"/genesis.tgz -o "$ledger_dir"/new-genesis.tgz
curl -f "$rpc_url"/genesis.tar.bz2 -o "$ledger_dir"/new-genesis.tar.bz2
) || {
echo "Error: failed to fetch new genesis ledger"
}
! diff -q "$ledger_dir"/new-genesis.tgz "$ledger_dir"/genesis.tgz >/dev/null 2>&1
! diff -q "$ledger_dir"/new-genesis.tar.bz2 "$ledger_dir"/genesis.tar.bz2 >/dev/null 2>&1
}

set -e
Expand All @@ -245,15 +234,6 @@ kill_node_and_exit() {
}
trap 'kill_node_and_exit' INT TERM ERR

if ((reset_ledger)); then
echo "Resetting ledger..."
(
set -x
rm -rf "$ledger_dir"
)
fi


wallet() {
(
set -x
Expand Down Expand Up @@ -301,48 +281,6 @@ while true; do
)
fi

if [[ ! -f "$ledger_dir"/.genesis ]]; then
echo "Fetching ledger from $rpc_url/genesis.tgz..."
SECONDS=
mkdir -p "$ledger_dir"
while ! curl -f "$rpc_url"/genesis.tgz -o "$ledger_dir"/genesis.tgz; do
echo "Genesis ledger fetch failed"
sleep 5
done
echo "Fetched genesis ledger in $SECONDS seconds"

(
set -x
cd "$ledger_dir"
tar -zxf genesis.tgz
touch .genesis
)

(
if ((boot_from_snapshot)); then
SECONDS=

echo "Fetching state snapshot $rpc_url/snapshot.tgz..."
mkdir -p "$snapshot_dir"
if ! curl -f "$rpc_url"/snapshot.tgz -o "$snapshot_dir"/snapshot.tgz; then
echo "State snapshot fetch failed"
rm -f "$snapshot_dir"/snapshot.tgz
exit 0 # None fatal
fi
echo "Fetched snapshot in $SECONDS seconds"

SECONDS=
(
set -x
cd "$snapshot_dir"
tar -zxf snapshot.tgz
rm snapshot.tgz
)
echo "Extracted snapshot in $SECONDS seconds"
fi
)
fi

[[ -r "$identity_keypair_path" ]] || $solana_keygen new -o "$identity_keypair_path"
[[ -r "$voting_keypair_path" ]] || $solana_keygen new -o "$voting_keypair_path"
[[ -r "$storage_keypair_path" ]] || $solana_keygen new -o "$storage_keypair_path"
Expand All @@ -360,8 +298,6 @@ identity pubkey: $identity_pubkey
vote pubkey: $vote_pubkey
storage pubkey: $storage_pubkey
ledger: $ledger_dir
accounts: $accounts_dir
snapshots: $snapshot_dir
========================================================================
EOF

Expand Down
4 changes: 2 additions & 2 deletions net/net.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Operate a configured testnet
- Amount to fund internal nodes in genesis block.
--external-accounts-file FILE_PATH
- A YML file with a list of account pubkeys and corresponding lamport balances in genesis block for external nodes
--no-snapshot
--no-snapshot-fetch
- If set, disables booting validators from a snapshot
--skip-ledger-verify
- If set, validators will skip verifying
Expand Down Expand Up @@ -139,7 +139,7 @@ while [[ -n $1 ]]; do
elif [[ $1 = --lamports ]]; then
genesisOptions="$genesisOptions $1 $2"
shift 2
elif [[ $1 = --no-snapshot ]]; then
elif [[ $1 = --no-snapshot-fetch ]]; then
maybeNoSnapshot="$1"
shift 1
elif [[ $1 = --no-deploy ]]; then
Expand Down
4 changes: 4 additions & 0 deletions validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ license = "Apache-2.0"
homepage = "https://solana.com/"

[dependencies]
bzip2 = "0.3.3"
clap = "2.33.0"
log = "0.4.8"
reqwest = "0.9.19"
serde_json = "1.0.40"
solana = { path = "../core", version = "0.18.0-pre1" }
solana-drone = { path = "../drone", version = "0.18.0-pre1" }
Expand All @@ -21,6 +23,8 @@ solana-runtime = { path = "../runtime", version = "0.18.0-pre1" }
solana-sdk = { path = "../sdk", version = "0.18.0-pre1" }
solana-vote-api = { path = "../programs/vote_api", version = "0.18.0-pre1" }
solana-vote-signer = { path = "../vote-signer", version = "0.18.0-pre1" }
tempfile = "3.1.0"
tar = "0.4.26"

[features]
cuda = ["solana/cuda"]
Loading