mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 00:01:09 +00:00
declone and close the door (#12035)
* declone and close the door * cargo fmt * remove brackets
This commit is contained in:
@@ -76,7 +76,7 @@ fn vote_works() {
|
||||
Box::new(proposal.clone()),
|
||||
proposal_len
|
||||
));
|
||||
assert_ok!(Alliance::vote(Origin::signed(2), hash.clone(), 0, true));
|
||||
assert_ok!(Alliance::vote(Origin::signed(2), hash, 0, true));
|
||||
|
||||
let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] };
|
||||
assert_eq!(
|
||||
@@ -85,12 +85,12 @@ fn vote_works() {
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0,
|
||||
@@ -114,7 +114,7 @@ fn veto_works() {
|
||||
));
|
||||
// only set_rule/elevate_ally can be veto
|
||||
assert_noop!(
|
||||
Alliance::veto(Origin::signed(1), hash.clone()),
|
||||
Alliance::veto(Origin::signed(1), hash),
|
||||
Error::<Test, ()>::NotVetoableProposal
|
||||
);
|
||||
|
||||
@@ -131,11 +131,11 @@ fn veto_works() {
|
||||
|
||||
// only founder have veto rights, 3 is fellow
|
||||
assert_noop!(
|
||||
Alliance::veto(Origin::signed(3), vetoable_hash.clone()),
|
||||
Alliance::veto(Origin::signed(3), vetoable_hash),
|
||||
Error::<Test, ()>::NotFounder
|
||||
);
|
||||
|
||||
assert_ok!(Alliance::veto(Origin::signed(2), vetoable_hash.clone()));
|
||||
assert_ok!(Alliance::veto(Origin::signed(2), vetoable_hash));
|
||||
let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] };
|
||||
assert_eq!(
|
||||
System::events(),
|
||||
@@ -143,17 +143,17 @@ fn veto_works() {
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 1,
|
||||
proposal_hash: vetoable_hash.clone(),
|
||||
proposal_hash: vetoable_hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Disapproved {
|
||||
proposal_hash: vetoable_hash.clone()
|
||||
proposal_hash: vetoable_hash
|
||||
})),
|
||||
]
|
||||
);
|
||||
@@ -173,16 +173,10 @@ fn close_works() {
|
||||
Box::new(proposal.clone()),
|
||||
proposal_len
|
||||
));
|
||||
assert_ok!(Alliance::vote(Origin::signed(1), hash.clone(), 0, true));
|
||||
assert_ok!(Alliance::vote(Origin::signed(2), hash.clone(), 0, true));
|
||||
assert_ok!(Alliance::vote(Origin::signed(3), hash.clone(), 0, true));
|
||||
assert_ok!(Alliance::close(
|
||||
Origin::signed(1),
|
||||
hash.clone(),
|
||||
0,
|
||||
proposal_weight,
|
||||
proposal_len
|
||||
));
|
||||
assert_ok!(Alliance::vote(Origin::signed(1), hash, 0, true));
|
||||
assert_ok!(Alliance::vote(Origin::signed(2), hash, 0, true));
|
||||
assert_ok!(Alliance::vote(Origin::signed(3), hash, 0, true));
|
||||
assert_ok!(Alliance::close(Origin::signed(1), hash, 0, proposal_weight, proposal_len));
|
||||
|
||||
let record = |event| EventRecord { phase: Phase::Initialization, event, topics: vec![] };
|
||||
assert_eq!(
|
||||
@@ -191,40 +185,40 @@ fn close_works() {
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Proposed {
|
||||
account: 1,
|
||||
proposal_index: 0,
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
threshold: 3
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
|
||||
account: 1,
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 1,
|
||||
no: 0,
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
|
||||
account: 2,
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 2,
|
||||
no: 0,
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Voted {
|
||||
account: 3,
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
voted: true,
|
||||
yes: 3,
|
||||
no: 0,
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Closed {
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
yes: 3,
|
||||
no: 0,
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Approved {
|
||||
proposal_hash: hash.clone()
|
||||
proposal_hash: hash
|
||||
})),
|
||||
record(mock::Event::AllianceMotion(AllianceMotionEvent::Executed {
|
||||
proposal_hash: hash.clone(),
|
||||
proposal_hash: hash,
|
||||
result: Err(DispatchError::BadOrigin),
|
||||
}))
|
||||
]
|
||||
|
||||
@@ -115,11 +115,11 @@ thread_local! {
|
||||
pub struct TestFreezer;
|
||||
impl FrozenBalance<u32, u64, u64> for TestFreezer {
|
||||
fn frozen_balance(asset: u32, who: &u64) -> Option<u64> {
|
||||
FROZEN.with(|f| f.borrow().get(&(asset, who.clone())).cloned())
|
||||
FROZEN.with(|f| f.borrow().get(&(asset, *who)).cloned())
|
||||
}
|
||||
|
||||
fn died(asset: u32, who: &u64) {
|
||||
HOOKS.with(|h| h.borrow_mut().push(Hook::Died(asset, who.clone())));
|
||||
HOOKS.with(|h| h.borrow_mut().push(Hook::Died(asset, *who)));
|
||||
// Sanity check: dead accounts have no balance.
|
||||
assert!(Assets::balance(asset, *who).is_zero());
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ pub mod pallet {
|
||||
);
|
||||
|
||||
swap.action.cancel(&swap.source);
|
||||
PendingSwaps::<T>::remove(&target, hashed_proof.clone());
|
||||
PendingSwaps::<T>::remove(&target, hashed_proof);
|
||||
|
||||
Self::deposit_event(Event::SwapCancelled { account: target, proof: hashed_proof });
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ fn two_party_successful_swap() {
|
||||
AtomicSwap::create_swap(
|
||||
Origin::signed(A),
|
||||
B,
|
||||
hashed_proof.clone(),
|
||||
hashed_proof,
|
||||
BalanceSwapAction::new(50),
|
||||
1000,
|
||||
)
|
||||
@@ -117,7 +117,7 @@ fn two_party_successful_swap() {
|
||||
AtomicSwap::create_swap(
|
||||
Origin::signed(B),
|
||||
A,
|
||||
hashed_proof.clone(),
|
||||
hashed_proof,
|
||||
BalanceSwapAction::new(75),
|
||||
1000,
|
||||
)
|
||||
|
||||
@@ -1416,12 +1416,7 @@ mod tests {
|
||||
loader.counter += 1;
|
||||
loader.map.insert(
|
||||
hash,
|
||||
MockExecutable {
|
||||
func: Rc::new(f),
|
||||
func_type,
|
||||
code_hash: hash.clone(),
|
||||
refcount: 1,
|
||||
},
|
||||
MockExecutable { func: Rc::new(f), func_type, code_hash: hash, refcount: 1 },
|
||||
);
|
||||
hash
|
||||
})
|
||||
@@ -2189,7 +2184,6 @@ mod tests {
|
||||
let dummy_ch = MockLoader::insert(Call, |_, _| exec_success());
|
||||
let instantiated_contract_address = Rc::new(RefCell::new(None::<AccountIdOf<Test>>));
|
||||
let instantiator_ch = MockLoader::insert(Call, {
|
||||
let dummy_ch = dummy_ch.clone();
|
||||
let instantiated_contract_address = Rc::clone(&instantiated_contract_address);
|
||||
move |ctx, _| {
|
||||
// Instantiate a contract and save it's address in `instantiated_contract_address`.
|
||||
@@ -2252,7 +2246,6 @@ mod tests {
|
||||
fn instantiation_traps() {
|
||||
let dummy_ch = MockLoader::insert(Constructor, |_, _| Err("It's a trap!".into()));
|
||||
let instantiator_ch = MockLoader::insert(Call, {
|
||||
let dummy_ch = dummy_ch.clone();
|
||||
move |ctx, _| {
|
||||
// Instantiate a contract and save it's address in `instantiated_contract_address`.
|
||||
assert_matches!(
|
||||
|
||||
@@ -139,7 +139,7 @@ impl TestExtension {
|
||||
}
|
||||
|
||||
fn last_seen_inputs() -> (u32, u32, u32, u32) {
|
||||
TEST_EXTENSION.with(|e| e.borrow().last_seen_inputs.clone())
|
||||
TEST_EXTENSION.with(|e| e.borrow().last_seen_inputs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3478,8 +3478,8 @@ fn set_code_hash() {
|
||||
phase: Phase::Initialization,
|
||||
event: Event::Contracts(crate::Event::ContractCodeUpdated {
|
||||
contract: contract_addr.clone(),
|
||||
new_code_hash: new_code_hash.clone(),
|
||||
old_code_hash: code_hash.clone(),
|
||||
new_code_hash,
|
||||
old_code_hash: code_hash,
|
||||
}),
|
||||
topics: vec![],
|
||||
},
|
||||
|
||||
@@ -403,7 +403,7 @@ mod tests {
|
||||
salt: &[u8],
|
||||
) -> Result<(AccountIdOf<Self::T>, ExecReturnValue), ExecError> {
|
||||
self.instantiates.push(InstantiateEntry {
|
||||
code_hash: code_hash.clone(),
|
||||
code_hash,
|
||||
value,
|
||||
data: data.to_vec(),
|
||||
gas_left: gas_limit,
|
||||
@@ -541,7 +541,7 @@ mod tests {
|
||||
signature: &[u8; 65],
|
||||
message_hash: &[u8; 32],
|
||||
) -> Result<[u8; 33], ()> {
|
||||
self.ecdsa_recover.borrow_mut().push((signature.clone(), message_hash.clone()));
|
||||
self.ecdsa_recover.borrow_mut().push((*signature, *message_hash));
|
||||
Ok([3; 33])
|
||||
}
|
||||
fn contract_info(&mut self) -> &mut crate::ContractInfo<Self::T> {
|
||||
|
||||
@@ -30,7 +30,7 @@ fn veto_external_works() {
|
||||
assert!(<NextExternal<Test>>::exists());
|
||||
|
||||
let h = set_balance_proposal_hash_and_note(2);
|
||||
assert_ok!(Democracy::veto_external(Origin::signed(3), h.clone()));
|
||||
assert_ok!(Democracy::veto_external(Origin::signed(3), h));
|
||||
// cancelled.
|
||||
assert!(!<NextExternal<Test>>::exists());
|
||||
// fails - same proposal can't be resubmitted.
|
||||
@@ -55,13 +55,10 @@ fn veto_external_works() {
|
||||
assert!(<NextExternal<Test>>::exists());
|
||||
|
||||
// 3 can't veto the same thing twice.
|
||||
assert_noop!(
|
||||
Democracy::veto_external(Origin::signed(3), h.clone()),
|
||||
Error::<Test>::AlreadyVetoed
|
||||
);
|
||||
assert_noop!(Democracy::veto_external(Origin::signed(3), h), Error::<Test>::AlreadyVetoed);
|
||||
|
||||
// 4 vetoes.
|
||||
assert_ok!(Democracy::veto_external(Origin::signed(4), h.clone()));
|
||||
assert_ok!(Democracy::veto_external(Origin::signed(4), h));
|
||||
// cancelled again.
|
||||
assert!(!<NextExternal<Test>>::exists());
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ fn blacklisting_should_work() {
|
||||
assert_ok!(propose_set_balance_and_note(1, 2, 2));
|
||||
assert_ok!(propose_set_balance_and_note(1, 4, 4));
|
||||
|
||||
assert_noop!(Democracy::blacklist(Origin::signed(1), hash.clone(), None), BadOrigin);
|
||||
assert_noop!(Democracy::blacklist(Origin::signed(1), hash, None), BadOrigin);
|
||||
assert_ok!(Democracy::blacklist(Origin::root(), hash, None));
|
||||
|
||||
assert_eq!(Democracy::backing_for(0), None);
|
||||
|
||||
@@ -1342,9 +1342,7 @@ mod tests {
|
||||
self
|
||||
}
|
||||
pub fn genesis_members(mut self, members: Vec<(u64, u64)>) -> Self {
|
||||
MEMBERS.with(|m| {
|
||||
*m.borrow_mut() = members.iter().map(|(m, _)| m.clone()).collect::<Vec<_>>()
|
||||
});
|
||||
MEMBERS.with(|m| *m.borrow_mut() = members.iter().map(|(m, _)| *m).collect::<Vec<_>>());
|
||||
self.genesis_members = members;
|
||||
self
|
||||
}
|
||||
@@ -1359,8 +1357,7 @@ mod tests {
|
||||
pub fn build_and_execute(self, test: impl FnOnce() -> ()) {
|
||||
sp_tracing::try_init_simple();
|
||||
MEMBERS.with(|m| {
|
||||
*m.borrow_mut() =
|
||||
self.genesis_members.iter().map(|(m, _)| m.clone()).collect::<Vec<_>>()
|
||||
*m.borrow_mut() = self.genesis_members.iter().map(|(m, _)| *m).collect::<Vec<_>>()
|
||||
});
|
||||
let mut ext: sp_io::TestExternalities = GenesisConfig {
|
||||
balances: pallet_balances::GenesisConfig::<Test> {
|
||||
|
||||
@@ -253,10 +253,9 @@ fn should_submit_unsigned_transaction_on_chain_for_any_account() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let public_key = SyncCryptoStore::sr25519_public_keys(&keystore, crate::crypto::Public::ID)
|
||||
let public_key = *SyncCryptoStore::sr25519_public_keys(&keystore, crate::crypto::Public::ID)
|
||||
.get(0)
|
||||
.unwrap()
|
||||
.clone();
|
||||
.unwrap();
|
||||
|
||||
let mut t = sp_io::TestExternalities::default();
|
||||
t.register_extension(OffchainWorkerExt::new(offchain));
|
||||
@@ -313,10 +312,9 @@ fn should_submit_unsigned_transaction_on_chain_for_all_accounts() {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let public_key = SyncCryptoStore::sr25519_public_keys(&keystore, crate::crypto::Public::ID)
|
||||
let public_key = *SyncCryptoStore::sr25519_public_keys(&keystore, crate::crypto::Public::ID)
|
||||
.get(0)
|
||||
.unwrap()
|
||||
.clone();
|
||||
.unwrap();
|
||||
|
||||
let mut t = sp_io::TestExternalities::default();
|
||||
t.register_extension(OffchainWorkerExt::new(offchain));
|
||||
|
||||
@@ -221,14 +221,7 @@ fn multisig_deposit_is_taken_and_returned_with_alt_call_storage() {
|
||||
let data = call.encode();
|
||||
let hash = blake2_256(&data);
|
||||
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
None,
|
||||
hash.clone(),
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
|
||||
assert_eq!(Balances::free_balance(1), 1);
|
||||
assert_eq!(Balances::reserved_balance(1), 4);
|
||||
|
||||
@@ -266,31 +259,18 @@ fn cancel_multisig_returns_deposit() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = call_transfer(6, 15).encode();
|
||||
let hash = blake2_256(&call);
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
None,
|
||||
hash.clone(),
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(2),
|
||||
3,
|
||||
vec![1, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
hash,
|
||||
0
|
||||
));
|
||||
assert_eq!(Balances::free_balance(1), 6);
|
||||
assert_eq!(Balances::reserved_balance(1), 4);
|
||||
assert_ok!(Multisig::cancel_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
now(),
|
||||
hash.clone()
|
||||
),);
|
||||
assert_ok!(Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash),);
|
||||
assert_eq!(Balances::free_balance(1), 10);
|
||||
assert_eq!(Balances::reserved_balance(1), 0);
|
||||
});
|
||||
@@ -308,14 +288,7 @@ fn timepoint_checking_works() {
|
||||
let hash = blake2_256(&call);
|
||||
|
||||
assert_noop!(
|
||||
Multisig::approve_as_multi(
|
||||
Origin::signed(2),
|
||||
2,
|
||||
vec![1, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
0
|
||||
),
|
||||
Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash, 0),
|
||||
Error::<Test>::UnexpectedTimepoint,
|
||||
);
|
||||
|
||||
@@ -424,20 +397,13 @@ fn multisig_3_of_3_works() {
|
||||
let call_weight = call.get_dispatch_info().weight;
|
||||
let data = call.encode();
|
||||
let hash = blake2_256(&data);
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
None,
|
||||
hash.clone(),
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(2),
|
||||
3,
|
||||
vec![1, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
hash,
|
||||
0
|
||||
));
|
||||
assert_eq!(Balances::free_balance(6), 0);
|
||||
@@ -460,33 +426,20 @@ fn cancel_multisig_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = call_transfer(6, 15).encode();
|
||||
let hash = blake2_256(&call);
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
None,
|
||||
hash.clone(),
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(2),
|
||||
3,
|
||||
vec![1, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
hash,
|
||||
0
|
||||
));
|
||||
assert_noop!(
|
||||
Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash.clone()),
|
||||
Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash),
|
||||
Error::<Test>::NotOwner,
|
||||
);
|
||||
assert_ok!(Multisig::cancel_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
now(),
|
||||
hash.clone()
|
||||
),);
|
||||
assert_ok!(Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash),);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -510,20 +463,14 @@ fn cancel_multisig_with_call_storage_works() {
|
||||
3,
|
||||
vec![1, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
hash,
|
||||
0
|
||||
));
|
||||
assert_noop!(
|
||||
Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash.clone()),
|
||||
Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash),
|
||||
Error::<Test>::NotOwner,
|
||||
);
|
||||
assert_ok!(Multisig::cancel_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
now(),
|
||||
hash.clone()
|
||||
),);
|
||||
assert_ok!(Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash),);
|
||||
assert_eq!(Balances::free_balance(1), 10);
|
||||
});
|
||||
}
|
||||
@@ -533,14 +480,7 @@ fn cancel_multisig_with_alt_call_storage_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = call_transfer(6, 15).encode();
|
||||
let hash = blake2_256(&call);
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
None,
|
||||
hash.clone(),
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
|
||||
assert_eq!(Balances::free_balance(1), 6);
|
||||
assert_ok!(Multisig::as_multi(
|
||||
Origin::signed(2),
|
||||
@@ -770,23 +710,9 @@ fn duplicate_approvals_are_ignored() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = call_transfer(6, 15).encode();
|
||||
let hash = blake2_256(&call);
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
2,
|
||||
vec![2, 3],
|
||||
None,
|
||||
hash.clone(),
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash, 0));
|
||||
assert_noop!(
|
||||
Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
2,
|
||||
vec![2, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
0
|
||||
),
|
||||
Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], Some(now()), hash, 0),
|
||||
Error::<Test>::AlreadyApproved,
|
||||
);
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
@@ -794,18 +720,11 @@ fn duplicate_approvals_are_ignored() {
|
||||
2,
|
||||
vec![1, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
hash,
|
||||
0
|
||||
));
|
||||
assert_noop!(
|
||||
Multisig::approve_as_multi(
|
||||
Origin::signed(3),
|
||||
2,
|
||||
vec![1, 2],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
0
|
||||
),
|
||||
Multisig::approve_as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), hash, 0),
|
||||
Error::<Test>::AlreadyApproved,
|
||||
);
|
||||
});
|
||||
@@ -822,7 +741,7 @@ fn multisig_1_of_3_works() {
|
||||
let call = call_transfer(6, 15).encode();
|
||||
let hash = blake2_256(&call);
|
||||
assert_noop!(
|
||||
Multisig::approve_as_multi(Origin::signed(1), 1, vec![2, 3], None, hash.clone(), 0),
|
||||
Multisig::approve_as_multi(Origin::signed(1), 1, vec![2, 3], None, hash, 0),
|
||||
Error::<Test>::MinimumThreshold,
|
||||
);
|
||||
assert_noop!(
|
||||
@@ -906,20 +825,13 @@ fn multisig_handles_no_preimage_after_all_approve() {
|
||||
let call_weight = call.get_dispatch_info().weight;
|
||||
let data = call.encode();
|
||||
let hash = blake2_256(&data);
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(1),
|
||||
3,
|
||||
vec![2, 3],
|
||||
None,
|
||||
hash.clone(),
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
Origin::signed(2),
|
||||
3,
|
||||
vec![1, 3],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
hash,
|
||||
0
|
||||
));
|
||||
assert_ok!(Multisig::approve_as_multi(
|
||||
@@ -927,7 +839,7 @@ fn multisig_handles_no_preimage_after_all_approve() {
|
||||
3,
|
||||
vec![1, 2],
|
||||
Some(now()),
|
||||
hash.clone(),
|
||||
hash,
|
||||
0
|
||||
));
|
||||
assert_eq!(Balances::free_balance(6), 0);
|
||||
|
||||
@@ -224,7 +224,7 @@ frame_benchmarking::benchmarks! {
|
||||
origin_weight
|
||||
);
|
||||
|
||||
let max_additional = scenario.dest_weight.clone() - origin_weight;
|
||||
let max_additional = scenario.dest_weight - origin_weight;
|
||||
let joiner_free = CurrencyOf::<T>::minimum_balance() + max_additional;
|
||||
|
||||
let joiner: T::AccountId
|
||||
@@ -243,7 +243,7 @@ frame_benchmarking::benchmarks! {
|
||||
bond_extra_transfer {
|
||||
let origin_weight = min_create_bond::<T>() * 2u32.into();
|
||||
let scenario = ListScenario::<T>::new(origin_weight, true)?;
|
||||
let extra = scenario.dest_weight.clone() - origin_weight;
|
||||
let extra = scenario.dest_weight - origin_weight;
|
||||
|
||||
// creator of the src pool will bond-extra, bumping itself to dest bag.
|
||||
|
||||
@@ -258,7 +258,7 @@ frame_benchmarking::benchmarks! {
|
||||
bond_extra_reward {
|
||||
let origin_weight = min_create_bond::<T>() * 2u32.into();
|
||||
let scenario = ListScenario::<T>::new(origin_weight, true)?;
|
||||
let extra = (scenario.dest_weight.clone() - origin_weight).max(CurrencyOf::<T>::minimum_balance());
|
||||
let extra = (scenario.dest_weight - origin_weight).max(CurrencyOf::<T>::minimum_balance());
|
||||
|
||||
// transfer exactly `extra` to the depositor of the src pool (1),
|
||||
let reward_account1 = Pools::<T>::create_reward_account(1);
|
||||
@@ -306,7 +306,7 @@ frame_benchmarking::benchmarks! {
|
||||
// significantly higher than the first position in a list (e.g. the first bag threshold).
|
||||
let origin_weight = min_create_bond::<T>() * 200u32.into();
|
||||
let scenario = ListScenario::<T>::new(origin_weight, false)?;
|
||||
let amount = origin_weight - scenario.dest_weight.clone();
|
||||
let amount = origin_weight - scenario.dest_weight;
|
||||
|
||||
let scenario = scenario.add_joiner(amount);
|
||||
let member_id = scenario.origin1_member.unwrap().clone();
|
||||
@@ -316,7 +316,7 @@ frame_benchmarking::benchmarks! {
|
||||
verify {
|
||||
let bonded_after = T::StakingInterface::active_stake(&scenario.origin1).unwrap();
|
||||
// We at least went down to the destination bag
|
||||
assert!(bonded_after <= scenario.dest_weight.clone());
|
||||
assert!(bonded_after <= scenario.dest_weight);
|
||||
let member = PoolMembers::<T>::get(
|
||||
&member_id
|
||||
)
|
||||
|
||||
@@ -491,7 +491,7 @@ impl<T: Config> PoolMember<T> {
|
||||
true
|
||||
} else {
|
||||
removed_points
|
||||
.try_insert(*e, p.clone())
|
||||
.try_insert(*e, *p)
|
||||
.expect("source map is bounded, this is a subset, will be bounded; qed");
|
||||
false
|
||||
}
|
||||
@@ -1920,10 +1920,7 @@ pub mod pallet {
|
||||
);
|
||||
ReversePoolIdLookup::<T>::insert(bonded_pool.bonded_account(), pool_id);
|
||||
|
||||
Self::deposit_event(Event::<T>::Created {
|
||||
depositor: who.clone(),
|
||||
pool_id: pool_id.clone(),
|
||||
});
|
||||
Self::deposit_event(Event::<T>::Created { depositor: who.clone(), pool_id });
|
||||
|
||||
Self::deposit_event(Event::<T>::Bonded {
|
||||
member: who,
|
||||
|
||||
@@ -244,7 +244,7 @@ pub mod v2 {
|
||||
},
|
||||
};
|
||||
|
||||
total_value_locked += bonded_pool.points_to_balance(points.clone());
|
||||
total_value_locked += bonded_pool.points_to_balance(*points);
|
||||
let portion = Perbill::from_rational(*points, bonded_pool.points);
|
||||
let last_claim = portion * accumulated_reward;
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ fn anonymous_works() {
|
||||
let anon = Proxy::anonymous_account(&1, &ProxyType::Any, 0, None);
|
||||
System::assert_last_event(
|
||||
ProxyEvent::AnonymousCreated {
|
||||
anonymous: anon.clone(),
|
||||
anonymous: anon,
|
||||
who: 1,
|
||||
proxy_type: ProxyType::Any,
|
||||
disambiguation_index: 0,
|
||||
|
||||
@@ -28,7 +28,7 @@ fn generates_event() {
|
||||
let caller = 1;
|
||||
let data = vec![0u8; 100];
|
||||
System::set_block_number(System::block_number() + 1); //otherwise event won't be registered.
|
||||
assert_ok!(Remark::<Test>::store(RawOrigin::Signed(caller.clone()).into(), data.clone(),));
|
||||
assert_ok!(Remark::<Test>::store(RawOrigin::Signed(caller).into(), data.clone(),));
|
||||
let events = System::events();
|
||||
// this one we create as we expect it
|
||||
let system_event: <Test as frame_system::Config>::Event = Event::Stored {
|
||||
@@ -50,7 +50,7 @@ fn does_not_store_empty() {
|
||||
let data = vec![];
|
||||
System::set_block_number(System::block_number() + 1); //otherwise event won't be registered.
|
||||
assert_noop!(
|
||||
Remark::<Test>::store(RawOrigin::Signed(caller.clone()).into(), data.clone(),),
|
||||
Remark::<Test>::store(RawOrigin::Signed(caller).into(), data.clone(),),
|
||||
Error::<Test>::Empty
|
||||
);
|
||||
assert!(System::events().is_empty());
|
||||
|
||||
@@ -47,7 +47,7 @@ fn scheduling_with_preimages_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = Call::Logger(LoggerCall::log { i: 42, weight: 1000 });
|
||||
let hash = <Test as frame_system::Config>::Hashing::hash_of(&call);
|
||||
let hashed = MaybeHashed::Hash(hash.clone());
|
||||
let hashed = MaybeHashed::Hash(hash);
|
||||
assert_ok!(Preimage::note_preimage(Origin::signed(0), call.encode()));
|
||||
assert_ok!(Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), hashed));
|
||||
assert!(Preimage::preimage_requested(&hash));
|
||||
@@ -67,7 +67,7 @@ fn scheduling_with_preimage_postpones_correctly() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let call = Call::Logger(LoggerCall::log { i: 42, weight: 1000 });
|
||||
let hash = <Test as frame_system::Config>::Hashing::hash_of(&call);
|
||||
let hashed = MaybeHashed::Hash(hash.clone());
|
||||
let hashed = MaybeHashed::Hash(hash);
|
||||
|
||||
assert_ok!(Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), hashed));
|
||||
assert!(Preimage::preimage_requested(&hash));
|
||||
|
||||
@@ -826,7 +826,7 @@ pub(crate) fn on_offence_now(
|
||||
pub(crate) fn add_slash(who: &AccountId) {
|
||||
on_offence_now(
|
||||
&[OffenceDetails {
|
||||
offender: (who.clone(), Staking::eras_stakers(active_era(), who.clone())),
|
||||
offender: (*who, Staking::eras_stakers(active_era(), *who)),
|
||||
reporters: vec![],
|
||||
}],
|
||||
&[Perbill::from_percent(10)],
|
||||
|
||||
@@ -1082,10 +1082,7 @@ fn validator_payment_prefs_work() {
|
||||
// This test will focus on validator payment.
|
||||
ExtBuilder::default().build_and_execute(|| {
|
||||
let commission = Perbill::from_percent(40);
|
||||
<Validators<Test>>::insert(
|
||||
&11,
|
||||
ValidatorPrefs { commission: commission.clone(), ..Default::default() },
|
||||
);
|
||||
<Validators<Test>>::insert(&11, ValidatorPrefs { commission, ..Default::default() });
|
||||
|
||||
// Reward controller so staked ratio doesn't change.
|
||||
<Payee<Test>>::insert(&11, RewardDestination::Controller);
|
||||
|
||||
@@ -1253,7 +1253,7 @@ mod mock {
|
||||
|
||||
weight_sum += StateTrieMigration::on_initialize(System::block_number());
|
||||
|
||||
root = System::finalize().state_root().clone();
|
||||
root = *System::finalize().state_root();
|
||||
System::on_finalize(System::block_number());
|
||||
}
|
||||
(root, weight_sum)
|
||||
|
||||
@@ -101,7 +101,7 @@ pub(crate) fn clear_captured_moment() {
|
||||
}
|
||||
|
||||
pub(crate) fn get_captured_moment() -> Option<Moment> {
|
||||
CAPTURED_MOMENT.with(|x| x.borrow().clone())
|
||||
CAPTURED_MOMENT.with(|x| *x.borrow())
|
||||
}
|
||||
|
||||
pub(crate) fn new_test_ext() -> TestExternalities {
|
||||
|
||||
@@ -256,10 +256,10 @@ fn report_awesome_and_tip_works() {
|
||||
);
|
||||
|
||||
let h = tip_hash();
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 10));
|
||||
assert_noop!(Tips::tip(Origin::signed(9), h.clone(), 10), BadOrigin);
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 10));
|
||||
assert_noop!(Tips::tip(Origin::signed(9), h, 10), BadOrigin);
|
||||
System::set_block_number(2);
|
||||
assert_ok!(Tips::close_tip(Origin::signed(100), h.into()));
|
||||
assert_eq!(Balances::reserved_balance(0), 0);
|
||||
@@ -276,9 +276,9 @@ fn report_awesome_from_beneficiary_and_tip_works() {
|
||||
assert_eq!(Balances::reserved_balance(0), 12);
|
||||
assert_eq!(Balances::free_balance(0), 88);
|
||||
let h = BlakeTwo256::hash_of(&(BlakeTwo256::hash(b"awesome.dot"), 0u128));
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 10));
|
||||
System::set_block_number(2);
|
||||
assert_ok!(Tips::close_tip(Origin::signed(100), h.into()));
|
||||
assert_eq!(Balances::reserved_balance(0), 0);
|
||||
@@ -300,11 +300,11 @@ fn close_tip_works() {
|
||||
|
||||
assert_eq!(last_event(), TipEvent::NewTip { tip_hash: h });
|
||||
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 10));
|
||||
|
||||
assert_noop!(Tips::close_tip(Origin::signed(0), h.into()), Error::<Test>::StillOpen);
|
||||
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 10));
|
||||
|
||||
assert_eq!(last_event(), TipEvent::TipClosing { tip_hash: h });
|
||||
|
||||
@@ -340,10 +340,10 @@ fn slash_tip_works() {
|
||||
assert_eq!(last_event(), TipEvent::NewTip { tip_hash: h });
|
||||
|
||||
// can't remove from any origin
|
||||
assert_noop!(Tips::slash_tip(Origin::signed(0), h.clone()), BadOrigin);
|
||||
assert_noop!(Tips::slash_tip(Origin::signed(0), h), BadOrigin);
|
||||
|
||||
// can remove from root.
|
||||
assert_ok!(Tips::slash_tip(Origin::root(), h.clone()));
|
||||
assert_ok!(Tips::slash_tip(Origin::root(), h));
|
||||
assert_eq!(last_event(), TipEvent::TipSlashed { tip_hash: h, finder: 0, deposit: 12 });
|
||||
|
||||
// tipper slashed
|
||||
@@ -359,11 +359,11 @@ fn retract_tip_works() {
|
||||
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||
assert_ok!(Tips::report_awesome(Origin::signed(0), b"awesome.dot".to_vec(), 3));
|
||||
let h = tip_hash();
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 10));
|
||||
assert_noop!(Tips::retract_tip(Origin::signed(10), h.clone()), Error::<Test>::NotFinder);
|
||||
assert_ok!(Tips::retract_tip(Origin::signed(0), h.clone()));
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 10));
|
||||
assert_noop!(Tips::retract_tip(Origin::signed(10), h), Error::<Test>::NotFinder);
|
||||
assert_ok!(Tips::retract_tip(Origin::signed(0), h));
|
||||
System::set_block_number(2);
|
||||
assert_noop!(Tips::close_tip(Origin::signed(0), h.into()), Error::<Test>::UnknownTip);
|
||||
|
||||
@@ -371,10 +371,10 @@ fn retract_tip_works() {
|
||||
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||
assert_ok!(Tips::tip_new(Origin::signed(10), b"awesome.dot".to_vec(), 3, 10));
|
||||
let h = tip_hash();
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 10));
|
||||
assert_noop!(Tips::retract_tip(Origin::signed(0), h.clone()), Error::<Test>::NotFinder);
|
||||
assert_ok!(Tips::retract_tip(Origin::signed(10), h.clone()));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 10));
|
||||
assert_noop!(Tips::retract_tip(Origin::signed(0), h), Error::<Test>::NotFinder);
|
||||
assert_ok!(Tips::retract_tip(Origin::signed(10), h));
|
||||
System::set_block_number(2);
|
||||
assert_noop!(Tips::close_tip(Origin::signed(10), h.into()), Error::<Test>::UnknownTip);
|
||||
});
|
||||
@@ -386,8 +386,8 @@ fn tip_median_calculation_works() {
|
||||
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||
assert_ok!(Tips::tip_new(Origin::signed(10), b"awesome.dot".to_vec(), 3, 0));
|
||||
let h = tip_hash();
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 1000000));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 1000000));
|
||||
System::set_block_number(2);
|
||||
assert_ok!(Tips::close_tip(Origin::signed(0), h.into()));
|
||||
assert_eq!(Balances::free_balance(3), 10);
|
||||
@@ -400,13 +400,13 @@ fn tip_changing_works() {
|
||||
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||
assert_ok!(Tips::tip_new(Origin::signed(10), b"awesome.dot".to_vec(), 3, 10000));
|
||||
let h = tip_hash();
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 10000));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 10000));
|
||||
assert_ok!(Tips::tip(Origin::signed(13), h.clone(), 0));
|
||||
assert_ok!(Tips::tip(Origin::signed(14), h.clone(), 0));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h.clone(), 1000));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h.clone(), 100));
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h.clone(), 10));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 10000));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 10000));
|
||||
assert_ok!(Tips::tip(Origin::signed(13), h, 0));
|
||||
assert_ok!(Tips::tip(Origin::signed(14), h, 0));
|
||||
assert_ok!(Tips::tip(Origin::signed(12), h, 1000));
|
||||
assert_ok!(Tips::tip(Origin::signed(11), h, 100));
|
||||
assert_ok!(Tips::tip(Origin::signed(10), h, 10));
|
||||
System::set_block_number(2);
|
||||
assert_ok!(Tips::close_tip(Origin::signed(0), h.into()));
|
||||
assert_eq!(Balances::free_balance(3), 10);
|
||||
@@ -595,10 +595,10 @@ fn report_awesome_and_tip_works_second_instance() {
|
||||
assert_ok!(Tips::report_awesome(Origin::signed(0), b"awesome.dot".to_vec(), 3));
|
||||
|
||||
let h = tip_hash();
|
||||
assert_ok!(Tips1::tip(Origin::signed(10), h.clone(), 10));
|
||||
assert_ok!(Tips1::tip(Origin::signed(11), h.clone(), 10));
|
||||
assert_ok!(Tips1::tip(Origin::signed(12), h.clone(), 10));
|
||||
assert_noop!(Tips1::tip(Origin::signed(9), h.clone(), 10), BadOrigin);
|
||||
assert_ok!(Tips1::tip(Origin::signed(10), h, 10));
|
||||
assert_ok!(Tips1::tip(Origin::signed(11), h, 10));
|
||||
assert_ok!(Tips1::tip(Origin::signed(12), h, 10));
|
||||
assert_noop!(Tips1::tip(Origin::signed(9), h, 10), BadOrigin);
|
||||
|
||||
System::set_block_number(2);
|
||||
|
||||
|
||||
@@ -1042,8 +1042,8 @@ mod tests {
|
||||
&Ok(())
|
||||
));
|
||||
assert_eq!(Balances::free_balance(1), 100 - 5 - 5 - 10);
|
||||
assert_eq!(FEE_UNBALANCED_AMOUNT.with(|a| a.borrow().clone()), 5 + 5 + 10);
|
||||
assert_eq!(TIP_UNBALANCED_AMOUNT.with(|a| a.borrow().clone()), 0);
|
||||
assert_eq!(FEE_UNBALANCED_AMOUNT.with(|a| *a.borrow()), 5 + 5 + 10);
|
||||
assert_eq!(TIP_UNBALANCED_AMOUNT.with(|a| *a.borrow()), 0);
|
||||
|
||||
FEE_UNBALANCED_AMOUNT.with(|a| *a.borrow_mut() = 0);
|
||||
|
||||
@@ -1060,8 +1060,8 @@ mod tests {
|
||||
&Ok(())
|
||||
));
|
||||
assert_eq!(Balances::free_balance(2), 200 - 5 - 10 - 50 - 5);
|
||||
assert_eq!(FEE_UNBALANCED_AMOUNT.with(|a| a.borrow().clone()), 5 + 10 + 50);
|
||||
assert_eq!(TIP_UNBALANCED_AMOUNT.with(|a| a.borrow().clone()), 5);
|
||||
assert_eq!(FEE_UNBALANCED_AMOUNT.with(|a| *a.borrow()), 5 + 10 + 50);
|
||||
assert_eq!(TIP_UNBALANCED_AMOUNT.with(|a| *a.borrow()), 5);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ fn discards_data() {
|
||||
run_to_block(1, || None);
|
||||
let caller = 1;
|
||||
assert_ok!(TransactionStorage::<Test>::store(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
RawOrigin::Signed(caller).into(),
|
||||
vec![0u8; 2000 as usize]
|
||||
));
|
||||
assert_ok!(TransactionStorage::<Test>::store(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
RawOrigin::Signed(caller).into(),
|
||||
vec![0u8; 2000 as usize]
|
||||
));
|
||||
let proof_provider = || {
|
||||
@@ -74,7 +74,7 @@ fn burns_fee() {
|
||||
Error::<Test>::InsufficientFunds,
|
||||
);
|
||||
assert_ok!(TransactionStorage::<Test>::store(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
RawOrigin::Signed(caller).into(),
|
||||
vec![0u8; 2000 as usize]
|
||||
));
|
||||
assert_eq!(Balances::free_balance(1), 1_000_000_000 - 2000 * 2 - 200);
|
||||
@@ -87,7 +87,7 @@ fn checks_proof() {
|
||||
run_to_block(1, || None);
|
||||
let caller = 1;
|
||||
assert_ok!(TransactionStorage::<Test>::store(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
RawOrigin::Signed(caller).into(),
|
||||
vec![0u8; MAX_DATA_SIZE as usize]
|
||||
));
|
||||
run_to_block(10, || None);
|
||||
@@ -119,13 +119,13 @@ fn renews_data() {
|
||||
run_to_block(1, || None);
|
||||
let caller = 1;
|
||||
assert_ok!(TransactionStorage::<Test>::store(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
RawOrigin::Signed(caller).into(),
|
||||
vec![0u8; 2000]
|
||||
));
|
||||
let info = BlockTransactions::<Test>::get().last().unwrap().clone();
|
||||
run_to_block(6, || None);
|
||||
assert_ok!(TransactionStorage::<Test>::renew(
|
||||
RawOrigin::Signed(caller.clone()).into(),
|
||||
RawOrigin::Signed(caller).into(),
|
||||
1, // block
|
||||
0, // transaction
|
||||
));
|
||||
|
||||
@@ -234,15 +234,11 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
ensure!(details.owner == sender, Error::<T, I>::NoPermission);
|
||||
|
||||
if let Some(ref price) = price {
|
||||
ItemPriceOf::<T, I>::insert(
|
||||
&collection,
|
||||
&item,
|
||||
(price.clone(), whitelisted_buyer.clone()),
|
||||
);
|
||||
ItemPriceOf::<T, I>::insert(&collection, &item, (price, whitelisted_buyer.clone()));
|
||||
Self::deposit_event(Event::ItemPriceSet {
|
||||
collection,
|
||||
item,
|
||||
price: price.clone(),
|
||||
price: *price,
|
||||
whitelisted_buyer,
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user