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

Add 'ticks-per-slot' option passing to test validator #1875

Merged
merged 6 commits into from
Dec 12, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- cli: Allow custom cluster config ([#2271](https://github.com/coral-xyz/anchor/pull/2271)).
- ts: Add optional flag to parseLogs to throw an error on decoding failure ([#2043](https://github.com/coral-xyz/anchor/pull/2043)).
- cli: Add `test.validator.geyser_plugin_config` support ([#2016](https://github.com/coral-xyz/anchor/pull/2016)).
- cli: Add `ticks_per_slot` option to Validator args ([#1875](https://github.com/coral-xyz/anchor/pull/1875)).

### Fixes

Expand Down
8 changes: 8 additions & 0 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,9 @@ pub struct _Validator {
// Override the number of slots in an epoch.
#[serde(skip_serializing_if = "Option::is_none")]
pub slots_per_epoch: Option<String>,
// The number of ticks in a slot
#[serde(skip_serializing_if = "Option::is_none")]
pub ticks_per_slot: Option<u16>,
// Warp the ledger to WARP_SLOT after starting the validator.
#[serde(skip_serializing_if = "Option::is_none")]
pub warp_slot: Option<String>,
Expand Down Expand Up @@ -949,6 +952,8 @@ pub struct Validator {
#[serde(skip_serializing_if = "Option::is_none")]
pub slots_per_epoch: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub ticks_per_slot: Option<u16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub warp_slot: Option<String>,
}

Expand All @@ -975,6 +980,7 @@ impl From<_Validator> for Validator {
.rpc_port
.unwrap_or(solana_sdk::rpc_port::DEFAULT_RPC_PORT),
slots_per_epoch: _validator.slots_per_epoch,
ticks_per_slot: _validator.ticks_per_slot,
warp_slot: _validator.warp_slot,
}
}
Expand All @@ -997,6 +1003,7 @@ impl From<Validator> for _Validator {
limit_ledger_size: validator.limit_ledger_size,
rpc_port: Some(validator.rpc_port),
slots_per_epoch: validator.slots_per_epoch,
ticks_per_slot: validator.ticks_per_slot,
warp_slot: validator.warp_slot,
}
}
Expand Down Expand Up @@ -1067,6 +1074,7 @@ impl Merge for _Validator {
slots_per_epoch: other
.slots_per_epoch
.or_else(|| self.slots_per_epoch.take()),
ticks_per_slot: other.ticks_per_slot.or_else(|| self.ticks_per_slot.take()),
warp_slot: other.warp_slot.or_else(|| self.warp_slot.take()),
};
}
Expand Down