Browse Source

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

* 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>
Petr Kozorezov 2 years ago
parent
commit
7527033c7b
2 changed files with 9 additions and 0 deletions
  1. 1 0
      CHANGELOG.md
  2. 8 0
      cli/src/config.rs

+ 1 - 0
CHANGELOG.md

@@ -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)).
 - 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)).
 - 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 `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
 ### Fixes
 
 

+ 8 - 0
cli/src/config.rs

@@ -916,6 +916,9 @@ pub struct _Validator {
     // Override the number of slots in an epoch.
     // Override the number of slots in an epoch.
     #[serde(skip_serializing_if = "Option::is_none")]
     #[serde(skip_serializing_if = "Option::is_none")]
     pub slots_per_epoch: Option<String>,
     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.
     // Warp the ledger to WARP_SLOT after starting the validator.
     #[serde(skip_serializing_if = "Option::is_none")]
     #[serde(skip_serializing_if = "Option::is_none")]
     pub warp_slot: Option<String>,
     pub warp_slot: Option<String>,
@@ -949,6 +952,8 @@ pub struct Validator {
     #[serde(skip_serializing_if = "Option::is_none")]
     #[serde(skip_serializing_if = "Option::is_none")]
     pub slots_per_epoch: Option<String>,
     pub slots_per_epoch: Option<String>,
     #[serde(skip_serializing_if = "Option::is_none")]
     #[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>,
     pub warp_slot: Option<String>,
 }
 }
 
 
@@ -975,6 +980,7 @@ impl From<_Validator> for Validator {
                 .rpc_port
                 .rpc_port
                 .unwrap_or(solana_sdk::rpc_port::DEFAULT_RPC_PORT),
                 .unwrap_or(solana_sdk::rpc_port::DEFAULT_RPC_PORT),
             slots_per_epoch: _validator.slots_per_epoch,
             slots_per_epoch: _validator.slots_per_epoch,
+            ticks_per_slot: _validator.ticks_per_slot,
             warp_slot: _validator.warp_slot,
             warp_slot: _validator.warp_slot,
         }
         }
     }
     }
@@ -997,6 +1003,7 @@ impl From<Validator> for _Validator {
             limit_ledger_size: validator.limit_ledger_size,
             limit_ledger_size: validator.limit_ledger_size,
             rpc_port: Some(validator.rpc_port),
             rpc_port: Some(validator.rpc_port),
             slots_per_epoch: validator.slots_per_epoch,
             slots_per_epoch: validator.slots_per_epoch,
+            ticks_per_slot: validator.ticks_per_slot,
             warp_slot: validator.warp_slot,
             warp_slot: validator.warp_slot,
         }
         }
     }
     }
@@ -1067,6 +1074,7 @@ impl Merge for _Validator {
             slots_per_epoch: other
             slots_per_epoch: other
                 .slots_per_epoch
                 .slots_per_epoch
                 .or_else(|| self.slots_per_epoch.take()),
                 .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()),
             warp_slot: other.warp_slot.or_else(|| self.warp_slot.take()),
         };
         };
     }
     }