Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d3af49f
Remove Default for AccountId
gavofyork Dec 2, 2021
f6827f1
More removals of default
gavofyork Dec 2, 2021
d397c5d
Update frame/authorship/src/lib.rs
gavofyork Dec 2, 2021
c446fff
Update frame/authorship/src/lib.rs
gavofyork Dec 2, 2021
19023db
Update frame/authorship/src/lib.rs
gavofyork Dec 2, 2021
80df1fb
Update frame/authorship/src/lib.rs
gavofyork Dec 2, 2021
2cbe13a
More work
gavofyork Dec 2, 2021
0930529
More work
gavofyork Dec 2, 2021
016a1ee
Remove old code
gavofyork Dec 2, 2021
594deb9
More work
gavofyork Dec 2, 2021
daa2942
pallet-asset-tx-payment
gavofyork Dec 2, 2021
0f270da
tips
gavofyork Dec 2, 2021
393ed87
sc-consensus-babe
gavofyork Dec 2, 2021
7169d84
sc-finality-grandpa
gavofyork Dec 2, 2021
a853bcc
sc-consensus-babe-rpc
gavofyork Dec 2, 2021
4cb42ff
sc-cli
gavofyork Dec 2, 2021
2a04445
make npos crates accept non-default account (#10420)
kianenigma Dec 4, 2021
452651c
more work
gavofyork Dec 4, 2021
227f360
more work
gavofyork Dec 4, 2021
345c87b
Tests build
gavofyork Dec 6, 2021
c12d8cf
Fix imonline tests
gavofyork Dec 7, 2021
2cfd1d0
Formatting
gavofyork Dec 7, 2021
b537356
Merge branch 'master' into gav-no-default-accountid
gavofyork Dec 7, 2021
f5758f1
Fixes
gavofyork Dec 7, 2021
9965af3
Merge branch 'gav-no-default-accountid' of github.com:paritytech/subs…
gavofyork Dec 7, 2021
3dc3969
Fixes
gavofyork Dec 7, 2021
b7fe115
Merge remote-tracking branch 'origin/master' into gav-no-default-acco…
gavofyork Dec 9, 2021
c9c7ba7
Fix bench
kianenigma Dec 9, 2021
ea520fa
Fixes
gavofyork Dec 9, 2021
b694599
Fixes
gavofyork Dec 9, 2021
97ec65a
Fixes
gavofyork Dec 10, 2021
b9c1e17
Fixes
gavofyork Dec 10, 2021
ddfbfa9
Fixes
gavofyork Dec 10, 2021
2316103
Formatting
gavofyork Dec 10, 2021
d302551
Fixes
gavofyork Dec 10, 2021
915bf1c
Formatting
gavofyork Dec 10, 2021
cfb1418
Fixes
gavofyork Dec 10, 2021
ed72cad
Formatting
gavofyork Dec 10, 2021
6e1b9e7
Fixes
gavofyork Dec 10, 2021
5fab98c
Formatting
gavofyork Dec 10, 2021
8eccc1d
Merge remote-tracking branch 'origin/master' into gav-no-default-acco…
gavofyork Dec 11, 2021
67492d1
Fixes
gavofyork Dec 11, 2021
b465b2d
Formatting
gavofyork Dec 11, 2021
26053ee
Merge branch 'master' into gav-no-default-accountid
gavofyork Dec 11, 2021
87351bb
Update client/keystore/src/local.rs
gavofyork Dec 12, 2021
f7939bb
Update client/finality-grandpa/src/lib.rs
gavofyork Dec 12, 2021
5e157c9
Update client/keystore/src/local.rs
gavofyork Dec 12, 2021
3557e13
Update client/keystore/src/local.rs
gavofyork Dec 12, 2021
c147de9
Update frame/staking/src/lib.rs
gavofyork Dec 12, 2021
fa596c1
Update frame/staking/src/lib.rs
gavofyork Dec 12, 2021
aa7ac28
Update primitives/runtime/src/traits.rs
gavofyork Dec 12, 2021
175596a
Formatting
gavofyork Dec 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Formatting
  • Loading branch information
gavofyork committed Dec 7, 2021
commit 2cfd1d0bdb93e5b2d0545ea3b649275055e43d7a
3 changes: 2 additions & 1 deletion bin/node/executor/tests/submit_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ fn should_submit_unsigned_transaction() {
t.register_extension(TransactionPoolExt::new(pool));

t.execute_with(|| {
let signature = pallet_im_online::sr25519::AuthoritySignature::try_from(vec![0; 64]).unwrap();
let signature =
pallet_im_online::sr25519::AuthoritySignature::try_from(vec![0; 64]).unwrap();
let heartbeat_data = pallet_im_online::Heartbeat {
block_number: 1,
network_state: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion client/cli/src/commands/insert_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn to_vec<P: sp_core::Pair>(uri: &str, pass: Option<SecretString>) -> Result<Vec
mod tests {
use super::*;
use sc_service::{ChainSpec, ChainType, GenericChainSpec, NoExtension};
use sp_core::{sr25519::Pair, Pair as _, ByteArray};
use sp_core::{sr25519::Pair, ByteArray, Pair as _};
use structopt::StructOpt;
use tempfile::TempDir;

Expand Down
11 changes: 6 additions & 5 deletions client/cli/src/commands/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//! implementation of the `verify` subcommand

use crate::{error, utils, with_crypto_scheme, CryptoSchemeFlag};
use sp_core::crypto::{Ss58Codec, ByteArray};
use sp_core::crypto::{ByteArray, Ss58Codec};
use structopt::StructOpt;

/// The `verify` command
Expand Down Expand Up @@ -63,12 +63,13 @@ impl VerifyCmd {
}
}

fn verify<Pair>(sig_data: Vec<u8>, message: Vec<u8>, uri: &str) -> error::Result<()> where
fn verify<Pair>(sig_data: Vec<u8>, message: Vec<u8>, uri: &str) -> error::Result<()>
where
Pair: sp_core::Pair,
Pair::Signature: for <'a> std::convert::TryFrom<&'a [u8]>,
Pair::Signature: for<'a> std::convert::TryFrom<&'a [u8]>,
{
let signature = Pair::Signature::try_from(&sig_data)
.map_err(|_| error::Error::SignatureFormatInvalid)?;
let signature =
Pair::Signature::try_from(&sig_data).map_err(|_| error::Error::SignatureFormatInvalid)?;

let pubkey = if let Ok(pubkey_vec) = hex::decode(uri) {
Pair::Public::from_slice(pubkey_vec.as_slice())
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use sp_consensus::{
BlockOrigin, CanAuthorWith, Environment, Error as ConsensusError, Proposer, SelectChain,
};
use sp_consensus_slots::Slot;
use sp_core::crypto::{Pair, Public, ByteArray};
use sp_core::crypto::{ByteArray, Pair, Public};
use sp_inherents::CreateInherentDataProviders;
use sp_keystore::{SyncCryptoStore, SyncCryptoStorePtr};
use sp_runtime::{
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/babe/src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use sp_consensus_babe::{
make_transcript, AuthorityId, AuthorityPair, AuthoritySignature,
};
use sp_consensus_slots::Slot;
use sp_core::{Pair, ByteArray};
use sp_core::{ByteArray, Pair};
use sp_runtime::{traits::Header, DigestItem};

/// BABE verification parameters
Expand Down
9 changes: 6 additions & 3 deletions client/finality-grandpa/src/authorities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,8 +1493,10 @@ mod tests {
None,
);

let invalid_authorities_weight =
vec![(AuthorityId::from_slice(&[1; 32]).unwrap(), 5), (AuthorityId::from_slice(&[2; 32]).unwrap(), 0)];
let invalid_authorities_weight = vec![
(AuthorityId::from_slice(&[1; 32]).unwrap(), 5),
(AuthorityId::from_slice(&[2; 32]).unwrap(), 0),
];

// authority weight of zero is invalid
assert_eq!(AuthoritySet::<(), ()>::genesis(invalid_authorities_weight.clone()), None);
Expand All @@ -1510,7 +1512,8 @@ mod tests {
);

let mut authority_set =
AuthoritySet::<(), u64>::genesis(vec![(AuthorityId::unchecked_from([1; 32]), 5)]).unwrap();
AuthoritySet::<(), u64>::genesis(vec![(AuthorityId::unchecked_from([1; 32]), 5)])
.unwrap();

let invalid_change_empty_authorities = PendingChange {
next_authorities: vec![],
Expand Down
2 changes: 1 addition & 1 deletion client/finality-grandpa/src/aux_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ pub(crate) fn load_authorities<B: AuxStore, H: Decode, N: Decode + Clone + Ord>(
#[cfg(test)]
mod test {
use super::*;
use sp_core::{H256, crypto::UncheckedFrom};
use sp_core::{crypto::UncheckedFrom, H256};
use sp_finality_grandpa::AuthorityId;
use substrate_test_runtime_client;

Expand Down
3 changes: 2 additions & 1 deletion client/finality-grandpa/src/communication/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,8 @@ mod tests {

assert_eq!(val.inner().read().authorities, a1);

let a2 = vec![UncheckedFrom::unchecked_from([1; 32]), UncheckedFrom::unchecked_from([2; 32])];
let a2 =
vec![UncheckedFrom::unchecked_from([1; 32]), UncheckedFrom::unchecked_from([2; 32])];
val.note_set(SetId(1), a2.clone(), |_, _| {});

assert_eq!(val.inner().read().authorities, a2);
Expand Down
6 changes: 4 additions & 2 deletions client/finality-grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ where
let events = telemetry_on_connect.for_each(move |_| {
let current_authorities = authorities.current_authorities();
let set_id = authorities.set_id();
let maybe_authority_id = local_authority_id(&current_authorities, conf.keystore.as_ref());
let maybe_authority_id =
local_authority_id(&current_authorities, conf.keystore.as_ref());

let authorities =
current_authorities.iter().map(|(id, _)| id.to_string()).collect::<Vec<_>>();
Expand Down Expand Up @@ -916,7 +917,8 @@ where
fn rebuild_voter(&mut self) {
debug!(target: "afg", "{}: Starting new voter with set ID {}", self.env.config.name(), self.env.set_id);

let maybe_authority_id = local_authority_id(&self.env.voters, self.env.config.keystore.as_ref());
let maybe_authority_id =
local_authority_id(&self.env.voters, self.env.config.keystore.as_ref());
let authority_id = maybe_authority_id.map_or("".into(), |s| s.to_string());

telemetry!(
Expand Down
2 changes: 1 addition & 1 deletion client/finality-grandpa/src/until_imported.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ mod tests {
use futures_timer::Delay;
use sc_client_api::BlockImportNotification;
use sc_utils::mpsc::{tracing_unbounded, TracingUnboundedSender};
use sp_core::crypto::UncheckedFrom;
use sp_consensus::BlockOrigin;
use sp_core::crypto::UncheckedFrom;
use substrate_test_runtime_client::runtime::{Block, Hash, Header};

#[derive(Clone)]
Expand Down
27 changes: 21 additions & 6 deletions client/keystore/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ use async_trait::async_trait;
use parking_lot::RwLock;
use sp_application_crypto::{ecdsa, ed25519, sr25519, AppKey, AppPair, IsWrappedBy};
use sp_core::{
crypto::{CryptoTypePublicPair, ExposeSecret, KeyTypeId, Pair as PairT, ByteArray, SecretString},
crypto::{
ByteArray, CryptoTypePublicPair, ExposeSecret, KeyTypeId, Pair as PairT, SecretString,
},
sr25519::{Pair as Sr25519Pair, Public as Sr25519Public},
Encode,
};
Expand Down Expand Up @@ -226,7 +228,11 @@ impl SyncCryptoStore for LocalKeystore {
self.0
.read()
.raw_public_keys(key_type)
.map(|v| v.into_iter().filter_map(|k| sr25519::Public::from_slice(k.as_slice()).ok()).collect())
.map(|v| {
v.into_iter()
.filter_map(|k| sr25519::Public::from_slice(k.as_slice()).ok())
.collect()
})
.unwrap_or_default()
}

Expand All @@ -249,7 +255,11 @@ impl SyncCryptoStore for LocalKeystore {
self.0
.read()
.raw_public_keys(key_type)
.map(|v| v.into_iter().filter_map(|k| ed25519::Public::from_slice(k.as_slice()).ok()).collect())
.map(|v| {
v.into_iter()
.filter_map(|k| ed25519::Public::from_slice(k.as_slice()).ok())
.collect()
})
.unwrap_or_default()
}

Expand All @@ -272,7 +282,11 @@ impl SyncCryptoStore for LocalKeystore {
self.0
.read()
.raw_public_keys(key_type)
.map(|v| v.into_iter().filter_map(|k| ecdsa::Public::from_slice(k.as_slice()).ok()).collect())
.map(|v| {
v.into_iter()
.filter_map(|k| ecdsa::Public::from_slice(k.as_slice()).ok())
.collect()
})
.unwrap_or_default()
}

Expand Down Expand Up @@ -564,8 +578,9 @@ mod tests {
}

fn public_keys<Public: AppPublic>(&self) -> Result<Vec<Public>> {
self.raw_public_keys(Public::ID)
.map(|v| v.into_iter().filter_map(|k| Public::from_slice(k.as_slice()).ok()).collect())
self.raw_public_keys(Public::ID).map(|v| {
v.into_iter().filter_map(|k| Public::from_slice(k.as_slice()).ok()).collect()
})
}

fn generate<Pair: AppPair>(&mut self) -> Result<Pair> {
Expand Down
10 changes: 7 additions & 3 deletions client/rpc/src/author/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use futures::executor;
use sc_transaction_pool::{BasicPool, FullChainApi};
use sp_core::{
blake2_256,
crypto::{CryptoTypePublicPair, Pair, ByteArray},
crypto::{ByteArray, CryptoTypePublicPair, Pair},
ed25519,
hexdisplay::HexDisplay,
sr25519,
Expand All @@ -40,8 +40,12 @@ use substrate_test_runtime_client::{
};

fn uxt(sender: AccountKeyring, nonce: u64) -> Extrinsic {
let tx =
Transfer { amount: Default::default(), nonce, from: sender.into(), to: AccountKeyring::Bob.into() };
let tx = Transfer {
amount: Default::default(),
nonce,
from: sender.into(),
to: AccountKeyring::Bob.into(),
};
tx.into_signed_tx()
}

Expand Down
6 changes: 1 addition & 5 deletions client/transaction-pool/src/graph/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,7 @@ mod tests {

fn uxt(transfer: Transfer) -> Extrinsic {
let signature = TryFrom::try_from(&[0; 64][..]).unwrap();
Extrinsic::Transfer {
transfer,
signature,
exhaust_resources_when_not_first: false,
}
Extrinsic::Transfer { transfer, signature, exhaust_resources_when_not_first: false }
}

fn pool() -> Pool<TestApi> {
Expand Down
5 changes: 4 additions & 1 deletion frame/authorship/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ impl<T: Config> Pallet<T> {

let digest = <frame_system::Pallet<T>>::digest();
let pre_runtime_digests = digest.logs.iter().filter_map(|d| d.as_pre_runtime());
T::FindAuthor::find_author(pre_runtime_digests).map(|a| { <Author<T>>::put(&a); a })
T::FindAuthor::find_author(pre_runtime_digests).map(|a| {
<Author<T>>::put(&a);
a
})
}

fn verify_and_import_uncles(new_uncles: Vec<T::Header>) -> dispatch::DispatchResult {
Expand Down
6 changes: 1 addition & 5 deletions frame/benchmarking/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,7 @@ pub trait BenchmarkingSetup<T, I = ()> {
}

/// Grab an account, seeded by a name and index.
pub fn account<AccountId: Decode>(
name: &'static str,
index: u32,
seed: u32,
) -> AccountId {
pub fn account<AccountId: Decode>(name: &'static str, index: u32, seed: u32) -> AccountId {
let entropy = (name, index, seed).using_encoded(blake2_256);
Decode::decode(&mut TrailingZeroInput::new(entropy.as_ref()))
.expect("infinite length input; no invalid inputs for type; qed")
Expand Down
6 changes: 1 addition & 5 deletions frame/elections-phragmen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ pub struct Voter<AccountId, Balance> {

impl<AccountId, Balance: Default> Default for Voter<AccountId, Balance> {
fn default() -> Self {
Self {
votes: vec![],
stake: Default::default(),
deposit: Default::default(),
}
Self { votes: vec![], stake: Default::default(), deposit: Default::default() }
}
}

Expand Down
8 changes: 3 additions & 5 deletions frame/examples/parallel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,9 @@ impl EnlistedParticipant {
use sp_runtime::traits::Verify;

match sp_core::sr25519::Signature::try_from(&self.signature[..]) {
Ok(signature) => {
match sp_core::sr25519::Public::from_slice(self.account.as_ref()) {
Err(()) => false,
Ok(signer) => signature.verify(event_id, &signer),
}
Ok(signature) => match sp_core::sr25519::Public::from_slice(self.account.as_ref()) {
Err(()) => false,
Ok(signer) => signature.verify(event_id, &signer),
},
_ => false,
}
Expand Down
9 changes: 3 additions & 6 deletions frame/examples/parallel/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ fn it_can_enlist() {

let event_name = b"test";

Example::run_event(test_origin(1), event_name.to_vec())
.expect("Failed to enlist");
Example::run_event(test_origin(1), event_name.to_vec()).expect("Failed to enlist");

let participants = vec![
EnlistedParticipant {
Expand Down Expand Up @@ -130,8 +129,7 @@ fn one_wrong_will_not_enlist_anyone() {

let event_name = b"test";

Example::run_event(test_origin(1), event_name.to_vec())
.expect("Failed to enlist");
Example::run_event(test_origin(1), event_name.to_vec()).expect("Failed to enlist");

let participants = vec![
EnlistedParticipant {
Expand All @@ -149,8 +147,7 @@ fn one_wrong_will_not_enlist_anyone() {
},
];

Example::enlist_participants(test_origin(1), participants)
.expect("Failed to enlist");
Example::enlist_participants(test_origin(1), participants).expect("Failed to enlist");

assert_eq!(Example::participants().len(), 0);
});
Expand Down
5 changes: 4 additions & 1 deletion frame/multisig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ use frame_support::{
use frame_system::{self as system, RawOrigin};
use scale_info::TypeInfo;
use sp_io::hashing::blake2_256;
use sp_runtime::{DispatchError, traits::{Dispatchable, TrailingZeroInput, Zero}};
use sp_runtime::{
traits::{Dispatchable, TrailingZeroInput, Zero},
DispatchError,
};
use sp_std::prelude::*;
pub use weights::WeightInfo;

Expand Down
5 changes: 4 additions & 1 deletion frame/proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ use frame_support::{
use frame_system::{self as system};
use scale_info::TypeInfo;
use sp_io::hashing::blake2_256;
use sp_runtime::{DispatchResult, traits::{Dispatchable, Hash, Saturating, TrailingZeroInput, Zero}};
use sp_runtime::{
traits::{Dispatchable, Hash, Saturating, TrailingZeroInput, Zero},
DispatchResult,
};
use sp_std::{convert::TryInto, prelude::*};
pub use weights::WeightInfo;

Expand Down
2 changes: 1 addition & 1 deletion frame/staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use frame_support::{
traits::{Currency, CurrencyToVote, Get, Imbalance},
};
use sp_runtime::{
traits::{Bounded, One, StaticLookup, Zero, TrailingZeroInput},
traits::{Bounded, One, StaticLookup, TrailingZeroInput, Zero},
Perbill, Percent,
};
use sp_staking::SessionIndex;
Expand Down
5 changes: 4 additions & 1 deletion frame/staking/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,10 @@ impl<T: Config> VoteWeightProvider<T::AccountId> for Pallet<T> {
let active: BalanceOf<T> = weight.try_into().map_err(|_| ()).unwrap();
let ledger = match Self::ledger(who) {
None => StakingLedger::default_from(who.clone()),
Some(mut l) => { l.active = active; l },
Some(mut l) => {
l.active = active;
l
},
};
<Ledger<T>>::insert(who, ledger);
<Bonded<T>>::insert(who, who);
Expand Down
8 changes: 6 additions & 2 deletions frame/tips/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ mod tests;
pub mod migrations;
pub mod weights;

use sp_runtime::{Percent, RuntimeDebug, traits::{AccountIdConversion, BadOrigin, Hash, TrailingZeroInput, Zero}};
use sp_runtime::{
traits::{AccountIdConversion, BadOrigin, Hash, TrailingZeroInput, Zero},
Percent, RuntimeDebug,
};
use sp_std::prelude::*;

use codec::{Decode, Encode};
Expand Down Expand Up @@ -577,7 +580,8 @@ impl<T: Config> Pallet<T> {

use frame_support::{migration::storage_key_iter, Twox64Concat};

let zero_account = T::AccountId::decode(&mut TrailingZeroInput::new(&[][..])).expect("infinite input; qed");
let zero_account = T::AccountId::decode(&mut TrailingZeroInput::new(&[][..]))
.expect("infinite input; qed");

for (hash, old_tip) in storage_key_iter::<
T::Hash,
Expand Down
3 changes: 2 additions & 1 deletion frame/transaction-payment/asset-tx-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ where
let actual_fee = pallet_transaction_payment::Pallet::<T>::compute_actual_fee(
len as u32, info, post_info, tip,
);
let who = who.ok_or(TransactionValidityError::Invalid(InvalidTransaction::Custom(255)))?;
let who =
who.ok_or(TransactionValidityError::Invalid(InvalidTransaction::Custom(255)))?;
T::OnChargeAssetTransaction::correct_and_deposit_fee(
&who,
info,
Expand Down
Loading