Skip to content

Commit 8a53337

Browse files
committed
Merge branch 'master' into release-1.15.2
2 parents b1f094a + c1dc94c commit 8a53337

36 files changed

Lines changed: 1158 additions & 357 deletions

File tree

dip-template/runtimes/dip-consumer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ frame-executive = { workspace = true }
3333
frame-support = { workspace = true }
3434
frame-system = { workspace = true }
3535
frame-system-rpc-runtime-api = { workspace = true }
36-
pallet-aura = { workspace = true }
36+
pallet-aura = { workspace = true, features = ["experimental"] }
3737
pallet-authorship = { workspace = true }
3838
pallet-balances = { workspace = true }
3939
pallet-session = { workspace = true }

dip-template/runtimes/dip-consumer/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ impl pallet_aura::Config for Runtime {
369369
type AuthorityId = AuraId;
370370
type DisabledValidators = ();
371371
type MaxAuthorities = ConstU32<100_000>;
372+
type SlotDuration = ConstU64<SLOT_DURATION>;
372373
}
373374

374375
impl cumulus_pallet_aura_ext::Config for Runtime {}

dip-template/runtimes/dip-provider/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ frame-executive = { workspace = true }
3333
frame-support = { workspace = true }
3434
frame-system = { workspace = true }
3535
frame-system-rpc-runtime-api = { workspace = true }
36-
pallet-aura = { workspace = true }
36+
pallet-aura = { workspace = true, features = ["experimental"] }
3737
pallet-authorship = { workspace = true }
3838
pallet-balances = { workspace = true }
3939
pallet-session = { workspace = true }

dip-template/runtimes/dip-provider/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ impl pallet_aura::Config for Runtime {
370370
type AuthorityId = AuraId;
371371
type DisabledValidators = ();
372372
type MaxAuthorities = ConstU32<100_000>;
373+
type SlotDuration = ConstU64<SLOT_DURATION>;
373374
}
374375

375376
impl cumulus_pallet_aura_ext::Config for Runtime {}

integration-tests/emulated/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ version = { workspace = true }
1212

1313
[dependencies]
1414
asset-hub-rococo-emulated-chain = { workspace = true, default-features = true }
15-
asset-hub-rococo-runtime = { workspace = true, default-features = true }
15+
asset-hub-rococo-runtime = { workspace = true, default-features = true, features = ["experimental"] }
1616
attestation = { workspace = true, default-features = true }
1717
ctype = { workspace = true, default-features = true }
1818
cumulus-primitives-core = { workspace = true, default-features = true }

logs.txt

Lines changed: 1091 additions & 0 deletions
Large diffs are not rendered by default.

pallets/attestation/src/mock.rs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub(crate) mod runtime {
193193
use ctype::{CtypeCreatorOf, CtypeEntryOf};
194194
use kilt_support::mock::{mock_origin, SubjectId};
195195

196-
use crate::{self as attestation, Event};
196+
use crate::{self as attestation};
197197

198198
type Block = frame_system::mocking::MockBlock<Test>;
199199

@@ -206,20 +206,6 @@ pub(crate) mod runtime {
206206
pub const MILLI_UNIT: Balance = 10u128.pow(12);
207207
pub const ATTESTATION_DEPOSIT: Balance = 10 * MILLI_UNIT;
208208

209-
pub(crate) fn events() -> Vec<Event<Test>> {
210-
System::events()
211-
.into_iter()
212-
.map(|r| r.event)
213-
.filter_map(|e| {
214-
if let RuntimeEvent::Attestation(e) = e {
215-
Some(e)
216-
} else {
217-
None
218-
}
219-
})
220-
.collect::<Vec<_>>()
221-
}
222-
223209
frame_support::construct_runtime!(
224210
pub enum Test
225211
{
@@ -246,7 +232,7 @@ pub(crate) mod runtime {
246232
type Lookup = IdentityLookup<Self::AccountId>;
247233
type Block = Block;
248234
type Nonce = u64;
249-
type RuntimeEvent = RuntimeEvent;
235+
type RuntimeEvent = ();
250236
type BlockHashCount = BlockHashCount;
251237
type DbWeight = RocksDbWeight;
252238
type Version = ();
@@ -279,7 +265,7 @@ pub(crate) mod runtime {
279265
type MaxFreezes = MaxFreezes;
280266
type Balance = Balance;
281267
type DustRemoval = ();
282-
type RuntimeEvent = RuntimeEvent;
268+
type RuntimeEvent = ();
283269
type ExistentialDeposit = ExistentialDeposit;
284270
type AccountStore = System;
285271
type WeightInfo = ();
@@ -297,7 +283,7 @@ pub(crate) mod runtime {
297283
type EnsureOrigin = mock_origin::EnsureDoubleOrigin<AccountId, Self::CtypeCreatorId>;
298284
type OriginSuccess = mock_origin::DoubleOrigin<AccountId, Self::CtypeCreatorId>;
299285
type OverarchingOrigin = EnsureSigned<AccountId>;
300-
type RuntimeEvent = RuntimeEvent;
286+
type RuntimeEvent = ();
301287
type WeightInfo = ();
302288

303289
type Currency = Balances;
@@ -319,7 +305,7 @@ pub(crate) mod runtime {
319305
impl Config for Test {
320306
type EnsureOrigin = mock_origin::EnsureDoubleOrigin<AccountId, AttesterOf<Self>>;
321307
type OriginSuccess = mock_origin::DoubleOrigin<AccountId, AttesterOf<Self>>;
322-
type RuntimeEvent = RuntimeEvent;
308+
type RuntimeEvent = ();
323309
type WeightInfo = ();
324310
type RuntimeHoldReason = RuntimeHoldReason;
325311
type Currency = Balances;
@@ -386,10 +372,6 @@ pub(crate) mod runtime {
386372
let mut ext = sp_io::TestExternalities::new(storage);
387373

388374
ext.execute_with(|| {
389-
// ensure that we are not at the genesis block. Events are not registered for
390-
// the genesis block.
391-
System::set_block_number(System::block_number() + 1);
392-
393375
for ctype in self.ctypes {
394376
ctype::Ctypes::<Test>::insert(
395377
ctype.0,

pallets/attestation/src/tests/claim.rs

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,35 @@ use frame_support::{assert_noop, assert_ok};
2121
use kilt_support::mock::mock_origin::DoubleOrigin;
2222
use sp_runtime::DispatchError;
2323

24-
use crate::{self as attestation, mock::*, AttestationAccessControl, AttesterOf, Config, Event};
24+
use crate::{self as attestation, mock::*, AttestationAccessControl, AttesterOf, Config};
2525

2626
#[test]
2727
fn test_attest_without_authorization() {
2828
let attester: AttesterOf<Test> = sr25519_did_from_public_key(&ALICE_SEED);
2929
let claim_hash = claim_hash_from_seed(CLAIM_HASH_SEED_01);
30-
let ctype = get_ctype_hash::<Test>(true);
30+
let ctype_hash = get_ctype_hash::<Test>(true);
3131
let authorization_info = None;
3232

3333
ExtBuilder::default()
34-
.with_ctypes(vec![(ctype, attester.clone())])
34+
.with_ctypes(vec![(ctype_hash, attester.clone())])
3535
.with_balances(vec![(ACCOUNT_00, <Test as Config>::Deposit::get() * 100)])
3636
.build_and_execute_with_sanity_tests(|| {
3737
assert_ok!(Attestation::add(
3838
DoubleOrigin(ACCOUNT_00, attester.clone()).into(),
3939
claim_hash,
40-
ctype,
40+
ctype_hash,
4141
authorization_info.clone()
4242
));
4343
let stored_attestation =
4444
Attestation::attestations(claim_hash).expect("Attestation should be present on chain.");
4545

46-
assert_eq!(stored_attestation.ctype_hash, ctype);
46+
assert_eq!(stored_attestation.ctype_hash, ctype_hash);
4747
assert_eq!(stored_attestation.attester, attester);
4848
assert_eq!(
4949
stored_attestation.authorization_id,
5050
authorization_info.map(|ac| ac.authorization_id())
5151
);
5252
assert!(!stored_attestation.revoked);
53-
assert_eq!(
54-
events(),
55-
vec![Event::AttestationCreated {
56-
attester: attester.clone(),
57-
claim_hash,
58-
ctype_hash: ctype,
59-
authorization: None
60-
}]
61-
);
6253
});
6354
}
6455

@@ -90,15 +81,6 @@ fn test_attest_authorized() {
9081
authorization_info.map(|ac| ac.authorization_id())
9182
);
9283
assert!(!stored_attestation.revoked);
93-
assert_eq!(
94-
events(),
95-
vec![Event::AttestationCreated {
96-
attester: attester.clone(),
97-
claim_hash,
98-
ctype_hash: ctype,
99-
authorization: Some(attester)
100-
}]
101-
);
10284
});
10385
}
10486

@@ -114,14 +96,14 @@ fn test_attest_unauthorized() {
11496
.with_ctypes(vec![(ctype, attester.clone())])
11597
.with_balances(vec![(ACCOUNT_00, <Test as Config>::Deposit::get() * 100)])
11698
.build_and_execute_with_sanity_tests(|| {
117-
assert_noop!(
99+
assert_eq!(
118100
Attestation::add(
119101
DoubleOrigin(ACCOUNT_00, attester.clone()).into(),
120102
claim_hash,
121103
ctype,
122104
authorization_info
123105
),
124-
DispatchError::Other("Unauthorized")
106+
Err(DispatchError::Other("Unauthorized"))
125107
);
126108
});
127109
}

pallets/attestation/src/tests/delete.rs

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ use frame_support::{assert_noop, assert_ok, traits::fungible::InspectHold};
2020
use kilt_support::mock::mock_origin::DoubleOrigin;
2121
use sp_runtime::traits::Zero;
2222

23-
use crate::{self as attestation, mock::*, AttesterOf, Config, Event, HoldReason};
23+
use crate::{self as attestation, mock::*, AttesterOf, Config, HoldReason};
2424

2525
#[test]
2626
fn test_remove() {
2727
let attester: AttesterOf<Test> = sr25519_did_from_public_key(&ALICE_SEED);
2828
let claim_hash = claim_hash_from_seed(CLAIM_HASH_SEED_01);
2929
let attestation = generate_base_attestation::<Test>(attester.clone(), ACCOUNT_00);
30-
let ctype_hash = attestation.ctype_hash;
30+
let authorization_info = None;
3131

3232
ExtBuilder::default()
3333
.with_balances(vec![(ACCOUNT_00, <Test as Config>::Deposit::get() * 100)])
@@ -37,57 +37,9 @@ fn test_remove() {
3737
assert_ok!(Attestation::remove(
3838
DoubleOrigin(ACCOUNT_00, attester.clone()).into(),
3939
claim_hash,
40-
None
41-
));
42-
assert!(Attestation::attestations(claim_hash).is_none());
43-
assert_eq!(
44-
events(),
45-
vec![
46-
Event::AttestationRevoked {
47-
attester: attester.clone(),
48-
claim_hash,
49-
authorized_by: attestation::authorized_by::AuthorizedBy::Attester(attester.clone()),
50-
ctype_hash,
51-
},
52-
Event::AttestationRemoved {
53-
attester: attester.clone(),
54-
claim_hash,
55-
authorized_by: attestation::authorized_by::AuthorizedBy::Attester(attester.clone()),
56-
ctype_hash,
57-
}
58-
]
59-
);
60-
});
61-
}
62-
63-
#[test]
64-
fn test_remove_revoked() {
65-
let attester: AttesterOf<Test> = sr25519_did_from_public_key(&ALICE_SEED);
66-
let claim_hash = claim_hash_from_seed(CLAIM_HASH_SEED_01);
67-
let mut attestation = generate_base_attestation::<Test>(attester.clone(), ACCOUNT_00);
68-
attestation.revoked = true;
69-
let ctype_hash = attestation.ctype_hash;
70-
71-
ExtBuilder::default()
72-
.with_balances(vec![(ACCOUNT_00, <Test as Config>::Deposit::get() * 100)])
73-
.with_ctypes(vec![(attestation.ctype_hash, attester.clone())])
74-
.with_attestations(vec![(claim_hash, attestation)])
75-
.build_and_execute_with_sanity_tests(|| {
76-
assert_ok!(Attestation::remove(
77-
DoubleOrigin(ACCOUNT_00, attester.clone()).into(),
78-
claim_hash,
79-
None
40+
authorization_info
8041
));
8142
assert!(Attestation::attestations(claim_hash).is_none());
82-
assert_eq!(
83-
events(),
84-
vec![Event::AttestationRemoved {
85-
attester: attester.clone(),
86-
claim_hash,
87-
ctype_hash,
88-
authorized_by: attestation::authorized_by::AuthorizedBy::Attester(attester.clone())
89-
}]
90-
);
9143
});
9244
}
9345

@@ -96,10 +48,9 @@ fn test_remove_authorized() {
9648
let attester: AttesterOf<Test> = sr25519_did_from_public_key(&ALICE_SEED);
9749
let revoker: AttesterOf<Test> = sr25519_did_from_public_key(&BOB_SEED);
9850
let claim_hash = claim_hash_from_seed(CLAIM_HASH_SEED_01);
99-
let mut attestation = generate_base_attestation::<Test>(attester.clone(), ACCOUNT_00);
51+
let mut attestation = generate_base_attestation::<Test>(attester, ACCOUNT_00);
10052
attestation.authorization_id = Some(revoker.clone());
10153
let authorization_info = Some(MockAccessControl(revoker.clone()));
102-
let ctype_hash = attestation.ctype_hash;
10354

10455
ExtBuilder::default()
10556
.with_balances(vec![(ACCOUNT_00, <Test as Config>::Deposit::get() * 100)])
@@ -113,23 +64,6 @@ fn test_remove_authorized() {
11364
));
11465
assert!(Attestation::attestations(claim_hash).is_none());
11566
assert!(!Attestation::external_attestations(revoker.clone(), claim_hash));
116-
assert_eq!(
117-
events(),
118-
vec![
119-
Event::AttestationRevoked {
120-
attester: attester.clone(),
121-
claim_hash,
122-
ctype_hash,
123-
authorized_by: attestation::authorized_by::AuthorizedBy::Authorization(revoker.clone())
124-
},
125-
Event::AttestationRemoved {
126-
attester: attester.clone(),
127-
claim_hash,
128-
ctype_hash,
129-
authorized_by: attestation::authorized_by::AuthorizedBy::Authorization(revoker.clone())
130-
}
131-
]
132-
);
13367
});
13468
}
13569

0 commit comments

Comments
 (0)