diff --git a/prdoc/pr_10460.prdoc b/prdoc/pr_10460.prdoc new file mode 100644 index 0000000000000..9af38a8c45814 --- /dev/null +++ b/prdoc/pr_10460.prdoc @@ -0,0 +1,13 @@ +# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0 +# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json + +title: Remove pallet::getter usage from sassafras pallet + +doc: + - audience: Runtime Dev + description: | + This PR removes all pallet::getter occurrences from pallet-sassafras. + +crates: + - name: pallet-sassafras + bump: minor diff --git a/substrate/frame/sassafras/src/benchmarking.rs b/substrate/frame/sassafras/src/benchmarking.rs index 2b2467c6f84dd..be1c819e97ef9 100644 --- a/substrate/frame/sassafras/src/benchmarking.rs +++ b/substrate/frame/sassafras/src/benchmarking.rs @@ -150,7 +150,7 @@ mod benchmarks { #[block] { Pallet::::should_end_epoch(BlockNumberFor::::from(3u32)); - let next_authorities = Pallet::::next_authorities(); + let next_authorities = NextAuthorities::::get(); // Using a different set of authorities triggers the recomputation of ring verifier. Pallet::::enact_epoch_change(Default::default(), next_authorities); } diff --git a/substrate/frame/sassafras/src/lib.rs b/substrate/frame/sassafras/src/lib.rs index 94a8125112ea3..6539b89439f15 100644 --- a/substrate/frame/sassafras/src/lib.rs +++ b/substrate/frame/sassafras/src/lib.rs @@ -156,17 +156,14 @@ pub mod pallet { /// Current epoch index. #[pallet::storage] - #[pallet::getter(fn epoch_index)] pub type EpochIndex = StorageValue<_, u64, ValueQuery>; /// Current epoch authorities. #[pallet::storage] - #[pallet::getter(fn authorities)] pub type Authorities = StorageValue<_, AuthoritiesVec, ValueQuery>; /// Next epoch authorities. #[pallet::storage] - #[pallet::getter(fn next_authorities)] pub type NextAuthorities = StorageValue<_, AuthoritiesVec, ValueQuery>; /// First block slot number. @@ -174,29 +171,24 @@ pub mod pallet { /// As the slots may not be zero-based, we record the slot value for the fist block. /// This allows to always compute relative indices for epochs and slots. #[pallet::storage] - #[pallet::getter(fn genesis_slot)] pub type GenesisSlot = StorageValue<_, Slot, ValueQuery>; /// Current block slot number. #[pallet::storage] - #[pallet::getter(fn current_slot)] pub type CurrentSlot = StorageValue<_, Slot, ValueQuery>; /// Current epoch randomness. #[pallet::storage] - #[pallet::getter(fn randomness)] pub type CurrentRandomness = StorageValue<_, Randomness, ValueQuery>; /// Next epoch randomness. #[pallet::storage] - #[pallet::getter(fn next_randomness)] pub type NextRandomness = StorageValue<_, Randomness, ValueQuery>; /// Randomness accumulator. /// /// Excluded the first imported block, its value is updated on block finalization. #[pallet::storage] - #[pallet::getter(fn randomness_accumulator)] pub(crate) type RandomnessAccumulator = StorageValue<_, Randomness, ValueQuery>; /// Per slot randomness used to feed the randomness accumulator. @@ -207,12 +199,10 @@ pub mod pallet { /// The configuration for the current epoch. #[pallet::storage] - #[pallet::getter(fn config)] pub type EpochConfig = StorageValue<_, EpochConfiguration, ValueQuery>; /// The configuration for the next epoch. #[pallet::storage] - #[pallet::getter(fn next_config)] pub type NextEpochConfig = StorageValue<_, EpochConfiguration>; /// Pending epoch configuration change that will be set as `NextEpochConfig` when the next @@ -270,7 +260,6 @@ pub mod pallet { /// /// In practice: Updatable Universal Reference String and the seed. #[pallet::storage] - #[pallet::getter(fn ring_context)] pub type RingContext = StorageValue<_, vrf::RingContext>; /// Ring verifier data for the current epoch. @@ -392,10 +381,11 @@ pub mod pallet { return Err("Ring verifier key not initialized".into()) }; - let next_authorities = Self::next_authorities(); + let next_authorities = NextAuthorities::::get(); // Compute tickets threshold - let next_config = Self::next_config().unwrap_or_else(|| Self::config()); + let next_config = + NextEpochConfig::::get().unwrap_or_else(|| EpochConfig::::get()); let ticket_threshold = sp_consensus_sassafras::ticket_id_threshold( next_config.redundancy_factor, epoch_length as u32, @@ -746,7 +736,7 @@ impl Pallet { // Deposit a log as this is the first block in first epoch. let next_epoch = NextEpochDescriptor { randomness: next_randomness, - authorities: Self::next_authorities().into_inner(), + authorities: NextAuthorities::::get().into_inner(), config: None, }; Self::deposit_next_epoch_descriptor_digest(next_epoch); @@ -759,9 +749,9 @@ impl Pallet { index, start: Self::epoch_start(index), length: T::EpochLength::get(), - authorities: Self::authorities().into_inner(), - randomness: Self::randomness(), - config: Self::config(), + authorities: Authorities::::get().into_inner(), + randomness: CurrentRandomness::::get(), + config: EpochConfig::::get(), } } @@ -772,9 +762,9 @@ impl Pallet { index, start: Self::epoch_start(index), length: T::EpochLength::get(), - authorities: Self::next_authorities().into_inner(), - randomness: Self::next_randomness(), - config: Self::next_config().unwrap_or_else(|| Self::config()), + authorities: NextAuthorities::::get().into_inner(), + randomness: NextRandomness::::get(), + config: NextEpochConfig::::get().unwrap_or_else(|| EpochConfig::::get()), } } @@ -1015,6 +1005,61 @@ impl Pallet { pub fn epoch_length() -> u32 { T::EpochLength::get() } + + /// Get current epoch index. + pub fn epoch_index() -> u64 { + EpochIndex::::get() + } + + /// Get current epoch authorities. + pub fn authorities() -> Vec { + Authorities::::get().into_inner() + } + + /// Get next epoch authorities. + pub fn next_authorities() -> Vec { + NextAuthorities::::get().into_inner() + } + + /// Get genesis slot. + pub fn genesis_slot() -> Slot { + GenesisSlot::::get() + } + + /// Get current slot. + pub fn current_slot() -> Slot { + CurrentSlot::::get() + } + + /// Get current epoch randomness. + pub fn randomness() -> Randomness { + CurrentRandomness::::get() + } + + /// Get next epoch randomness. + pub fn next_randomness() -> Randomness { + NextRandomness::::get() + } + + /// Get randomness accumulator. + pub fn randomness_accumulator() -> Randomness { + RandomnessAccumulator::::get() + } + + /// Get current epoch configuration. + pub fn config() -> EpochConfiguration { + EpochConfig::::get() + } + + /// Get next epoch configuration. + pub fn next_config() -> Option { + NextEpochConfig::::get() + } + + /// Get ring context. + pub fn ring_context() -> Option { + RingContext::::get() + } } /// Trigger an epoch change, if any should take place. @@ -1049,7 +1094,7 @@ pub struct EpochChangeInternalTrigger; impl EpochChangeTrigger for EpochChangeInternalTrigger { fn trigger(block_num: BlockNumberFor) -> Weight { if Pallet::::should_end_epoch(block_num) { - let authorities = Pallet::::next_authorities(); + let authorities = NextAuthorities::::get(); let next_authorities = authorities.clone(); let len = next_authorities.len() as u32; Pallet::::enact_epoch_change(authorities, next_authorities); diff --git a/substrate/frame/sassafras/src/mock.rs b/substrate/frame/sassafras/src/mock.rs index db20f3a5bd243..88a6b64100d23 100644 --- a/substrate/frame/sassafras/src/mock.rs +++ b/substrate/frame/sassafras/src/mock.rs @@ -135,8 +135,8 @@ fn make_ticket_with_prover( log::debug!("attempt: {}", attempt); // Values are referring to the next epoch - let epoch = Sassafras::epoch_index() + 1; - let randomness = Sassafras::next_randomness(); + let epoch = EpochIndex::::get() + 1; + let randomness = NextRandomness::::get(); // Make a dummy ephemeral public that hopefully is unique within one test instance. // In the tests, the values within the erased public are just used to compare @@ -162,9 +162,9 @@ pub fn make_prover(pair: &AuthorityPair) -> RingProver { let public = pair.public(); let mut prover_idx = None; - let ring_ctx = Sassafras::ring_context().unwrap(); + let ring_ctx = RingContext::::get().unwrap(); - let pks: Vec = Sassafras::authorities() + let pks: Vec = Authorities::::get() .iter() .enumerate() .map(|(idx, auth)| { @@ -195,8 +195,8 @@ pub fn make_tickets(attempts: u32, pair: &AuthorityPair) -> Vec pub fn make_ticket_body(attempt_idx: u32, pair: &AuthorityPair) -> (TicketId, TicketBody) { // Values are referring to the next epoch - let epoch = Sassafras::epoch_index() + 1; - let randomness = Sassafras::next_randomness(); + let epoch = EpochIndex::::get() + 1; + let randomness = NextRandomness::::get(); let ticket_id_input = vrf::ticket_id_input(&randomness, attempt_idx, epoch); let ticket_id_pre_output = pair.as_inner_ref().vrf_pre_output(&ticket_id_input); @@ -275,8 +275,8 @@ pub fn persist_next_epoch_tickets(tickets: &[(TicketId, TicketBody)]) { } fn slot_claim_vrf_signature(slot: Slot, pair: &AuthorityPair) -> VrfSignature { - let mut epoch = Sassafras::epoch_index(); - let mut randomness = Sassafras::randomness(); + let mut epoch = EpochIndex::::get(); + let mut randomness = CurrentRandomness::::get(); // Check if epoch is going to change on initialization. let epoch_start = Sassafras::current_epoch_start(); @@ -341,7 +341,7 @@ pub fn go_to_block(number: u64, slot: Slot, pair: &AuthorityPair) -> Digest { /// Progress the pallet state up to the given block `number`. /// Slots will grow linearly accordingly to blocks. pub fn progress_to_block(number: u64, pair: &AuthorityPair) -> Option { - let mut slot = Sassafras::current_slot() + 1; + let mut slot = CurrentSlot::::get() + 1; let mut digest = None; for i in System::block_number() + 1..=number { let dig = go_to_block(i, slot, pair); diff --git a/substrate/frame/sassafras/src/tests.rs b/substrate/frame/sassafras/src/tests.rs index 7236deeaa6518..2b8bfafa81d44 100644 --- a/substrate/frame/sassafras/src/tests.rs +++ b/substrate/frame/sassafras/src/tests.rs @@ -33,8 +33,8 @@ fn b2h(bytes: [u8; N]) -> String { #[test] fn genesis_values_assumptions_check() { new_test_ext(3).execute_with(|| { - assert_eq!(Sassafras::authorities().len(), 3); - assert_eq!(Sassafras::config(), TEST_EPOCH_CONFIGURATION); + assert_eq!(Authorities::::get().len(), 3); + assert_eq!(EpochConfig::::get(), TEST_EPOCH_CONFIGURATION); }); } @@ -44,22 +44,22 @@ fn post_genesis_randomness_initialization() { let pair = &pairs[0]; ext.execute_with(|| { - assert_eq!(Sassafras::randomness(), [0; 32]); - assert_eq!(Sassafras::next_randomness(), [0; 32]); - assert_eq!(Sassafras::randomness_accumulator(), [0; 32]); + assert_eq!(CurrentRandomness::::get(), [0; 32]); + assert_eq!(NextRandomness::::get(), [0; 32]); + assert_eq!(RandomnessAccumulator::::get(), [0; 32]); // Test the values with a zero genesis block hash let _ = initialize_block(1, 123.into(), [0x00; 32].into(), pair); - assert_eq!(Sassafras::randomness(), [0; 32]); - println!("[DEBUG] {}", b2h(Sassafras::next_randomness())); + assert_eq!(CurrentRandomness::::get(), [0; 32]); + println!("[DEBUG] {}", b2h(NextRandomness::::get())); assert_eq!( - Sassafras::next_randomness(), + NextRandomness::::get(), h2b("b9497550deeeb4adc134555930de61968a0558f8947041eb515b2f5fa68ffaf7") ); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("febcc7fe9539fe17ed29f525831394edfb30b301755dc9bd91584a1f065faf87") ); let (id1, _) = make_ticket_bodies(1, Some(pair))[0]; @@ -72,15 +72,15 @@ fn post_genesis_randomness_initialization() { // Test the values with a non-zero genesis block hash let _ = initialize_block(1, 123.into(), [0xff; 32].into(), pair); - assert_eq!(Sassafras::randomness(), [0; 32]); - println!("[DEBUG] {}", b2h(Sassafras::next_randomness())); + assert_eq!(CurrentRandomness::::get(), [0; 32]); + println!("[DEBUG] {}", b2h(NextRandomness::::get())); assert_eq!( - Sassafras::next_randomness(), + NextRandomness::::get(), h2b("51c1e3b3a73d2043b3cabae98ff27bdd4aad8967c21ecda7b9465afaa0e70f37") ); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("466bf3007f2e17bffee0b3c42c90f33d654f5ff61eff28b0cc650825960abd52") ); let (id2, _) = make_ticket_bodies(1, Some(pair))[0]; @@ -96,14 +96,14 @@ fn post_genesis_randomness_initialization() { // Test the values with a non-zero genesis block hash let _ = initialize_block(1, 321.into(), [0x00; 32].into(), pair); - println!("[DEBUG] {}", b2h(Sassafras::next_randomness())); + println!("[DEBUG] {}", b2h(NextRandomness::::get())); assert_eq!( - Sassafras::next_randomness(), + NextRandomness::::get(), h2b("d85d84a54f79453000eb62e8a17b30149bd728d3232bc2787a89d51dc9a36008") ); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("8a035eed02b5b8642b1515ed19752df8df156627aea45c4ef6e3efa88be9a74d") ); let (id2, _) = make_ticket_bodies(1, Some(pair))[0]; @@ -248,15 +248,15 @@ fn on_first_block_after_genesis() { let digest = initialize_block(start_block, start_slot, Default::default(), &pairs[0]); let common_assertions = || { - assert_eq!(Sassafras::genesis_slot(), start_slot); - assert_eq!(Sassafras::current_slot(), start_slot); - assert_eq!(Sassafras::epoch_index(), 0); + assert_eq!(GenesisSlot::::get(), start_slot); + assert_eq!(CurrentSlot::::get(), start_slot); + assert_eq!(EpochIndex::::get(), 0); assert_eq!(Sassafras::current_epoch_start(), start_slot); assert_eq!(Sassafras::current_slot_index(), 0); - assert_eq!(Sassafras::randomness(), [0; 32]); - println!("[DEBUG] {}", b2h(Sassafras::next_randomness())); + assert_eq!(CurrentRandomness::::get(), [0; 32]); + println!("[DEBUG] {}", b2h(NextRandomness::::get())); assert_eq!( - Sassafras::next_randomness(), + NextRandomness::::get(), h2b("a49592ef190b96f3eb87bde4c8355e33df28c75006156e8c81998158de2ed49e") ); }; @@ -265,9 +265,9 @@ fn on_first_block_after_genesis() { assert!(SlotRandomness::::exists()); common_assertions(); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("f0d42f6b7c0d157ecbd788be44847b80a96c290c04b5dfa5d1d40c98aa0c04ed") ); @@ -278,7 +278,7 @@ fn on_first_block_after_genesis() { assert!(!SlotRandomness::::exists()); common_assertions(); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("95a508cf10f877cf0457af3503a6cb3192763d5c15a7b9a58e40dc543efae889"), ); @@ -290,8 +290,8 @@ fn on_first_block_after_genesis() { // Genesis epoch start deposits consensus let consensus_log = sp_consensus_sassafras::digests::ConsensusLog::NextEpochData( sp_consensus_sassafras::digests::NextEpochDescriptor { - authorities: Sassafras::next_authorities().into_inner(), - randomness: Sassafras::next_randomness(), + authorities: NextAuthorities::::get().into_inner(), + randomness: NextRandomness::::get(), config: None, }, ); @@ -318,15 +318,15 @@ fn on_normal_block() { let digest = progress_to_block(end_block, &pairs[0]).unwrap(); let common_assertions = || { - assert_eq!(Sassafras::genesis_slot(), start_slot); - assert_eq!(Sassafras::current_slot(), start_slot + 1); - assert_eq!(Sassafras::epoch_index(), 0); + assert_eq!(GenesisSlot::::get(), start_slot); + assert_eq!(CurrentSlot::::get(), start_slot + 1); + assert_eq!(EpochIndex::::get(), 0); assert_eq!(Sassafras::current_epoch_start(), start_slot); assert_eq!(Sassafras::current_slot_index(), 1); - assert_eq!(Sassafras::randomness(), [0; 32]); - println!("[DEBUG] {}", b2h(Sassafras::next_randomness())); + assert_eq!(CurrentRandomness::::get(), [0; 32]); + println!("[DEBUG] {}", b2h(NextRandomness::::get())); assert_eq!( - Sassafras::next_randomness(), + NextRandomness::::get(), h2b("a49592ef190b96f3eb87bde4c8355e33df28c75006156e8c81998158de2ed49e") ); }; @@ -335,9 +335,9 @@ fn on_normal_block() { assert!(SlotRandomness::::exists()); common_assertions(); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("95a508cf10f877cf0457af3503a6cb3192763d5c15a7b9a58e40dc543efae889"), ); @@ -347,9 +347,9 @@ fn on_normal_block() { assert!(!SlotRandomness::::exists()); common_assertions(); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("5465cb257ad20cd4b9400a9fc85af7b1e2e72b59debd8ca06580dfb76bfca394"), ); @@ -377,14 +377,14 @@ fn produce_epoch_change_digest_no_config() { let digest = progress_to_block(end_block, &pairs[0]).unwrap(); let common_assertions = || { - assert_eq!(Sassafras::genesis_slot(), start_slot); - assert_eq!(Sassafras::current_slot(), start_slot + epoch_length); - assert_eq!(Sassafras::epoch_index(), 1); + assert_eq!(GenesisSlot::::get(), start_slot); + assert_eq!(CurrentSlot::::get(), start_slot + epoch_length); + assert_eq!(EpochIndex::::get(), 1); assert_eq!(Sassafras::current_epoch_start(), start_slot + epoch_length); assert_eq!(Sassafras::current_slot_index(), 0); - println!("[DEBUG] {}", b2h(Sassafras::randomness())); + println!("[DEBUG] {}", b2h(CurrentRandomness::::get())); assert_eq!( - Sassafras::randomness(), + CurrentRandomness::::get(), h2b("a49592ef190b96f3eb87bde4c8355e33df28c75006156e8c81998158de2ed49e") ); }; @@ -393,14 +393,14 @@ fn produce_epoch_change_digest_no_config() { assert!(SlotRandomness::::exists()); common_assertions(); - println!("[DEBUG] {}", b2h(Sassafras::next_randomness())); + println!("[DEBUG] {}", b2h(NextRandomness::::get())); assert_eq!( - Sassafras::next_randomness(), + NextRandomness::::get(), h2b("c4d374ed47b71e1c29e57143db23861916ff2d0c59ead4c51070d42ff4af2830"), ); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("c6d84d1f389853959c39271a38010f2f27abe6ff56cc419cf9e89eafcae1ab5e"), ); @@ -410,14 +410,14 @@ fn produce_epoch_change_digest_no_config() { assert!(!SlotRandomness::::exists()); common_assertions(); - println!("[DEBUG] {}", b2h(Sassafras::next_randomness())); + println!("[DEBUG] {}", b2h(NextRandomness::::get())); assert_eq!( - Sassafras::next_randomness(), + NextRandomness::::get(), h2b("c4d374ed47b71e1c29e57143db23861916ff2d0c59ead4c51070d42ff4af2830"), ); - println!("[DEBUG] {}", b2h(Sassafras::randomness_accumulator())); + println!("[DEBUG] {}", b2h(RandomnessAccumulator::::get())); assert_eq!( - Sassafras::randomness_accumulator(), + RandomnessAccumulator::::get(), h2b("6ca02b90e14ef11b3855069794da7e9d4007526b0588c426c3e3533b0b6ade7a"), ); @@ -428,8 +428,8 @@ fn produce_epoch_change_digest_no_config() { // Deposits consensus log on epoch change let consensus_log = sp_consensus_sassafras::digests::ConsensusLog::NextEpochData( sp_consensus_sassafras::digests::NextEpochDescriptor { - authorities: Sassafras::next_authorities().into_inner(), - randomness: Sassafras::next_randomness(), + authorities: NextAuthorities::::get().into_inner(), + randomness: NextRandomness::::get(), config: None, }, ); @@ -467,8 +467,8 @@ fn produce_epoch_change_digest_with_config() { // Deposits consensus log on epoch change let consensus_log = sp_consensus_sassafras::digests::ConsensusLog::NextEpochData( sp_consensus_sassafras::digests::NextEpochDescriptor { - authorities: Sassafras::next_authorities().into_inner(), - randomness: Sassafras::next_randomness(), + authorities: NextAuthorities::::get().into_inner(), + randomness: NextRandomness::::get(), config: Some(config), }, ); @@ -563,7 +563,7 @@ fn segments_incremental_sort_works() { // The next block will be the first produced on the new epoch. // At this point the tickets are found already sorted and ready to be used. - let slot = Sassafras::current_slot() + 1; + let slot = CurrentSlot::::get() + 1; let number = System::block_number() + 1; initialize_block(number, slot, header.hash(), pair); let header = finalize_block(number); @@ -610,7 +610,7 @@ fn tickets_fetch_works_after_epoch_change() { expected_ids.truncate(epoch_length as usize); // Check if we can fetch next epoch tickets ids (outside-in). - let slot = Sassafras::current_slot(); + let slot = CurrentSlot::::get(); assert_eq!(Sassafras::slot_ticket_id(slot + 1).unwrap(), expected_ids[1]); assert_eq!(Sassafras::slot_ticket_id(slot + 2).unwrap(), expected_ids[3]); assert_eq!(Sassafras::slot_ticket_id(slot + 3).unwrap(), expected_ids[5]); @@ -630,7 +630,7 @@ fn tickets_fetch_works_after_epoch_change() { assert_eq!(meta.tickets_count, [0, 10]); // Check if we can fetch current epoch tickets ids (outside-in). - let slot = Sassafras::current_slot(); + let slot = CurrentSlot::::get(); assert_eq!(Sassafras::slot_ticket_id(slot).unwrap(), expected_ids[1]); assert_eq!(Sassafras::slot_ticket_id(slot + 1).unwrap(), expected_ids[3]); assert_eq!(Sassafras::slot_ticket_id(slot + 2).unwrap(), expected_ids[5]); @@ -664,7 +664,7 @@ fn block_allowed_to_skip_epochs() { let tickets = make_ticket_bodies(3, Some(pair)); persist_next_epoch_tickets(&tickets); - let next_random = Sassafras::next_randomness(); + let next_random = NextRandomness::::get(); // We want to skip 3 epochs in this test. let offset = 4 * epoch_length; @@ -674,9 +674,9 @@ fn block_allowed_to_skip_epochs() { // Post-initialization status assert!(SlotRandomness::::exists()); - assert_eq!(Sassafras::genesis_slot(), start_slot); - assert_eq!(Sassafras::current_slot(), start_slot + offset); - assert_eq!(Sassafras::epoch_index(), 4); + assert_eq!(GenesisSlot::::get(), start_slot); + assert_eq!(CurrentSlot::::get(), start_slot + offset); + assert_eq!(EpochIndex::::get(), 4); assert_eq!(Sassafras::current_epoch_start(), start_slot + offset); assert_eq!(Sassafras::current_slot_index(), 0); @@ -686,7 +686,7 @@ fn block_allowed_to_skip_epochs() { assert_eq!(SortedCandidates::::get().len(), 0); // We used the last known next epoch randomness as a fallback - assert_eq!(next_random, Sassafras::randomness()); + assert_eq!(next_random, CurrentRandomness::::get()); }); }