test-validator: Add --max-compute-units
flag (#24130)
* test-validator: Add `--max-compute-units` flag * Add `RuntimeConfig` for tweaking runtime behavior * Actually add the file * Move RuntimeConfig to runtime
This commit is contained in:
@ -354,6 +354,14 @@ fn main() {
|
||||
.multiple(true)
|
||||
.help("deactivate this feature in genesis.")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("max_compute_units")
|
||||
.long("max-compute-units")
|
||||
.value_name("COMPUTE_UNITS")
|
||||
.validator(is_parsable::<u64>)
|
||||
.takes_value(true)
|
||||
.help("Override the runtime's maximum compute units")
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let output = if matches.is_present("quiet") {
|
||||
@ -462,6 +470,7 @@ fn main() {
|
||||
exit(1);
|
||||
})
|
||||
});
|
||||
let max_compute_units = value_t!(matches, "max_compute_units", u64).ok();
|
||||
|
||||
let faucet_addr = Some(SocketAddr::new(
|
||||
IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
|
||||
@ -724,6 +733,10 @@ fn main() {
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(max_compute_units) = max_compute_units {
|
||||
genesis.max_compute_units(max_compute_units);
|
||||
}
|
||||
|
||||
match genesis.start_with_mint_address(mint_address, socket_addr_space) {
|
||||
Ok(test_validator) => {
|
||||
*admin_service_post_init.write().unwrap() =
|
||||
|
@ -50,6 +50,7 @@ use {
|
||||
AccountsIndexConfig,
|
||||
},
|
||||
hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
||||
runtime_config::RuntimeConfig,
|
||||
snapshot_config::SnapshotConfig,
|
||||
snapshot_utils::{
|
||||
self, ArchiveFormat, SnapshotVersion, DEFAULT_FULL_SNAPSHOT_ARCHIVE_INTERVAL_SLOTS,
|
||||
@ -2326,7 +2327,6 @@ pub fn main() {
|
||||
let mut validator_config = ValidatorConfig {
|
||||
require_tower: matches.is_present("require_tower"),
|
||||
tower_storage,
|
||||
dev_halt_at_slot: value_t!(matches, "dev_halt_at_slot", Slot).ok(),
|
||||
expected_genesis_hash: matches
|
||||
.value_of("expected_genesis_hash")
|
||||
.map(|s| Hash::from_str(s).unwrap()),
|
||||
@ -2403,7 +2403,6 @@ pub fn main() {
|
||||
poh_verify: !matches.is_present("skip_poh_verify"),
|
||||
debug_keys,
|
||||
contact_debug_interval,
|
||||
bpf_jit: !matches.is_present("no_bpf_jit"),
|
||||
send_transaction_service_config: send_transaction_service::Config {
|
||||
retry_rate_ms: value_t_or_exit!(matches, "rpc_send_transaction_retry_ms", u64),
|
||||
leader_forward_count: value_t_or_exit!(
|
||||
@ -2439,6 +2438,11 @@ pub fn main() {
|
||||
tpu_coalesce_ms,
|
||||
no_wait_for_vote_to_start_leader: matches.is_present("no_wait_for_vote_to_start_leader"),
|
||||
accounts_shrink_ratio,
|
||||
runtime_config: RuntimeConfig {
|
||||
dev_halt_at_slot: value_t!(matches, "dev_halt_at_slot", Slot).ok(),
|
||||
bpf_jit: !matches.is_present("no_bpf_jit"),
|
||||
..RuntimeConfig::default()
|
||||
},
|
||||
..ValidatorConfig::default()
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user