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
Showing
with 388 additions and 347 deletions
......@@ -14,7 +14,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
use crate::mock::Event as RuntimeEvent;
use crate::mock::*;
use crate::{Error, Event};
use frame_support::assert_ok;
......@@ -29,7 +28,7 @@ fn test_must_receive_cert_before_can_issue() {
})
.execute_with(|| {
assert_eq!(
DefaultCertification::add_cert(Origin::signed(0), 0, 1),
DefaultCertification::add_cert(RuntimeOrigin::signed(0), 0, 1),
Err(Error::<Test, _>::NotEnoughCertReceived.into())
);
});
......@@ -50,7 +49,7 @@ fn test_cannot_certify_self() {
run_to_block(2);
assert_eq!(
DefaultCertification::add_cert(Origin::signed(0), 0, 0),
DefaultCertification::add_cert(RuntimeOrigin::signed(0), 0, 0),
Err(Error::<Test, _>::CannotCertifySelf.into())
);
});
......@@ -154,17 +153,25 @@ fn test_cert_period() {
}
);
assert_eq!(
DefaultCertification::add_cert(Origin::signed(0), 0, 3),
DefaultCertification::add_cert(RuntimeOrigin::signed(0), 0, 3),
Err(Error::<Test, _>::NotRespectCertPeriod.into())
);
run_to_block(CertPeriod::get());
assert_ok!(DefaultCertification::add_cert(Origin::signed(0), 0, 3));
assert_ok!(DefaultCertification::add_cert(
RuntimeOrigin::signed(0),
0,
3
));
run_to_block(CertPeriod::get() + 1);
assert_eq!(
DefaultCertification::add_cert(Origin::signed(0), 0, 4),
DefaultCertification::add_cert(RuntimeOrigin::signed(0), 0, 4),
Err(Error::<Test, _>::NotRespectCertPeriod.into())
);
run_to_block((2 * CertPeriod::get()) + 1);
assert_ok!(DefaultCertification::add_cert(Origin::signed(0), 0, 4));
assert_ok!(DefaultCertification::add_cert(
RuntimeOrigin::signed(0),
0,
4
));
});
}
......@@ -14,13 +14,15 @@
// You should have received a copy of the GNU Affero General Public License
// along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
pub trait IsCertAllowed<IdtyIndex> {
fn is_cert_allowed(issuer: IdtyIndex, receiver: IdtyIndex) -> bool;
use frame_support::pallet_prelude::*;
pub trait CheckCertAllowed<IdtyIndex> {
fn check_cert_allowed(issuer: IdtyIndex, receiver: IdtyIndex) -> Result<(), DispatchError>;
}
impl<IdtyIndex> IsCertAllowed<IdtyIndex> for () {
fn is_cert_allowed(_issuer: IdtyIndex, _receiver: IdtyIndex) -> bool {
true
impl<IdtyIndex> CheckCertAllowed<IdtyIndex> for () {
fn check_cert_allowed(_issuer: IdtyIndex, _receiver: IdtyIndex) -> Result<(), DispatchError> {
Ok(())
}
}
......@@ -39,7 +41,7 @@ impl<IdtyIndex> OnNewcert<IdtyIndex> for () {
_receiver: IdtyIndex,
_receiver_received_count: u32,
) -> frame_support::dispatch::Weight {
0
Weight::zero()
}
}
......@@ -60,7 +62,7 @@ impl<IdtyIndex> OnRemovedCert<IdtyIndex> for () {
_receiver_received_count: u32,
_expiration: bool,
) -> frame_support::dispatch::Weight {
0
Weight::zero()
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.