diff --git a/.github/workflows/command-bench-all.yml b/.github/workflows/command-bench-all.yml index 6aa4f6f7ff00..4128f86fb7c8 100644 --- a/.github/workflows/command-bench-all.yml +++ b/.github/workflows/command-bench-all.yml @@ -66,6 +66,9 @@ jobs: runs-on: arc-runners-polkadot-sdk-weights container: image: ${{ needs.set-image.outputs.IMAGE }} + permissions: + contents: write + pull-requests: write steps: - name: Download repo uses: actions/checkout@v4 diff --git a/.github/workflows/command-bench-overhead.yml b/.github/workflows/command-bench-overhead.yml index 16cbcefcf269..fec8d37bb9ef 100644 --- a/.github/workflows/command-bench-overhead.yml +++ b/.github/workflows/command-bench-overhead.yml @@ -45,6 +45,9 @@ jobs: runs-on: arc-runners-polkadot-sdk-benchmark container: image: ${{ needs.set-image.outputs.IMAGE }} + permissions: + contents: write + pull-requests: write steps: - name: Download repo uses: actions/checkout@v4 diff --git a/.github/workflows/command-bench.yml b/.github/workflows/command-bench.yml index b23b06d1b3c0..ac879f443755 100644 --- a/.github/workflows/command-bench.yml +++ b/.github/workflows/command-bench.yml @@ -91,6 +91,9 @@ jobs: runs-on: arc-runners-polkadot-sdk-benchmark container: image: ${{ needs.set-image.outputs.IMAGE }} + permissions: + contents: write + pull-requests: write steps: - name: Download repo uses: actions/checkout@v4 diff --git a/.github/workflows/command-fmt.yml b/.github/workflows/command-fmt.yml index c949d0768d7a..586b8c77f274 100644 --- a/.github/workflows/command-fmt.yml +++ b/.github/workflows/command-fmt.yml @@ -23,6 +23,9 @@ jobs: timeout-minutes: 20 container: image: ${{ needs.set-image.outputs.IMAGE }} + permissions: + contents: write + pull-requests: write steps: - name: Download repo uses: actions/checkout@v4 diff --git a/.github/workflows/command-sync.yml b/.github/workflows/command-sync.yml index fa5bb9eaf912..c610f4066a87 100644 --- a/.github/workflows/command-sync.yml +++ b/.github/workflows/command-sync.yml @@ -38,6 +38,9 @@ jobs: runs-on: arc-runners-polkadot-sdk-warpsync container: image: ${{ needs.set-image.outputs.IMAGE }} + permissions: + contents: write + pull-requests: write steps: - name: Download repo uses: actions/checkout@v4 diff --git a/.github/workflows/command-update-ui.yml b/.github/workflows/command-update-ui.yml index b6b0420e7868..860177adc879 100644 --- a/.github/workflows/command-update-ui.yml +++ b/.github/workflows/command-update-ui.yml @@ -26,6 +26,9 @@ jobs: timeout-minutes: 90 container: image: ${{ needs.set-image.outputs.IMAGE }} + permissions: + contents: write + pull-requests: write steps: - name: Download repo uses: actions/checkout@v4 diff --git a/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile b/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile index 634b9f188291..60698de1d6ad 100644 --- a/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile +++ b/docker/dockerfiles/bridges_zombienet_tests_injected.Dockerfile @@ -1,7 +1,7 @@ # this image is built on top of existing Zombienet image ARG ZOMBIENET_IMAGE # this image uses substrate-relay image built elsewhere -ARG SUBSTRATE_RELAY_IMAGE=docker.io/paritytech/substrate-relay:v1.6.5 +ARG SUBSTRATE_RELAY_IMAGE=docker.io/paritytech/substrate-relay:v1.6.6 # metadata ARG VCS_REF diff --git a/polkadot/node/network/approval-distribution/src/lib.rs b/polkadot/node/network/approval-distribution/src/lib.rs index 369d82b45b09..d48fb08a311c 100644 --- a/polkadot/node/network/approval-distribution/src/lib.rs +++ b/polkadot/node/network/approval-distribution/src/lib.rs @@ -1431,6 +1431,21 @@ impl State { let required_routing = topology.map_or(RequiredRouting::PendingTopology, |t| { t.local_grid_neighbors().required_routing_by_index(validator_index, local) }); + // Peers that we will send the assignment to. + let mut peers = HashSet::new(); + + let peers_to_route_to = topology + .as_ref() + .map(|t| t.peers_to_route(required_routing)) + .unwrap_or_default(); + + for peer in peers_to_route_to { + if !entry.known_by.contains_key(&peer) { + continue + } + + peers.insert(peer); + } // All the peers that know the relay chain block. let peers_to_filter = entry.known_by(); @@ -1456,20 +1471,13 @@ impl State { let n_peers_total = self.peer_views.len(); let source_peer = source.peer_id(); - // Peers that we will send the assignment to. - let mut peers = Vec::new(); - // Filter destination peers for peer in peers_to_filter.into_iter() { if Some(peer) == source_peer { continue } - if let Some(true) = topology - .as_ref() - .map(|t| t.local_grid_neighbors().route_to_peer(required_routing, &peer)) - { - peers.push(peer); + if peers.contains(&peer) { continue } @@ -1485,7 +1493,11 @@ impl State { if route_random { approval_entry.routing_info_mut().mark_randomly_sent(peer); - peers.push(peer); + peers.insert(peer); + } + + if approval_entry.routing_info().random_routing.is_complete() { + break } } diff --git a/polkadot/node/network/approval-distribution/src/tests.rs b/polkadot/node/network/approval-distribution/src/tests.rs index 5ad034464767..2d08807f97b6 100644 --- a/polkadot/node/network/approval-distribution/src/tests.rs +++ b/polkadot/node/network/approval-distribution/src/tests.rs @@ -2404,7 +2404,7 @@ fn propagates_locally_generated_assignment_to_both_dimensions() { let assignments = vec![(cert.clone(), candidate_index)]; let approvals = vec![approval.clone()]; - let assignment_sent_peers = assert_matches!( + let mut assignment_sent_peers = assert_matches!( overseer_recv(overseer).await, AllMessages::NetworkBridgeTx(NetworkBridgeTxMessage::SendValidationMessage( sent_peers, @@ -2428,12 +2428,14 @@ fn propagates_locally_generated_assignment_to_both_dimensions() { assert_matches!( overseer_recv(overseer).await, AllMessages::NetworkBridgeTx(NetworkBridgeTxMessage::SendValidationMessage( - sent_peers, + mut sent_peers, Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution( protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals) )) )) => { // Random sampling is reused from the assignment. + sent_peers.sort(); + assignment_sent_peers.sort(); assert_eq!(sent_peers, assignment_sent_peers); assert_eq!(sent_approvals, approvals); } @@ -2678,7 +2680,7 @@ fn propagates_to_required_after_connect() { let assignments = vec![(cert.clone(), candidate_index)]; let approvals = vec![approval.clone()]; - let assignment_sent_peers = assert_matches!( + let mut assignment_sent_peers = assert_matches!( overseer_recv(overseer).await, AllMessages::NetworkBridgeTx(NetworkBridgeTxMessage::SendValidationMessage( sent_peers, @@ -2702,12 +2704,14 @@ fn propagates_to_required_after_connect() { assert_matches!( overseer_recv(overseer).await, AllMessages::NetworkBridgeTx(NetworkBridgeTxMessage::SendValidationMessage( - sent_peers, + mut sent_peers, Versioned::V1(protocol_v1::ValidationProtocol::ApprovalDistribution( protocol_v1::ApprovalDistributionMessage::Approvals(sent_approvals) )) )) => { // Random sampling is reused from the assignment. + sent_peers.sort(); + assignment_sent_peers.sort(); assert_eq!(sent_peers, assignment_sent_peers); assert_eq!(sent_approvals, approvals); } diff --git a/polkadot/node/network/protocol/src/grid_topology.rs b/polkadot/node/network/protocol/src/grid_topology.rs index a14d24610722..4dd7d29fc25c 100644 --- a/polkadot/node/network/protocol/src/grid_topology.rs +++ b/polkadot/node/network/protocol/src/grid_topology.rs @@ -313,6 +313,23 @@ impl SessionGridTopologyEntry { self.topology.is_validator(peer) } + /// Returns the list of peers to route based on the required routing. + pub fn peers_to_route(&self, required_routing: RequiredRouting) -> Vec { + match required_routing { + RequiredRouting::All => self.topology.peer_ids.iter().copied().collect(), + RequiredRouting::GridX => self.local_neighbors.peers_x.iter().copied().collect(), + RequiredRouting::GridY => self.local_neighbors.peers_y.iter().copied().collect(), + RequiredRouting::GridXY => self + .local_neighbors + .peers_x + .iter() + .chain(self.local_neighbors.peers_y.iter()) + .copied() + .collect(), + RequiredRouting::None | RequiredRouting::PendingTopology => Vec::new(), + } + } + /// Updates the known peer ids for the passed authorities ids. pub fn update_authority_ids( &mut self, @@ -524,6 +541,11 @@ impl RandomRouting { pub fn inc_sent(&mut self) { self.sent += 1 } + + /// Returns `true` if we already took all the necessary samples. + pub fn is_complete(&self) -> bool { + self.sent >= self.target + } } /// Routing mode diff --git a/prdoc/pr_4848.prdoc b/prdoc/pr_4848.prdoc new file mode 100644 index 000000000000..cbc0c8322d77 --- /dev/null +++ b/prdoc/pr_4848.prdoc @@ -0,0 +1,14 @@ +title: Optimize logic for gossiping assignments + +doc: + - audience: Node Dev + description: | + Optimize the logic for gossiping assignments by obtaining the list of peer ids + from the topology instead of iterating through all connected validators, this + gives us a 15% to 20% reduction in cpu usage. + +crates: +- name: polkadot-approval-distribution + bump: minor +- name: polkadot-node-network-protocol + bump: minor \ No newline at end of file diff --git a/prdoc/pr_4972.prdoc b/prdoc/pr_4972.prdoc new file mode 100644 index 000000000000..dd9f1b531aad --- /dev/null +++ b/prdoc/pr_4972.prdoc @@ -0,0 +1,14 @@ +# 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 pallet-session" + +doc: + - audience: Runtime Dev + description: | + This PR removes the `pallet::getter`s from `pallet-session`. + The syntax `StorageItem::::get()` should be used instead. + +crates: + - name: pallet-session + bump: minor diff --git a/substrate/client/network/src/litep2p/mod.rs b/substrate/client/network/src/litep2p/mod.rs index 824f62082cac..34ca5b716101 100644 --- a/substrate/client/network/src/litep2p/mod.rs +++ b/substrate/client/network/src/litep2p/mod.rs @@ -851,6 +851,10 @@ impl NetworkBackend for Litep2pNetworkBac "`PUT_VALUE` for {key:?} ({query_id:?}) succeeded", ); + self.event_streams.send(Event::Dht( + DhtEvent::ValuePut(libp2p::kad::RecordKey::new(&key)) + )); + if let Some(ref metrics) = self.metrics { metrics .kademlia_query_duration diff --git a/substrate/client/rpc-servers/src/lib.rs b/substrate/client/rpc-servers/src/lib.rs index 619498b33336..0bae16b113df 100644 --- a/substrate/client/rpc-servers/src/lib.rs +++ b/substrate/client/rpc-servers/src/lib.rs @@ -224,8 +224,9 @@ where ), }; - let rpc_middleware = - RpcServiceBuilder::new().option_layer(middleware_layer.clone()); + let rpc_middleware = RpcServiceBuilder::new() + .rpc_logger(1024) + .option_layer(middleware_layer.clone()); let mut svc = service_builder.set_rpc_middleware(rpc_middleware).build(methods, stop_handle); diff --git a/substrate/frame/session/README.md b/substrate/frame/session/README.md index fa7c9b3f9834..5a063bffee0b 100644 --- a/substrate/frame/session/README.md +++ b/substrate/frame/session/README.md @@ -70,7 +70,7 @@ set. use pallet_session as session; fn validators() -> Vec<::ValidatorId> { - >::validators() + pallet_session::Validators::::get() } ``` diff --git a/substrate/frame/session/benchmarking/src/inner.rs b/substrate/frame/session/benchmarking/src/inner.rs index f08e10f07869..9ba47b34ed7a 100644 --- a/substrate/frame/session/benchmarking/src/inner.rs +++ b/substrate/frame/session/benchmarking/src/inner.rs @@ -152,7 +152,7 @@ fn check_membership_proof_setup( Pallet::::on_initialize(frame_system::pallet_prelude::BlockNumberFor::::one()); // skip sessions until the new validator set is enacted - while Session::::validators().len() < n as usize { + while Validators::::get().len() < n as usize { Session::::rotate_session(); } diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 45f70dfa2582..e1a2a31911fe 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -95,7 +95,7 @@ //! use pallet_session as session; //! //! fn validators() -> Vec<::ValidatorId> { -//! >::validators() +//! pallet_session::Validators::::get() //! } //! # fn main(){} //! ``` @@ -447,7 +447,7 @@ pub mod pallet { }); for (account, val, keys) in self.keys.iter().cloned() { - >::inner_set_keys(&val, keys) + Pallet::::inner_set_keys(&val, keys) .expect("genesis config must not contain duplicates; qed"); if frame_system::Pallet::::inc_consumers_without_limit(&account).is_err() { // This will leak a provider reference, however it only happens once (at @@ -479,7 +479,7 @@ pub mod pallet { T::SessionHandler::on_genesis_session::(&queued_keys); Validators::::put(initial_validators_0); - >::put(queued_keys); + QueuedKeys::::put(queued_keys); T::SessionManager::start_session(0); } @@ -487,12 +487,10 @@ pub mod pallet { /// The current set of validators. #[pallet::storage] - #[pallet::getter(fn validators)] pub type Validators = StorageValue<_, Vec, ValueQuery>; /// Current index of the session. #[pallet::storage] - #[pallet::getter(fn current_index)] pub type CurrentIndex = StorageValue<_, SessionIndex, ValueQuery>; /// True if the underlying economic identities or weighting behind the validators @@ -503,7 +501,6 @@ pub mod pallet { /// The queued keys for the next session. When the next session begins, these keys /// will be used to determine the validator's session keys. #[pallet::storage] - #[pallet::getter(fn queued_keys)] pub type QueuedKeys = StorageValue<_, Vec<(T::ValidatorId, T::Keys)>, ValueQuery>; /// Indices of disabled validators. @@ -512,7 +509,6 @@ pub mod pallet { /// disabled using binary search. It gets cleared when `on_session_ending` returns /// a new set of identities. #[pallet::storage] - #[pallet::getter(fn disabled_validators)] pub type DisabledValidators = StorageValue<_, Vec, ValueQuery>; /// The next session keys for a validator. @@ -609,33 +605,53 @@ pub mod pallet { } impl Pallet { + /// Public function to access the current set of validators. + pub fn validators() -> Vec { + Validators::::get() + } + + /// Public function to access the current session index. + pub fn current_index() -> SessionIndex { + CurrentIndex::::get() + } + + /// Public function to access the queued keys. + pub fn queued_keys() -> Vec<(T::ValidatorId, T::Keys)> { + QueuedKeys::::get() + } + + /// Public function to access the disabled validators. + pub fn disabled_validators() -> Vec { + DisabledValidators::::get() + } + /// Move on to next session. Register new validator set and session keys. Changes to the /// validator set have a session of delay to take effect. This allows for equivocation /// punishment after a fork. pub fn rotate_session() { - let session_index = >::get(); + let session_index = CurrentIndex::::get(); log::trace!(target: "runtime::session", "rotating session {:?}", session_index); - let changed = >::get(); + let changed = QueuedChanged::::get(); // Inform the session handlers that a session is going to end. T::SessionHandler::on_before_session_ending(); T::SessionManager::end_session(session_index); // Get queued session keys and validators. - let session_keys = >::get(); + let session_keys = QueuedKeys::::get(); let validators = session_keys.iter().map(|(validator, _)| validator.clone()).collect::>(); Validators::::put(&validators); if changed { // reset disabled validators if active set was changed - >::take(); + DisabledValidators::::take(); } // Increment session index. let session_index = session_index + 1; - >::put(session_index); + CurrentIndex::::put(session_index); T::SessionManager::start_session(session_index); @@ -683,8 +699,8 @@ impl Pallet { (queued_amalgamated, changed) }; - >::put(queued_amalgamated.clone()); - >::put(next_changed); + QueuedKeys::::put(queued_amalgamated.clone()); + QueuedChanged::::put(next_changed); // Record that this happened. Self::deposit_event(Event::NewSession { session_index }); @@ -699,7 +715,7 @@ impl Pallet { return false } - >::mutate(|disabled| { + DisabledValidators::::mutate(|disabled| { if let Err(index) = disabled.binary_search(&i) { disabled.insert(index, i); T::SessionHandler::on_disabled(i); @@ -716,7 +732,7 @@ impl Pallet { /// Returns `false` either if the validator could not be found or it was already /// disabled. pub fn disable(c: &T::ValidatorId) -> bool { - Self::validators() + Validators::::get() .iter() .position(|i| i == c) .map(|i| Self::disable_index(i as u32)) @@ -747,7 +763,7 @@ impl Pallet { let new_ids = T::Keys::key_ids(); // Translate NextKeys, and key ownership relations at the same time. - >::translate::(|val, old_keys| { + NextKeys::::translate::(|val, old_keys| { // Clear all key ownership relations. Typically the overlap should // stay the same, but no guarantees by the upgrade function. for i in old_ids.iter() { @@ -764,7 +780,7 @@ impl Pallet { Some(new_keys) }); - let _ = >::translate::, _>(|k| { + let _ = QueuedKeys::::translate::, _>(|k| { k.map(|k| { k.into_iter() .map(|(val, old_keys)| (val.clone(), upgrade(val, old_keys))) @@ -850,28 +866,28 @@ impl Pallet { } fn load_keys(v: &T::ValidatorId) -> Option { - >::get(v) + NextKeys::::get(v) } fn take_keys(v: &T::ValidatorId) -> Option { - >::take(v) + NextKeys::::take(v) } fn put_keys(v: &T::ValidatorId, keys: &T::Keys) { - >::insert(v, keys); + NextKeys::::insert(v, keys); } /// Query the owner of a session key by returning the owner's validator ID. pub fn key_owner(id: KeyTypeId, key_data: &[u8]) -> Option { - >::get((id, key_data)) + KeyOwner::::get((id, key_data)) } fn put_key_owner(id: KeyTypeId, key_data: &[u8], v: &T::ValidatorId) { - >::insert((id, key_data), v) + KeyOwner::::insert((id, key_data), v) } fn clear_key_owner(id: KeyTypeId, key_data: &[u8]) { - >::remove((id, key_data)); + KeyOwner::::remove((id, key_data)); } } @@ -886,11 +902,11 @@ impl ValidatorSet for Pallet { type ValidatorIdOf = T::ValidatorIdOf; fn session_index() -> sp_staking::SessionIndex { - Pallet::::current_index() + CurrentIndex::::get() } fn validators() -> Vec { - Pallet::::validators() + Validators::::get() } } @@ -908,11 +924,11 @@ impl EstimateNextNewSession> for Pallet { impl frame_support::traits::DisabledValidators for Pallet { fn is_disabled(index: u32) -> bool { - >::disabled_validators().binary_search(&index).is_ok() + DisabledValidators::::get().binary_search(&index).is_ok() } fn disabled_validators() -> Vec { - >::disabled_validators() + DisabledValidators::::get() } } @@ -930,7 +946,7 @@ impl> FindAuthor { let i = Inner::find_author(digests)?; - let validators = >::validators(); + let validators = Validators::::get(); validators.get(i as usize).cloned() } } diff --git a/substrate/frame/session/src/tests.rs b/substrate/frame/session/src/tests.rs index 69337e016ea8..f392c2ab7663 100644 --- a/substrate/frame/session/src/tests.rs +++ b/substrate/frame/session/src/tests.rs @@ -44,7 +44,7 @@ fn initialize_block(block: u64) { fn simple_setup_should_work() { new_test_ext().execute_with(|| { assert_eq!(authorities(), vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)]); - assert_eq!(Session::validators(), vec![1, 2, 3]); + assert_eq!(Validators::::get(), vec![1, 2, 3]); }); } @@ -60,7 +60,7 @@ fn put_get_keys() { fn keys_cleared_on_kill() { let mut ext = new_test_ext(); ext.execute_with(|| { - assert_eq!(Session::validators(), vec![1, 2, 3]); + assert_eq!(Validators::::get(), vec![1, 2, 3]); assert_eq!(Session::load_keys(&1), Some(UintAuthorityId(1).into())); let id = DUMMY; @@ -79,7 +79,7 @@ fn keys_cleared_on_kill() { fn purge_keys_works_for_stash_id() { let mut ext = new_test_ext(); ext.execute_with(|| { - assert_eq!(Session::validators(), vec![1, 2, 3]); + assert_eq!(Validators::::get(), vec![1, 2, 3]); TestValidatorIdOf::set(vec![(10, 1), (20, 2), (3, 3)].into_iter().collect()); assert_eq!(Session::load_keys(&1), Some(UintAuthorityId(1).into())); assert_eq!(Session::load_keys(&2), Some(UintAuthorityId(2).into())); @@ -108,10 +108,10 @@ fn authorities_should_track_validators() { force_new_session(); initialize_block(1); assert_eq!( - Session::queued_keys(), + QueuedKeys::::get(), vec![(1, UintAuthorityId(1).into()), (2, UintAuthorityId(2).into()),] ); - assert_eq!(Session::validators(), vec![1, 2, 3]); + assert_eq!(Validators::::get(), vec![1, 2, 3]); assert_eq!(authorities(), vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(3)]); assert!(before_session_end_called()); reset_before_session_end_called(); @@ -119,10 +119,10 @@ fn authorities_should_track_validators() { force_new_session(); initialize_block(2); assert_eq!( - Session::queued_keys(), + QueuedKeys::::get(), vec![(1, UintAuthorityId(1).into()), (2, UintAuthorityId(2).into()),] ); - assert_eq!(Session::validators(), vec![1, 2]); + assert_eq!(Validators::::get(), vec![1, 2]); assert_eq!(authorities(), vec![UintAuthorityId(1), UintAuthorityId(2)]); assert!(before_session_end_called()); reset_before_session_end_called(); @@ -132,28 +132,28 @@ fn authorities_should_track_validators() { force_new_session(); initialize_block(3); assert_eq!( - Session::queued_keys(), + QueuedKeys::::get(), vec![ (1, UintAuthorityId(1).into()), (2, UintAuthorityId(2).into()), (4, UintAuthorityId(4).into()), ] ); - assert_eq!(Session::validators(), vec![1, 2]); + assert_eq!(Validators::::get(), vec![1, 2]); assert_eq!(authorities(), vec![UintAuthorityId(1), UintAuthorityId(2)]); assert!(before_session_end_called()); force_new_session(); initialize_block(4); assert_eq!( - Session::queued_keys(), + QueuedKeys::::get(), vec![ (1, UintAuthorityId(1).into()), (2, UintAuthorityId(2).into()), (4, UintAuthorityId(4).into()), ] ); - assert_eq!(Session::validators(), vec![1, 2, 4]); + assert_eq!(Validators::::get(), vec![1, 2, 4]); assert_eq!(authorities(), vec![UintAuthorityId(1), UintAuthorityId(2), UintAuthorityId(4)]); }); } @@ -164,20 +164,20 @@ fn should_work_with_early_exit() { set_session_length(10); initialize_block(1); - assert_eq!(Session::current_index(), 0); + assert_eq!(CurrentIndex::::get(), 0); initialize_block(2); - assert_eq!(Session::current_index(), 0); + assert_eq!(CurrentIndex::::get(), 0); force_new_session(); initialize_block(3); - assert_eq!(Session::current_index(), 1); + assert_eq!(CurrentIndex::::get(), 1); initialize_block(9); - assert_eq!(Session::current_index(), 1); + assert_eq!(CurrentIndex::::get(), 1); initialize_block(10); - assert_eq!(Session::current_index(), 2); + assert_eq!(CurrentIndex::::get(), 2); }); } @@ -402,7 +402,7 @@ fn upgrade_keys() { // Set `QueuedKeys`. { - let storage_key = >::hashed_key(); + let storage_key = super::QueuedKeys::::hashed_key(); assert!(storage::unhashed::exists(&storage_key)); storage::unhashed::put(&storage_key, &val_keys); } @@ -410,7 +410,7 @@ fn upgrade_keys() { // Set `NextKeys`. { for &(i, ref keys) in val_keys.iter() { - let storage_key = >::hashed_key_for(i); + let storage_key = super::NextKeys::::hashed_key_for(i); assert!(storage::unhashed::exists(&storage_key)); storage::unhashed::put(&storage_key, keys); } @@ -446,12 +446,12 @@ fn upgrade_keys() { // Check queued keys. assert_eq!( - Session::queued_keys(), + QueuedKeys::::get(), vec![(1, mock_keys_for(1)), (2, mock_keys_for(2)), (3, mock_keys_for(3)),], ); for i in 1u64..4 { - assert_eq!(>::get(&i), Some(mock_keys_for(i))); + assert_eq!(super::NextKeys::::get(&i), Some(mock_keys_for(i))); } }) } @@ -466,8 +466,8 @@ fn test_migration_v1() { use frame_support::traits::{PalletInfoAccess, StorageVersion}; new_test_ext().execute_with(|| { - assert!(>::iter_values().count() > 0); - assert!(>::exists()); + assert!(HistoricalSessions::::iter_values().count() > 0); + assert!(StoredRange::::exists()); let old_pallet = "Session"; let new_pallet = ::name();