Skip to content

Commit 265b69f

Browse files
committed
upgrade to Rust 2024 Edition 🎉
1 parent fcc06c2 commit 265b69f

File tree

19 files changed

+50
-49
lines changed

19 files changed

+50
-49
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
description = "Implementation of the bittensor blockchain"
55
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
66
homepage = "https://substrate.io/"
7-
edition = "2021"
7+
edition = "2024"
88
license = "Unlicense"
99
publish = false
1010
repository = "https://github.com/opentensor/subtensor"

node/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "4.0.0-dev"
44
description = "A fresh FRAME-based Substrate node, ready for hacking."
55
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
66
homepage = "https://substrate.io/"
7-
edition = "2021"
7+
edition = "2024"
88
license = "Unlicense"
99
publish = false
1010
repository = "https://github.com/opentensor/subtensor"

pallets/admin-utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "4.0.0-dev"
44
description = "FRAME pallet for extending admin utilities."
55
authors = ["Bittensor Nucleus Team"]
66
homepage = "https://bittensor.com"
7-
edition = "2021"
7+
edition = "2024"
88
license = "Unlicense"
99
publish = false
1010
repository = "https://github.com/opentensor/subtensor"

pallets/collective/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "pallet-collective"
33
version = "4.0.0-dev"
44
authors = ["Parity Technologies <[email protected]>, Opentensor Technologies"]
5-
edition = "2021"
5+
edition = "2024"
66
license = "Apache-2.0"
77
homepage = "https://bittensor.com"
88
repository = "https://github.com/opentensor/subtensor"

pallets/commitments/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "4.0.0-dev"
44
description = "Add the ability to commit generic hashed data for network participants."
55
authors = ["Bittensor Nucleus Team"]
66
homepage = "https://bittensor.com"
7-
edition = "2021"
7+
edition = "2024"
88
license = "Unlicense"
99
publish = false
1010
repository = "https://github.com/opentensor/subtensor"

pallets/commitments/src/types.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
use codec::{Codec, Decode, Encode, MaxEncodedLen};
1919
use frame_support::{
20-
traits::{ConstU32, Get},
2120
BoundedVec, CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound,
21+
traits::{ConstU32, Get},
2222
};
2323
use scale_info::{
24-
build::{Fields, Variants},
2524
Path, Type, TypeInfo,
25+
build::{Fields, Variants},
2626
};
2727
use sp_runtime::{
28-
traits::{AppendZerosInput, AtLeast32BitUnsigned},
2928
RuntimeDebug,
29+
traits::{AppendZerosInput, AtLeast32BitUnsigned},
3030
};
3131
use sp_std::{fmt::Debug, iter::once, prelude::*};
3232
use subtensor_macros::freeze_struct;
@@ -86,16 +86,16 @@ impl Encode for Data {
8686
fn encode(&self) -> Vec<u8> {
8787
match self {
8888
Data::None => vec![0u8; 1],
89-
Data::Raw(ref x) => {
89+
Data::Raw(x) => {
9090
let l = x.len().min(128) as u8;
9191
let mut r = vec![l.saturating_add(1)];
9292
r.extend_from_slice(&x[..]);
9393
r
9494
}
95-
Data::BlakeTwo256(ref h) => once(130).chain(h.iter().cloned()).collect(),
96-
Data::Sha256(ref h) => once(131).chain(h.iter().cloned()).collect(),
97-
Data::Keccak256(ref h) => once(132).chain(h.iter().cloned()).collect(),
98-
Data::ShaThree256(ref h) => once(133).chain(h.iter().cloned()).collect(),
95+
Data::BlakeTwo256(h) => once(130).chain(h.iter().cloned()).collect(),
96+
Data::Sha256(h) => once(131).chain(h.iter().cloned()).collect(),
97+
Data::Keccak256(h) => once(132).chain(h.iter().cloned()).collect(),
98+
Data::ShaThree256(h) => once(133).chain(h.iter().cloned()).collect(),
9999
}
100100
}
101101
}
@@ -331,10 +331,10 @@ pub struct Registration<
331331
// }
332332

333333
impl<
334-
Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq,
335-
MaxFields: Get<u32>,
336-
Block: Codec + Clone + Ord + Eq + AtLeast32BitUnsigned + MaxEncodedLen + Debug,
337-
> Decode for Registration<Balance, MaxFields, Block>
334+
Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq,
335+
MaxFields: Get<u32>,
336+
Block: Codec + Clone + Ord + Eq + AtLeast32BitUnsigned + MaxEncodedLen + Debug,
337+
> Decode for Registration<Balance, MaxFields, Block>
338338
{
339339
fn decode<I: codec::Input>(input: &mut I) -> sp_std::result::Result<Self, codec::Error> {
340340
let (deposit, block, info) = Decode::decode(&mut AppendZerosInput::new(input))?;

pallets/drand/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description = "FRAME pallet for briding to drand."
44
authors = ["Tony Riemer <[email protected]>"]
55
version = "0.0.1"
66
license = "MIT-0"
7-
edition = "2021"
7+
edition = "2024"
88
homepage = "https://www.idealabs.network"
99
publish = false
1010

pallets/drand/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ use scale_info::prelude::cmp;
5252
use sha2::{Digest, Sha256};
5353
use sp_core::blake2_256;
5454
use sp_runtime::{
55+
KeyTypeId, Saturating,
5556
traits::{Hash, One},
5657
transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction},
57-
KeyTypeId, Saturating,
5858
};
5959

6060
pub mod bls12_381;
@@ -110,9 +110,9 @@ pub mod crypto {
110110
use super::KEY_TYPE;
111111
use sp_core::sr25519::Signature as Sr25519Signature;
112112
use sp_runtime::{
113+
MultiSignature, MultiSigner,
113114
app_crypto::{app_crypto, sr25519},
114115
traits::Verify,
115-
MultiSignature, MultiSigner,
116116
};
117117
app_crypto!(sr25519, KEY_TYPE);
118118

@@ -277,8 +277,8 @@ pub mod pallet {
277277
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
278278
match call {
279279
Call::set_beacon_config {
280-
config_payload: ref payload,
281-
ref signature,
280+
config_payload: payload,
281+
signature,
282282
} => {
283283
let signature = signature.as_ref().ok_or(InvalidTransaction::BadSigner)?;
284284
Self::validate_signature_and_parameters(
@@ -289,8 +289,8 @@ pub mod pallet {
289289
)
290290
}
291291
Call::write_pulse {
292-
pulses_payload: ref payload,
293-
ref signature,
292+
pulses_payload: payload,
293+
signature,
294294
} => {
295295
let signature = signature.as_ref().ok_or(InvalidTransaction::BadSigner)?;
296296
Self::validate_signature_and_parameters(

pallets/registry/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "4.0.0-dev"
44
description = "Simplified identity system for network participants."
55
authors = ["Bittensor Nucleus Team"]
66
homepage = "https://bittensor.com"
7-
edition = "2021"
7+
edition = "2024"
88
license = "Unlicense"
99
publish = false
1010
repository = "https://github.com/opentensor/subtensor"

pallets/registry/src/types.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@
1616
// limitations under the License.
1717

1818
use codec::{Decode, Encode, MaxEncodedLen};
19-
use enumflags2::{bitflags, BitFlags};
19+
use enumflags2::{BitFlags, bitflags};
2020
use frame_support::{
21-
traits::{ConstU32, Get},
2221
BoundedVec, CloneNoBound, PartialEqNoBound, RuntimeDebugNoBound,
22+
traits::{ConstU32, Get},
2323
};
2424
use scale_info::{
25+
Path, Type, TypeInfo, TypeParameter,
2526
build::{Fields, Variants},
26-
meta_type, Path, Type, TypeInfo, TypeParameter,
27+
meta_type,
2728
};
2829
use sp_runtime::{
29-
traits::{AppendZerosInput, Zero},
3030
RuntimeDebug,
31+
traits::{AppendZerosInput, Zero},
3132
};
3233
use sp_std::{fmt::Debug, iter::once, ops::Add, prelude::*};
3334
use subtensor_macros::freeze_struct;
@@ -87,16 +88,16 @@ impl Encode for Data {
8788
fn encode(&self) -> Vec<u8> {
8889
match self {
8990
Data::None => vec![0u8; 1],
90-
Data::Raw(ref x) => {
91+
Data::Raw(x) => {
9192
let l = x.len().min(64) as u8;
9293
let mut r = vec![l.saturating_add(1)];
9394
r.extend_from_slice(&x[..]);
9495
r
9596
}
96-
Data::BlakeTwo256(ref h) => once(66u8).chain(h.iter().cloned()).collect(),
97-
Data::Sha256(ref h) => once(67u8).chain(h.iter().cloned()).collect(),
98-
Data::Keccak256(ref h) => once(68u8).chain(h.iter().cloned()).collect(),
99-
Data::ShaThree256(ref h) => once(69u8).chain(h.iter().cloned()).collect(),
97+
Data::BlakeTwo256(h) => once(66u8).chain(h.iter().cloned()).collect(),
98+
Data::Sha256(h) => once(67u8).chain(h.iter().cloned()).collect(),
99+
Data::Keccak256(h) => once(68u8).chain(h.iter().cloned()).collect(),
100+
Data::ShaThree256(h) => once(69u8).chain(h.iter().cloned()).collect(),
100101
}
101102
}
102103
}
@@ -385,19 +386,19 @@ pub struct Registration<
385386
}
386387

387388
impl<
388-
Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq + Zero + Add,
389-
MaxAdditionalFields: Get<u32>,
390-
> Registration<Balance, MaxAdditionalFields>
389+
Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq + Zero + Add,
390+
MaxAdditionalFields: Get<u32>,
391+
> Registration<Balance, MaxAdditionalFields>
391392
{
392393
pub(crate) fn total_deposit(&self) -> Balance {
393394
self.deposit
394395
}
395396
}
396397

397398
impl<
398-
Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq,
399-
MaxAdditionalFields: Get<u32>,
400-
> Decode for Registration<Balance, MaxAdditionalFields>
399+
Balance: Encode + Decode + MaxEncodedLen + Copy + Clone + Debug + Eq + PartialEq,
400+
MaxAdditionalFields: Get<u32>,
401+
> Decode for Registration<Balance, MaxAdditionalFields>
401402
{
402403
fn decode<I: codec::Input>(input: &mut I) -> sp_std::result::Result<Self, codec::Error> {
403404
let (deposit, info) = Decode::decode(&mut AppendZerosInput::new(input))?;

0 commit comments

Comments
 (0)