Skip to content

Commit 20ce4d9

Browse files
authored
Merge pull request #3535 from tediou5/chore/update-rust-toolchain-and-edition
chore: update rust toolchain, migrate to 2024 edition
2 parents 23ecc80 + 62e7ae5 commit 20ce4d9

File tree

386 files changed

+2149
-2123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

386 files changed

+2149
-2123
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[workspace.package]
2+
edition = "2024"
3+
14
[workspace]
25
resolver = "2"
36
members = [

crates/pallet-domains/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "pallet-domains"
33
version = "0.1.0"
44
authors = ["Subspace Labs <https://subspace.network>"]
5-
edition = "2021"
5+
edition.workspace = true
66
license = "0BSD"
77
homepage = "https://subspace.network"
88
repository = "https://github.com/autonomys/subspace"

crates/pallet-domains/src/benchmarking.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,49 @@
33
extern crate alloc;
44

55
use super::*;
6-
use crate::block_tree::{prune_receipt, BlockTreeNode};
6+
use crate::block_tree::{BlockTreeNode, prune_receipt};
77
use crate::bundle_storage_fund::refund_storage_fee;
8-
use crate::domain_registry::{into_domain_config, DomainConfigParams};
8+
use crate::domain_registry::{DomainConfigParams, into_domain_config};
99
use crate::runtime_registry::DomainRuntimeUpgradeEntry;
1010
use crate::staking::{
11-
do_convert_previous_epoch_withdrawal, do_mark_operators_as_slashed, do_reward_operators,
1211
Error as StakingError, OperatorConfig, OperatorStatus, WithdrawStake,
12+
do_convert_previous_epoch_withdrawal, do_mark_operators_as_slashed, do_reward_operators,
1313
};
1414
use crate::staking_epoch::{
1515
do_finalize_domain_current_epoch, do_finalize_domain_epoch_staking, do_slash_operator,
1616
operator_take_reward_tax_and_stake,
1717
};
1818
use crate::{
19-
DomainBlockNumberFor, ExecutionReceiptOf, Pallet as Domains, RawOrigin as DomainOrigin,
20-
MAX_NOMINATORS_TO_SLASH,
19+
DomainBlockNumberFor, ExecutionReceiptOf, MAX_NOMINATORS_TO_SLASH, Pallet as Domains,
20+
RawOrigin as DomainOrigin,
2121
};
2222
#[cfg(not(feature = "std"))]
2323
use alloc::borrow::ToOwned;
2424
#[cfg(not(feature = "std"))]
2525
use alloc::vec::Vec;
2626
use frame_benchmarking::v2::*;
2727
use frame_support::assert_ok;
28-
use frame_support::traits::fungible::{Inspect, Mutate};
2928
use frame_support::traits::Hooks;
29+
use frame_support::traits::fungible::{Inspect, Mutate};
3030
use frame_system::{Pallet as System, RawOrigin};
3131
use hex_literal::hex;
3232
use pallet_subspace::BlockRandomness;
3333
use sp_consensus_slots::Slot;
34+
use sp_core::H256;
3435
use sp_core::crypto::{Ss58Codec, UncheckedFrom};
3536
use sp_core::sr25519::vrf::{VrfPreOutput, VrfProof, VrfSignature};
36-
use sp_core::H256;
3737
use sp_domains::merkle_tree::MerkleTree;
3838
use sp_domains::{
39-
dummy_opaque_bundle, BundleHeader, DomainId, ExecutionReceipt, OpaqueBundle, OperatorAllowList,
40-
OperatorId, OperatorPublicKey, OperatorRewardSource, OperatorSignature,
39+
BundleHeader, DomainId, EMPTY_EXTRINSIC_ROOT, ExecutionReceipt, OpaqueBundle,
40+
OperatorAllowList, OperatorId, OperatorPublicKey, OperatorRewardSource, OperatorSignature,
4141
PermissionedActionAllowedBy, ProofOfElection, RuntimeType, SealedBundleHeader,
42-
SealedSingletonReceipt, SingletonReceipt, EMPTY_EXTRINSIC_ROOT,
42+
SealedSingletonReceipt, SingletonReceipt, dummy_opaque_bundle,
4343
};
4444
use sp_domains_fraud_proof::fraud_proof::FraudProof;
4545
use sp_runtime::traits::{CheckedAdd, One, Zero};
4646
use sp_std::collections::btree_set::BTreeSet;
47-
use subspace_core_primitives::pot::PotOutput;
4847
use subspace_core_primitives::Randomness;
48+
use subspace_core_primitives::pot::PotOutput;
4949

5050
const SEED: u32 = 0;
5151
const MAX_NOMINATORS_TO_SLASH_WITHOUT_OPERATOR: u32 = MAX_NOMINATORS_TO_SLASH - 1;

crates/pallet-domains/src/block_tree.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
};
1313
#[cfg(not(feature = "std"))]
1414
use alloc::vec::Vec;
15-
use frame_support::{ensure, PalletError};
15+
use frame_support::{PalletError, ensure};
1616
use frame_system::pallet_prelude::BlockNumberFor;
1717
use parity_scale_codec::{Decode, Encode};
1818
use scale_info::TypeInfo;
@@ -629,9 +629,10 @@ pub(crate) fn prune_receipt<T: Config>(
629629
mod tests {
630630
use super::*;
631631
use crate::tests::{
632-
create_dummy_bundle_with_receipts, create_dummy_receipt, extend_block_tree,
633-
extend_block_tree_from_zero, get_block_tree_node_at, new_test_ext_with_extensions,
634-
register_genesis_domain, run_to_block, BlockTreePruningDepth, Domains, Test,
632+
BlockTreePruningDepth, Domains, Test, create_dummy_bundle_with_receipts,
633+
create_dummy_receipt, extend_block_tree, extend_block_tree_from_zero,
634+
get_block_tree_node_at, new_test_ext_with_extensions, register_genesis_domain,
635+
run_to_block,
635636
};
636637
use crate::{FrozenDomains, RawOrigin as DomainOrigin};
637638
use frame_support::dispatch::RawOrigin;
@@ -781,11 +782,10 @@ mod tests {
781782
verify_execution_receipt::<Test>(domain_id, &pruned_receipt),
782783
Error::PrunedReceipt
783784
);
784-
assert!(ConsensusBlockHash::<Test>::get(
785-
domain_id,
786-
pruned_receipt.consensus_block_number,
787-
)
788-
.is_none());
785+
assert!(
786+
ConsensusBlockHash::<Test>::get(domain_id, pruned_receipt.consensus_block_number,)
787+
.is_none()
788+
);
789789
});
790790
}
791791

@@ -1091,11 +1091,13 @@ mod tests {
10911091
let mut invalid_execution_trace_receipt = next_receipt;
10921092

10931093
// Receipt with only one element in execution trace vector
1094-
invalid_execution_trace_receipt.execution_trace = vec![invalid_execution_trace_receipt
1095-
.execution_trace
1096-
.first()
1097-
.cloned()
1098-
.expect("First element should be there; qed")];
1094+
invalid_execution_trace_receipt.execution_trace = vec![
1095+
invalid_execution_trace_receipt
1096+
.execution_trace
1097+
.first()
1098+
.cloned()
1099+
.expect("First element should be there; qed"),
1100+
];
10991101
assert_err!(
11001102
verify_execution_receipt::<Test>(domain_id, &invalid_execution_trace_receipt),
11011103
Error::InvalidExecutionTrace

crates/pallet-domains/src/bundle_storage_fund.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
use crate::staking::NewDeposit;
44
use crate::staking_epoch::mint_into_treasury;
55
use crate::{BalanceOf, Config, Event, HoldIdentifier, Operators, Pallet};
6+
use frame_support::PalletError;
7+
use frame_support::traits::Get;
68
use frame_support::traits::fungible::{Inspect, Mutate, MutateHold};
79
use frame_support::traits::tokens::{Fortitude, Precision, Preservation};
8-
use frame_support::traits::Get;
9-
use frame_support::PalletError;
1010
use parity_scale_codec::{Decode, Encode};
1111
use scale_info::TypeInfo;
1212
use sp_domains::OperatorId;
13-
use sp_runtime::traits::{AccountIdConversion, CheckedSub, Zero};
1413
use sp_runtime::Perbill;
14+
use sp_runtime::traits::{AccountIdConversion, CheckedSub, Zero};
1515
use sp_std::collections::btree_map::BTreeMap;
1616
use subspace_runtime_primitives::StorageFee;
1717

crates/pallet-domains/src/domain_registry.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::pallet::{DomainStakingSummary, NextEVMChainId};
88
use crate::runtime_registry::DomainRuntimeInfo;
99
use crate::staking::StakingSummary;
1010
use crate::{
11-
into_complete_raw_genesis, BalanceOf, Config, DomainHashingFor, DomainRegistry,
12-
DomainSudoCalls, ExecutionReceiptOf, HoldIdentifier, NextDomainId, RuntimeRegistry,
11+
BalanceOf, Config, DomainHashingFor, DomainRegistry, DomainSudoCalls, ExecutionReceiptOf,
12+
HoldIdentifier, NextDomainId, RuntimeRegistry, into_complete_raw_genesis,
1313
};
1414
#[cfg(not(feature = "std"))]
1515
use alloc::string::String;
@@ -19,18 +19,18 @@ use domain_runtime_primitives::MultiAccountId;
1919
use frame_support::traits::fungible::{Inspect, Mutate, MutateHold};
2020
use frame_support::traits::tokens::{Fortitude, Precision, Preservation};
2121
use frame_support::weights::Weight;
22-
use frame_support::{ensure, PalletError};
22+
use frame_support::{PalletError, ensure};
2323
use frame_system::pallet_prelude::*;
2424
use parity_scale_codec::{Decode, Encode};
2525
use scale_info::TypeInfo;
2626
use sp_core::Get;
2727
use sp_domains::{
28-
calculate_max_bundle_weight_and_size, derive_domain_block_hash, DomainBundleLimit, DomainId,
29-
DomainRuntimeConfig, DomainSudoCall, DomainsDigestItem, DomainsTransfersTracker,
30-
OnDomainInstantiated, OperatorAllowList, RuntimeId, RuntimeType,
28+
DomainBundleLimit, DomainId, DomainRuntimeConfig, DomainSudoCall, DomainsDigestItem,
29+
DomainsTransfersTracker, OnDomainInstantiated, OperatorAllowList, RuntimeId, RuntimeType,
30+
calculate_max_bundle_weight_and_size, derive_domain_block_hash,
3131
};
32-
use sp_runtime::traits::{CheckedAdd, Zero};
3332
use sp_runtime::DigestItem;
33+
use sp_runtime::traits::{CheckedAdd, Zero};
3434
use sp_std::collections::btree_map::BTreeMap;
3535
use sp_std::collections::btree_set::BTreeSet;
3636

@@ -384,7 +384,7 @@ pub(crate) fn do_update_domain_allow_list<T: Config>(
384384
#[cfg(test)]
385385
mod tests {
386386
use super::*;
387-
use crate::tests::{new_test_ext, Test, TEST_RUNTIME_APIS};
387+
use crate::tests::{TEST_RUNTIME_APIS, Test, new_test_ext};
388388
use domain_runtime_primitives::{AccountId20, AccountId20Converter};
389389
use frame_support::traits::Currency;
390390
use frame_support::{assert_err, assert_ok};
@@ -393,7 +393,7 @@ mod tests {
393393
use sp_domains::{EvmDomainRuntimeConfig, EvmType, PermissionedActionAllowedBy, RuntimeObject};
394394
use sp_runtime::traits::Convert;
395395
use sp_std::vec;
396-
use sp_version::{create_apis_vec, RuntimeVersion};
396+
use sp_version::{RuntimeVersion, create_apis_vec};
397397
use subspace_runtime_primitives::SSC;
398398

399399
type Balances = pallet_balances::Pallet<Test>;

crates/pallet-domains/src/extensions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use frame_support::weights::Weight;
88
use frame_system::pallet_prelude::RuntimeCallFor;
99
use parity_scale_codec::{Decode, Encode};
1010
use scale_info::prelude::fmt;
11-
use sp_domains_fraud_proof::weights::fraud_proof_verification_weights;
1211
use sp_domains_fraud_proof::InvalidTransactionCode;
12+
use sp_domains_fraud_proof::weights::fraud_proof_verification_weights;
1313
use sp_runtime::impl_tx_ext_default;
1414
use sp_runtime::traits::{
1515
AsSystemOriginSigner, DispatchInfoOf, DispatchOriginOf, Dispatchable, Get, Implication,

0 commit comments

Comments
 (0)