Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • nodes/rust/duniter-v2s
  • llaq/lc-core-substrate
  • pini-gh/duniter-v2s
  • vincentux/duniter-v2s
  • mildred/duniter-v2s
  • d0p1/duniter-v2s
  • bgallois/duniter-v2s
  • Nicolas80/duniter-v2s
8 results
Show changes
Commits on Source (3)
...@@ -8,6 +8,7 @@ workflow: ...@@ -8,6 +8,7 @@ workflow:
rules: rules:
- changes: - changes:
- docker/Dockerfile - docker/Dockerfile
- end2end-tests/**/*
- node/**/* - node/**/*
- pallets/**/* - pallets/**/*
- runtime/**/* - runtime/**/*
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
use super::*; use super::*;
use crate::mock::*; use crate::mock::*;
use crate::MemberData; use crate::MemberData;
use frame_support::{assert_err, assert_ok}; use frame_support::{assert_noop, assert_ok};
use sp_runtime::testing::UintAuthorityId; use sp_runtime::testing::UintAuthorityId;
const EMPTY: Vec<u64> = Vec::new(); const EMPTY: Vec<u64> = Vec::new();
...@@ -249,7 +249,7 @@ fn test_too_many_authorities() { ...@@ -249,7 +249,7 @@ fn test_too_many_authorities() {
UintAuthorityId(15).into(), UintAuthorityId(15).into(),
)); ));
assert_eq!(AuthorityMembers::authorities_counter(), 4); assert_eq!(AuthorityMembers::authorities_counter(), 4);
assert_err!( assert_noop!(
AuthorityMembers::go_online(Origin::signed(15)), AuthorityMembers::go_online(Origin::signed(15)),
Error::<Test>::TooManyAuthorities, Error::<Test>::TooManyAuthorities,
); );
......
...@@ -249,7 +249,20 @@ impl<T: Config<I>, I: 'static> pallet_identity::traits::OnIdtyChange<T> for Pall ...@@ -249,7 +249,20 @@ impl<T: Config<I>, I: 'static> pallet_identity::traits::OnIdtyChange<T> for Pall
} }
IdtyEvent::Confirmed => {} IdtyEvent::Confirmed => {}
IdtyEvent::Validated => {} IdtyEvent::Validated => {}
IdtyEvent::Removed => {} IdtyEvent::Removed { status } => {
if status != IdtyStatus::Validated {
if let Err(e) =
<pallet_certification::Pallet<T, I>>::remove_all_certs_received_by(
frame_system::Origin::<T>::Root.into(),
idty_index,
)
{
sp_std::if_std! {
println!("fail to remove certs received by some idty: {:?}", e)
}
}
}
}
} }
0 0
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
use crate::mock::Identity; use crate::mock::Identity;
use crate::mock::*; use crate::mock::*;
use frame_support::assert_err; use frame_support::assert_noop;
use frame_support::assert_ok; use frame_support::assert_ok;
use frame_support::instances::Instance1; use frame_support::instances::Instance1;
use frame_system::{EventRecord, Phase}; use frame_system::{EventRecord, Phase};
...@@ -43,7 +43,7 @@ fn test_creator_not_allowed_to_create_idty() { ...@@ -43,7 +43,7 @@ fn test_creator_not_allowed_to_create_idty() {
// Alice should not be able to create an identity before block #2 // Alice should not be able to create an identity before block #2
// because Alice.next_issuable_on = 2 // because Alice.next_issuable_on = 2
assert_err!( assert_noop!(
Identity::create_identity(Origin::signed(1), 4), Identity::create_identity(Origin::signed(1), 4),
pallet_identity::Error::<Test>::CreatorNotAllowedToCreateIdty pallet_identity::Error::<Test>::CreatorNotAllowedToCreateIdty
); );
...@@ -81,7 +81,7 @@ fn test_revoke_smiths_them_rejoin() { ...@@ -81,7 +81,7 @@ fn test_revoke_smiths_them_rejoin() {
// Dave should not be able to re-request membership before the RevocationPeriod end // Dave should not be able to re-request membership before the RevocationPeriod end
run_to_block(3); run_to_block(3);
assert_err!( assert_noop!(
SmithsMembership::request_membership(Origin::signed(4), crate::MembershipMetaData(4)), SmithsMembership::request_membership(Origin::signed(4), crate::MembershipMetaData(4)),
pallet_membership::Error::<Test, crate::Instance2>::MembershipRevokedRecently pallet_membership::Error::<Test, crate::Instance2>::MembershipRevokedRecently
); );
...@@ -281,9 +281,31 @@ fn test_idty_membership_expire_them_requested() { ...@@ -281,9 +281,31 @@ fn test_idty_membership_expire_them_requested() {
assert!(Identity::identity(3).is_none()); assert!(Identity::identity(3).is_none());
// Alice can't renew her cert to Charlie // Alice can't renew her cert to Charlie
assert_err!( assert_noop!(
Cert::add_cert(Origin::signed(1), 3), Cert::add_cert(Origin::signed(1), 3),
pallet_certification::Error::<Test, Instance1>::ReceiverNotFound pallet_certification::Error::<Test, Instance1>::ReceiverNotFound
); );
}); });
} }
#[test]
fn test_unvalidated_idty_certs_removal() {
new_test_ext(5, 2).execute_with(|| {
// Alice creates Ferdie identity
run_to_block(2);
assert_ok!(Identity::create_identity(Origin::signed(1), 6));
// Ferdie confirms his identity
run_to_block(3);
assert_ok!(Identity::confirm_identity(
Origin::signed(6),
IdtyName::from("Ferdie"),
));
// After PendingMembershipPeriod, Ferdie identity should expire
// and his received certifications should be removed
assert_eq!(Cert::certs_by_receiver(6).len(), 1);
run_to_block(6);
assert_eq!(Cert::certs_by_receiver(6).len(), 0);
});
}
...@@ -525,7 +525,12 @@ pub mod pallet { ...@@ -525,7 +525,12 @@ pub mod pallet {
Identities::<T>::remove(idty_index); Identities::<T>::remove(idty_index);
frame_system::Pallet::<T>::dec_sufficients(&idty_val.owner_key); frame_system::Pallet::<T>::dec_sufficients(&idty_val.owner_key);
Self::deposit_event(Event::IdtyRemoved { idty_index }); Self::deposit_event(Event::IdtyRemoved { idty_index });
T::OnIdtyChange::on_idty_change(idty_index, IdtyEvent::Removed); T::OnIdtyChange::on_idty_change(
idty_index,
IdtyEvent::Removed {
status: idty_val.status,
},
);
} }
0 0
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
use crate::mock::*; use crate::mock::*;
use crate::{Error, GenesisIdty, IdtyName, IdtyValue, RevocationPayload}; use crate::{Error, GenesisIdty, IdtyName, IdtyValue, RevocationPayload};
use codec::Encode; use codec::Encode;
//use frame_support::assert_err; //use frame_support::assert_noop;
use frame_support::assert_ok; use frame_support::assert_ok;
use frame_system::{EventRecord, Phase}; use frame_system::{EventRecord, Phase};
use sp_runtime::testing::TestSignature; use sp_runtime::testing::TestSignature;
......
...@@ -27,7 +27,7 @@ pub enum IdtyEvent<T: crate::Config> { ...@@ -27,7 +27,7 @@ pub enum IdtyEvent<T: crate::Config> {
Created { creator: T::IdtyIndex }, Created { creator: T::IdtyIndex },
Confirmed, Confirmed,
Validated, Validated,
Removed, Removed { status: IdtyStatus },
} }
#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug)] #[derive(Encode, Decode, Default, Clone, PartialEq, Eq, PartialOrd, Ord, RuntimeDebug)]
......
...@@ -18,7 +18,7 @@ mod common; ...@@ -18,7 +18,7 @@ mod common;
use common::*; use common::*;
use frame_support::traits::{PalletInfo, StorageInfo, StorageInfoTrait}; use frame_support::traits::{PalletInfo, StorageInfo, StorageInfoTrait};
use frame_support::{assert_err, assert_ok}; use frame_support::{assert_noop, assert_ok};
use frame_support::{StorageHasher, Twox128}; use frame_support::{StorageHasher, Twox128};
use gdev_runtime::*; use gdev_runtime::*;
use sp_keyring::AccountKeyring; use sp_keyring::AccountKeyring;
...@@ -295,7 +295,7 @@ fn test_create_new_account() { ...@@ -295,7 +295,7 @@ fn test_create_new_account() {
// We can't remove the account until the random id is assigned // We can't remove the account until the random id is assigned
run_to_block(4); run_to_block(4);
assert_err!( assert_noop!(
Balances::transfer( Balances::transfer(
frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(), frame_system::RawOrigin::Signed(AccountKeyring::Eve.to_account_id()).into(),
MultiAddress::Id(AccountKeyring::Alice.to_account_id()), MultiAddress::Id(AccountKeyring::Alice.to_account_id()),
......