Skip to content

Commit e8b8554

Browse files
committed
Update Rust to latest nightly version and apply new clippy suggestions
1 parent ee652de commit e8b8554

File tree

15 files changed

+53
-62
lines changed

15 files changed

+53
-62
lines changed

Dockerfile-bootstrap-node

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22

3-
ARG RUSTC_VERSION=nightly-2023-01-15
3+
ARG RUSTC_VERSION=nightly-2023-04-02
44
ARG PROFILE=production
55
ARG RUSTFLAGS
66
# Workaround for https://github.com/rust-lang/cargo/issues/10583

Dockerfile-bootstrap-node.aarch64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22

3-
ARG RUSTC_VERSION=nightly-2023-01-15
3+
ARG RUSTC_VERSION=nightly-2023-04-02
44
ARG PROFILE=production
55
ARG RUSTFLAGS
66
# Workaround for https://github.com/rust-lang/cargo/issues/10583

Dockerfile-farmer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22

3-
ARG RUSTC_VERSION=nightly-2023-01-15
3+
ARG RUSTC_VERSION=nightly-2023-04-02
44
ARG PROFILE=production
55
ARG RUSTFLAGS
66
# Workaround for https://github.com/rust-lang/cargo/issues/10583

Dockerfile-farmer.aarch64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22

3-
ARG RUSTC_VERSION=nightly-2023-01-15
3+
ARG RUSTC_VERSION=nightly-2023-04-02
44
ARG PROFILE=production
55
ARG RUSTFLAGS
66
# Workaround for https://github.com/rust-lang/cargo/issues/10583

Dockerfile-node

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22

3-
ARG RUSTC_VERSION=nightly-2023-01-15
3+
ARG RUSTC_VERSION=nightly-2023-04-02
44
ARG PROFILE=production
55
ARG RUSTFLAGS
66
# Workaround for https://github.com/rust-lang/cargo/issues/10583

Dockerfile-node.aarch64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22

3-
ARG RUSTC_VERSION=nightly-2023-01-15
3+
ARG RUSTC_VERSION=nightly-2023-04-02
44
ARG PROFILE=production
55
ARG RUSTFLAGS
66
# Workaround for https://github.com/rust-lang/cargo/issues/10583

Dockerfile-runtime

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM ubuntu:20.04
22

3-
ARG RUSTC_VERSION=nightly-2023-01-15
3+
ARG RUSTC_VERSION=nightly-2023-04-02
44
ARG PROFILE=production
55
ARG RUSTFLAGS
66
# Workaround for https://github.com/rust-lang/cargo/issues/10583

crates/subspace-service/src/dsn.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use sc_client_api::AuxStore;
1111
use sc_consensus_subspace::ArchivedSegmentNotification;
1212
use sc_consensus_subspace_rpc::SegmentHeaderProvider;
1313
use sp_core::traits::SpawnNamed;
14-
use sp_runtime::traits::Block as BlockT;
1514
use std::num::NonZeroUsize;
1615
use std::path::PathBuf;
1716
use std::sync::Arc;
@@ -88,13 +87,12 @@ pub struct DsnConfig {
8887
type DsnProviderStorage<AS> =
8988
NodeProviderStorage<PieceCache<AS>, Either<ParityDbProviderStorage, MemoryProviderStorage>>;
9089

91-
pub(crate) fn create_dsn_instance<Block, AS>(
90+
pub(crate) fn create_dsn_instance<AS>(
9291
dsn_config: DsnConfig,
9392
piece_cache: PieceCache<AS>,
9493
segment_header_cache: SegmentHeaderCache<AS>,
9594
) -> Result<(Node, NodeRunner<DsnProviderStorage<AS>>), DsnConfigurationError>
9695
where
97-
Block: BlockT,
9896
AS: AuxStore + Sync + Send + 'static,
9997
{
10098
trace!("Subspace networking starting.");

crates/subspace-service/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,8 @@ where
542542
}
543543
});
544544

545-
let (node, mut node_runner) = create_dsn_instance::<Block, _>(
546-
config.clone(),
547-
piece_cache,
548-
segment_header_cache.clone(),
549-
)?;
545+
let (node, mut node_runner) =
546+
create_dsn_instance(config.clone(), piece_cache, segment_header_cache.clone())?;
550547

551548
info!("Subspace networking initialized: Node ID is {}", node.id());
552549

domains/client/domain-executor/src/domain_worker.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,9 @@ pub(crate) async fn handle_block_import_notifications<
117117
Box::pin(async move {
118118
while let Some(maybe_block_info) = block_info_receiver.next().await {
119119
if let Some(block_info) = maybe_block_info {
120-
if let Err(error) = block_imported::<Block, PBlock, _>(
121-
&processor,
122-
&mut active_leaves,
123-
block_info,
124-
)
125-
.await
120+
if let Err(error) =
121+
block_imported::<PBlock, _>(&processor, &mut active_leaves, block_info)
122+
.await
126123
{
127124
tracing::error!(?error, "Failed to process primary block");
128125
// Bring down the service as bundles processor is an essential task.
@@ -225,13 +222,12 @@ where
225222
Ok(())
226223
}
227224

228-
async fn block_imported<Block, PBlock, ProcessorFn>(
225+
async fn block_imported<PBlock, ProcessorFn>(
229226
processor: &ProcessorFn,
230227
active_leaves: &mut HashMap<PBlock::Hash, NumberFor<PBlock>>,
231228
block_info: BlockInfo<PBlock>,
232229
) -> Result<(), ApiError>
233230
where
234-
Block: BlockT,
235231
PBlock: BlockT,
236232
ProcessorFn: Fn(
237233
(PBlock::Hash, NumberFor<PBlock>),

domains/pallets/messenger/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ mod pallet {
341341

342342
type Tag = (DomainId, ChannelId, Nonce);
343343

344-
fn unsigned_validity<T: Config>(prefix: &'static str, provides: Tag) -> TransactionValidity {
344+
fn unsigned_validity(prefix: &'static str, provides: Tag) -> TransactionValidity {
345345
ValidTransaction::with_tag_prefix(prefix)
346346
.priority(TransactionPriority::MAX)
347347
.and_provides(provides)
@@ -381,12 +381,12 @@ mod pallet {
381381
should_init_channel: _,
382382
} = Self::do_validate_relay_message(xdm)?;
383383
let provides_tag = (msg.dst_domain_id, msg.channel_id, msg.nonce);
384-
unsigned_validity::<T>("MessengerInbox", provides_tag)
384+
unsigned_validity("MessengerInbox", provides_tag)
385385
}
386386
Call::relay_message_response { msg: xdm } => {
387387
let msg = Self::do_validate_relay_message_response(xdm)?;
388388
let provides_tag = (msg.dst_domain_id, msg.channel_id, msg.nonce);
389-
unsigned_validity::<T>("MessengerOutboxResponse", provides_tag)
389+
unsigned_validity("MessengerOutboxResponse", provides_tag)
390390
}
391391
_ => InvalidTransaction::Call.into(),
392392
}

domains/pallets/messenger/src/tests.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -707,10 +707,10 @@ fn initiate_transfer_on_domain(domain_a_ext: &mut TestExternalities) {
707707
+ fee_model.outbox_fee.compute_fee
708708
+ fee_model.outbox_fee.relayer_pool_fee;
709709

710-
assert_eq!(domain_a::Balances::free_balance(&account_id), 500 - fees);
710+
assert_eq!(domain_a::Balances::free_balance(account_id), 500 - fees);
711711
// source domain take 2 fees and dst_domain takes 2
712712
assert_eq!(
713-
domain_a::Balances::free_balance(&domain_a::Messenger::messenger_account_id()),
713+
domain_a::Balances::free_balance(domain_a::Messenger::messenger_account_id()),
714714
fee_model.outbox_fee.compute_fee + fee_model.outbox_fee.relayer_pool_fee
715715
);
716716
assert!(domain_a::Transporter::outgoing_transfers(
@@ -745,9 +745,9 @@ fn verify_transfer_on_domain(
745745
nonce: U256::one(),
746746
},
747747
));
748-
assert_eq!(domain_a::Balances::free_balance(&account_id), 496);
748+
assert_eq!(domain_a::Balances::free_balance(account_id), 496);
749749
assert_eq!(
750-
domain_a::Balances::free_balance(&domain_a::Messenger::messenger_account_id()),
750+
domain_a::Balances::free_balance(domain_a::Messenger::messenger_account_id()),
751751
1
752752
);
753753
let relayer_a_balance = domain_a::Balances::free_balance(domain_a::RELAYER_ID);
@@ -777,9 +777,9 @@ fn verify_transfer_on_domain(
777777
relayer_id: domain_b::RELAYER_ID,
778778
},
779779
));
780-
assert_eq!(domain_b::Balances::free_balance(&account_id), 1500);
780+
assert_eq!(domain_b::Balances::free_balance(account_id), 1500);
781781
assert_eq!(
782-
domain_b::Balances::free_balance(&domain_b::Messenger::messenger_account_id()),
782+
domain_b::Balances::free_balance(domain_b::Messenger::messenger_account_id()),
783783
1
784784
);
785785
let relayer_b_balance = domain_b::Balances::free_balance(domain_b::RELAYER_ID);
@@ -909,7 +909,7 @@ fn test_join_relayer_set() {
909909
let relayer_id = 100;
910910

911911
domain_a_test_ext.execute_with(|| {
912-
assert_eq!(domain_a::Balances::free_balance(&account_id), 1000);
912+
assert_eq!(domain_a::Balances::free_balance(account_id), 1000);
913913
let res = domain_a::Messenger::join_relayer_set(
914914
domain_a::RuntimeOrigin::signed(account_id),
915915
relayer_id,
@@ -922,7 +922,7 @@ fn test_join_relayer_set() {
922922
deposit_reserved: RelayerDeposit::get(),
923923
}
924924
);
925-
assert_eq!(domain_a::Balances::free_balance(&account_id), 500);
925+
assert_eq!(domain_a::Balances::free_balance(account_id), 500);
926926

927927
// cannot rejoin again
928928
let res = domain_a::Messenger::join_relayer_set(
@@ -959,7 +959,7 @@ fn test_exit_relayer_set() {
959959

960960
domain_a_test_ext.execute_with(|| {
961961
domain_a::Balances::make_free_balance_be(&account_id, 2000);
962-
assert_eq!(domain_a::Balances::free_balance(&account_id), 2000);
962+
assert_eq!(domain_a::Balances::free_balance(account_id), 2000);
963963
for relayer in [relayer_id_1, relayer_id_2, relayer_id_3] {
964964
let res = domain_a::Messenger::join_relayer_set(
965965
domain_a::RuntimeOrigin::signed(account_id),
@@ -974,7 +974,7 @@ fn test_exit_relayer_set() {
974974
}
975975
);
976976
}
977-
assert_eq!(domain_a::Balances::free_balance(&account_id), 500);
977+
assert_eq!(domain_a::Balances::free_balance(account_id), 500);
978978

979979
let assigned_relayer_id = domain_a::Messenger::next_relayer().unwrap();
980980
assert_eq!(assigned_relayer_id, RELAYER_ID);

domains/pallets/transporter/src/tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::marker::PhantomData;
1616
fn test_initiate_transfer_failed() {
1717
new_test_ext().execute_with(|| {
1818
let account = 100;
19-
let balance = Balances::free_balance(&account);
19+
let balance = Balances::free_balance(account);
2020
assert_eq!(balance, 0);
2121

2222
// transfer 500 to dst_domain id 100
@@ -34,7 +34,7 @@ fn test_initiate_transfer_failed() {
3434
fn test_initiate_transfer() {
3535
new_test_ext().execute_with(|| {
3636
let account = USER_ACCOUNT;
37-
let balance = Balances::free_balance(&account);
37+
let balance = Balances::free_balance(account);
3838
assert_eq!(balance, 1000);
3939
let total_balance = Balances::total_issuance();
4040
assert_eq!(total_balance, 1000);
@@ -47,7 +47,7 @@ fn test_initiate_transfer() {
4747
};
4848
let res = Transporter::transfer(RuntimeOrigin::signed(account), dst_location, 500);
4949
assert_ok!(res);
50-
let balance = Balances::free_balance(&account);
50+
let balance = Balances::free_balance(account);
5151
assert_eq!(balance, 500);
5252
let total_balance = Balances::total_issuance();
5353
assert_eq!(total_balance, 500);
@@ -179,7 +179,7 @@ fn test_transfer_response_revert() {
179179
let dst_domain_id: DomainId = 1.into();
180180

181181
// check pre dispatch balances
182-
let balance = Balances::free_balance(&account);
182+
let balance = Balances::free_balance(account);
183183
assert_eq!(balance, 1000);
184184
let total_balance = Balances::total_issuance();
185185
assert_eq!(total_balance, 1000);
@@ -188,7 +188,7 @@ fn test_transfer_response_revert() {
188188
initiate_transfer(dst_domain_id, account, amount);
189189

190190
// check post init
191-
let balance = Balances::free_balance(&account);
191+
let balance = Balances::free_balance(account);
192192
assert_eq!(balance, 500);
193193
let total_balance = Balances::total_issuance();
194194
assert_eq!(total_balance, 500);
@@ -214,7 +214,7 @@ fn test_transfer_response_revert() {
214214
assert_ok!(res);
215215

216216
// balance changes should be reverted.
217-
let balance = Balances::free_balance(&account);
217+
let balance = Balances::free_balance(account);
218218
assert_eq!(balance, 1000);
219219
let total_balance = Balances::total_issuance();
220220
assert_eq!(total_balance, 1000);
@@ -237,7 +237,7 @@ fn test_transfer_response_successful() {
237237
let dst_domain_id: DomainId = 1.into();
238238

239239
// check pre dispatch balances
240-
let balance = Balances::free_balance(&account);
240+
let balance = Balances::free_balance(account);
241241
assert_eq!(balance, 1000);
242242
let total_balance = Balances::total_issuance();
243243
assert_eq!(total_balance, 1000);
@@ -246,7 +246,7 @@ fn test_transfer_response_successful() {
246246
initiate_transfer(dst_domain_id, account, amount);
247247

248248
// check post init
249-
let balance = Balances::free_balance(&account);
249+
let balance = Balances::free_balance(account);
250250
assert_eq!(balance, 500);
251251
let total_balance = Balances::total_issuance();
252252
assert_eq!(total_balance, 500);
@@ -268,7 +268,7 @@ fn test_transfer_response_successful() {
268268
assert_ok!(res);
269269

270270
// balance changes should be as is.
271-
let balance = Balances::free_balance(&account);
271+
let balance = Balances::free_balance(account);
272272
assert_eq!(balance, 500);
273273
let total_balance = Balances::total_issuance();
274274
assert_eq!(total_balance, 500);
@@ -291,7 +291,7 @@ fn test_receive_incoming_transfer() {
291291
let dst_domain_id: DomainId = 1.into();
292292

293293
// check pre dispatch balances
294-
let balance = Balances::free_balance(&receiver);
294+
let balance = Balances::free_balance(receiver);
295295
assert_eq!(balance, 0);
296296
let total_balance = Balances::total_issuance();
297297
assert_eq!(total_balance, 1000);
@@ -312,7 +312,7 @@ fn test_receive_incoming_transfer() {
312312
.encode(),
313313
);
314314
assert_ok!(resp);
315-
let balance = Balances::free_balance(&receiver);
315+
let balance = Balances::free_balance(receiver);
316316
assert_eq!(balance, 500);
317317
let total_balance = Balances::total_issuance();
318318
assert_eq!(total_balance, 1500);

0 commit comments

Comments
 (0)