Skip to content

Commit

Permalink
Introduce ledger-tool simulate-block-production
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Aug 25, 2024
1 parent c8a839a commit f1dbbd9
Show file tree
Hide file tree
Showing 15 changed files with 1,057 additions and 24 deletions.
31 changes: 27 additions & 4 deletions ci/run-sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ cd "$(dirname "$0")/.."
# shellcheck source=multinode-demo/common.sh
source multinode-demo/common.sh

if [[ -z $CI ]]; then
# Build eargerly if needed for local development. Otherwise, odd timing error occurs...
$solana_keygen --version
$solana_genesis --version
$solana_faucet --version
$solana_cli --version
$agave_validator --version
$solana_ledger_tool --version
fi

rm -rf config/run/init-completed config/ledger config/snapshot-ledger

SOLANA_RUN_SH_VALIDATOR_ARGS="--full-snapshot-interval-slots 200" timeout 120 ./scripts/run.sh &
SOLANA_RUN_SH_VALIDATOR_ARGS="--full-snapshot-interval-slots 200" \
SOLANA_VALIDATOR_EXIT_TIMEOUT=30 \
timeout 120 ./scripts/run.sh &

pid=$!

attempts=20
Expand All @@ -21,7 +34,7 @@ while [[ ! -f config/run/init-completed ]]; do
fi
done

snapshot_slot=1
snapshot_slot=50
latest_slot=0

# wait a bit longer than snapshot_slot
Expand All @@ -39,5 +52,15 @@ $solana_ledger_tool create-snapshot --ledger config/ledger "$snapshot_slot" conf
cp config/ledger/genesis.tar.bz2 config/snapshot-ledger
$solana_ledger_tool copy --ledger config/ledger \
--target-db config/snapshot-ledger --starting-slot "$snapshot_slot" --ending-slot "$latest_slot"
$solana_ledger_tool verify --ledger config/snapshot-ledger --block-verification-method blockstore-processor
$solana_ledger_tool verify --ledger config/snapshot-ledger --block-verification-method unified-scheduler
$solana_ledger_tool verify --abort-on-invalid-block \
--ledger config/snapshot-ledger --block-verification-method blockstore-processor
$solana_ledger_tool verify --abort-on-invalid-block \
--ledger config/snapshot-ledger --block-verification-method unified-scheduler

first_simulated_slot=$((latest_slot / 2))
echo "First simulated slot: ${first_simulated_slot}"
touch config/ledger/simulate_block_production_allowed
$solana_ledger_tool simulate-block-production --ledger config/ledger \
--first-simulated-slot $first_simulated_slot
$solana_ledger_tool verify --abort-on-invalid-block \
--ledger config/ledger --enable-hash-overrides
6 changes: 5 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ serde_json = { workspace = true }
serial_test = { workspace = true }
# See order-crates-for-publishing.py for using this unusual `path = "."`
solana-core = { path = ".", features = ["dev-context-only-utils"] }
solana-gossip = { workspace = true, features = ["dev-context-only-utils"] }
solana-ledger = { workspace = true, features = ["dev-context-only-utils"] }
solana-logger = { workspace = true }
solana-poh = { workspace = true, features = ["dev-context-only-utils"] }
Expand All @@ -122,7 +123,10 @@ sysctl = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
dev-context-only-utils = []
dev-context-only-utils = [
"solana-gossip/dev-context-only-utils",
"solana-runtime/dev-context-only-utils",
]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
Expand Down
Loading

0 comments on commit f1dbbd9

Please sign in to comment.