Skip to content

Commit

Permalink
Add 'ticks-per-slot' option passing to test validator (#1875)
Browse files Browse the repository at this point in the history
* add 'ticks-per-slot' option passing to test validator

* add 'ticks-per-slot' option passing to test validator

* add 'ticks-per-slot' option passing to test validator

* cargo fmt and changelog

Co-authored-by: henrye <henry@notanemail>
  • Loading branch information
petrkozorezov and henrye authored Dec 12, 2022
1 parent 4846280 commit 7527033
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

1 comment on commit 7527033

@vercel
Copy link

@vercel vercel bot commented on 7527033 Dec 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-docs-git-master-200ms.vercel.app
anchor-docs-200ms.vercel.app
www.anchor-lang.com
anchor-lang.com

Please sign in to comment.