Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ledger-tool simulate-block-production #2733

Merged
merged 52 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
5a35a0a
Introduce ledger-tool simulate-block-production
ryoqun Aug 25, 2024
69a8548
Move counting code out of time-sensitive loop
ryoqun Aug 27, 2024
1561dee
Avoid misleading ::clone() altogether
ryoqun Aug 27, 2024
2be4049
Use while instead of loop+break
ryoqun Aug 27, 2024
dfa9765
Add comment of using BTreeMap
ryoqun Aug 27, 2024
39846f6
Reduce simulation jitter due to mem deallocs
ryoqun Aug 27, 2024
8dad62c
Rename to CostTracker::new_from_parent_limits()
ryoqun Aug 27, 2024
849cc6b
Make ::load() take a slice
ryoqun Aug 28, 2024
e09a4b2
Clean up retracer code a bit
ryoqun Aug 28, 2024
6b9ba1f
Add comment about BaningTracer even inside sim
ryoqun Aug 28, 2024
9468227
Remove redundant dcou dev-dependencies
ryoqun Aug 28, 2024
168ee1d
Apply suggestions from code review
ryoqun Aug 28, 2024
a11de4e
Fix up and promote to doc comments
ryoqun Aug 28, 2024
c9d4330
Make warm-up code and doc simpler
ryoqun Aug 28, 2024
a2fac7b
Further clean up timed_batches_to_send
ryoqun Aug 28, 2024
fffe86f
Fix wrong units...
ryoqun Aug 28, 2024
35e235a
Replace new_with_dummy_keypair() with traits
ryoqun Aug 28, 2024
8fcbe11
Tweak --no-block-cost-limits description
ryoqun Aug 28, 2024
d573884
Remove redundant dev-dependencies
ryoqun Aug 28, 2024
b24a7e3
Use RwLock to mimic real ClusterInfo
ryoqun Aug 28, 2024
61f5fb3
Fix typo
ryoqun Aug 28, 2024
7594dbf
Refactor too long BankingSimulator::start()
ryoqun Aug 29, 2024
d0dc2f6
Reduce indent
ryoqun Aug 29, 2024
d66c5db
Calculate required_duration in advance
ryoqun Aug 29, 2024
e357af8
Use correct format specifier instead of cast
ryoqun Aug 29, 2024
4228e2e
Align formatting by using ::*
ryoqun Aug 29, 2024
78ac1d2
Make envs overridable
ryoqun Aug 29, 2024
33398a3
Add comment for SOLANA_VALIDATOR_EXIT_TIMEOUT
ryoqun Aug 29, 2024
7026f1b
Clarify comment a bit
ryoqun Aug 29, 2024
29db915
Fix typoss
ryoqun Aug 29, 2024
9a3efd5
Fix typos
ryoqun Aug 30, 2024
ca13534
Use correct variant name: DeserializeError
ryoqun Aug 30, 2024
715d3c5
Remove SimulatorLoopLogger::new()
ryoqun Aug 30, 2024
86b905d
Fix typos more
ryoqun Aug 30, 2024
ed7b9c8
Add explicit _batch in field names
ryoqun Aug 30, 2024
e3f6bf2
Avoid unneeded events: Vec<_> buffering
ryoqun Aug 30, 2024
666e1b0
Manually adjust logging code styles
ryoqun Aug 30, 2024
1a1b620
Align name: spawn_sender_loop/enter_simulator_loop
ryoqun Aug 30, 2024
3a6912e
Refactor by introducing {Sender,Simulator}Loop
ryoqun Aug 30, 2024
c1d1235
Fix out-of-sync sim due to timed preprocessing
ryoqun Aug 30, 2024
62e9c61
Fix too-early base_simulation_time creation
ryoqun Aug 30, 2024
fe7331b
Don't log confusing info! after leader slots
ryoqun Sep 3, 2024
33af3da
Add justification comment of BroadcastStage
ryoqun Sep 3, 2024
bb7edea
Align timeout values
ryoqun Sep 9, 2024
c43281f
Comment about snapshot_slot=50
ryoqun Sep 9, 2024
791b094
Don't squash all errors unconditionally
ryoqun Sep 9, 2024
e577e53
Remove repetitive exitence check
ryoqun Sep 9, 2024
8d2187e
Promote no_block_cost_limits logging level
ryoqun Sep 9, 2024
9208fb8
Make ci/run-sanity.sh more robust
ryoqun Sep 10, 2024
284a1b6
Improve wordking of --enable-hash-overrides
ryoqun Sep 10, 2024
f4a1ca8
Remove marker-file based abortion mechanism
ryoqun Sep 11, 2024
0e8aca5
Remove needless touch
ryoqun Sep 11, 2024
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
42 changes: 38 additions & 4 deletions ci/run-sanity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,27 @@ 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 &
# Sanity-check that agave-validator can successfully terminate itself without relying on
# process::exit() by extending the timeout...
# Also the banking_tracer thread needs some extra time to flush due to
# unsynchronized and buffered IO.
steviez marked this conversation as resolved.
Show resolved Hide resolved
validator_timeout="${SOLANA_VALIDATOR_EXIT_TIMEOUT:-120}"
SOLANA_RUN_SH_VALIDATOR_ARGS="${SOLANA_RUN_SH_VALIDATOR_ARGS} --full-snapshot-interval-slots 200" \
SOLANA_VALIDATOR_EXIT_TIMEOUT="$validator_timeout" \
timeout "$validator_timeout" ./scripts/run.sh &

pid=$!

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

snapshot_slot=1
# Needs bunch of slots for simulate-block-production.
# Better yet, run ~20 secs to run longer than its warm-up.
# As a bonus, this works as a sanity test of general slot-rooting behavior.
snapshot_slot=50
steviez marked this conversation as resolved.
Show resolved Hide resolved
latest_slot=0

# wait a bit longer than snapshot_slot
Expand All @@ -39,5 +60,18 @@ $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))
purge_slot=$((first_simulated_slot + latest_slot / 4))
echo "First simulated slot: ${first_simulated_slot}"
# Purge some slots so that later verify fails if sim is broken
$solana_ledger_tool purge --ledger config/ledger "$purge_slot"
$solana_ledger_tool simulate-block-production --ledger config/ledger \
--first-simulated-slot $first_simulated_slot
# Slots should be available and correctly replayable upto snapshot_slot at least.
$solana_ledger_tool verify --abort-on-invalid-block \
--ledger config/ledger --enable-hash-overrides --halt-at-slot "$snapshot_slot"
5 changes: 3 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ solana-ledger = { workspace = true, features = ["dev-context-only-utils"] }
solana-logger = { workspace = true }
solana-poh = { workspace = true, features = ["dev-context-only-utils"] }
solana-program-runtime = { workspace = true }
solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
solana-sdk = { workspace = true, features = ["dev-context-only-utils"] }
solana-stake-program = { workspace = true }
solana-unified-scheduler-pool = { workspace = true, features = [
Expand All @@ -123,7 +122,9 @@ sysctl = { workspace = true }
rustc_version = { workspace = true, optional = true }

[features]
dev-context-only-utils = []
dev-context-only-utils = [
"solana-runtime/dev-context-only-utils",
]
frozen-abi = [
"dep:rustc_version",
"dep:solana-frozen-abi",
Expand Down
2 changes: 1 addition & 1 deletion core/benches/forwarder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use {
struct BenchSetup {
exit: Arc<AtomicBool>,
poh_service: PohService,
forwarder: Forwarder,
forwarder: Forwarder<Arc<ClusterInfo>>,
unprocessed_packet_batches: UnprocessedTransactionStorage,
tracker: LeaderSlotMetricsTracker,
stats: BankingStageStats,
Expand Down
Loading