Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
b72c7dd7
Commit
b72c7dd7
authored
3 months ago
by
bgallois
Committed by
Hugo Trentesaux
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
test refund by status
parent
c1cee127
No related branches found
No related tags found
1 merge request
!315
Allocate quota for membership instead of identity
Pipeline
#40161
passed
2 months ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Stage: deploy
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
runtime/gdev/tests/xt_tests.rs
+97
-0
97 additions, 0 deletions
runtime/gdev/tests/xt_tests.rs
with
97 additions
and
0 deletions
runtime/gdev/tests/xt_tests.rs
+
97
−
0
View file @
b72c7dd7
...
@@ -207,3 +207,100 @@ fn test_refund_reaped_linked_account() {
...
@@ -207,3 +207,100 @@ fn test_refund_reaped_linked_account() {
assert!
(
pallet_quota
::
RefundQueue
::
<
Runtime
>
::
get
()
.is_empty
());
assert!
(
pallet_quota
::
RefundQueue
::
<
Runtime
>
::
get
()
.is_empty
());
})
})
}
}
/// test no refund on_idle when account is not a member
#[test]
fn
test_no_member_no_refund
()
{
ExtBuilder
::
new
(
1
,
3
,
4
)
.with_initial_balances
(
vec!
[
(
AccountKeyring
::
Alice
.to_account_id
(),
10_000
),
(
AccountKeyring
::
Bob
.to_account_id
(),
10_000
),
])
.build
()
.execute_with
(||
{
// Revoked identities are not eligible for a refund
let
revocation_payload
=
pallet_identity
::
RevocationPayload
{
idty_index
:
2u32
,
genesis_hash
:
System
::
block_hash
(
0
),
};
let
signature
=
AccountKeyring
::
Bob
.sign
(
&
(
pallet_identity
::
REVOCATION_PAYLOAD_PREFIX
,
revocation_payload
,
)
.encode
(),
);
assert_ok!
(
Identity
::
revoke_identity
(
RuntimeOrigin
::
signed
(
AccountKeyring
::
Bob
.to_account_id
()),
2
,
AccountKeyring
::
Bob
.to_account_id
(),
signature
.into
()
));
assert_eq!
(
pallet_identity
::
Identities
::
<
Runtime
>
::
get
(
&
2
)
.unwrap
()
.status
,
pallet_identity
::
IdtyStatus
::
Revoked
);
let
call
=
RuntimeCall
::
Balances
(
BalancesCall
::
transfer_allow_death
{
dest
:
AccountKeyring
::
Ferdie
.to_account_id
()
.into
(),
value
:
500
,
});
let
xt
=
get_unchecked_extrinsic
(
call
,
4u64
,
8u64
,
AccountKeyring
::
Bob
,
0u64
,
0
);
assert_ok!
(
Executive
::
apply_extrinsic
(
xt
));
assert!
(
pallet_quota
::
RefundQueue
::
<
Runtime
>
::
get
()
.is_empty
());
// Unconfirmed identities are not eligible for a refund
assert_ok!
(
Identity
::
create_identity
(
RuntimeOrigin
::
signed
(
AccountKeyring
::
Alice
.to_account_id
()),
AccountKeyring
::
Ferdie
.to_account_id
(),
));
assert_eq!
(
pallet_identity
::
Identities
::
<
Runtime
>
::
get
(
&
5
)
.unwrap
()
.status
,
pallet_identity
::
IdtyStatus
::
Unconfirmed
);
let
call
=
RuntimeCall
::
Balances
(
BalancesCall
::
transfer_allow_death
{
dest
:
AccountKeyring
::
Alice
.to_account_id
()
.into
(),
value
:
500
,
});
let
xt
=
get_unchecked_extrinsic
(
call
.clone
(),
4u64
,
8u64
,
AccountKeyring
::
Ferdie
,
0u64
,
0
);
assert_ok!
(
Executive
::
apply_extrinsic
(
xt
));
assert!
(
pallet_quota
::
RefundQueue
::
<
Runtime
>
::
get
()
.is_empty
());
// Unvalidated identities are not eligible for a refund
assert_ok!
(
Identity
::
confirm_identity
(
RuntimeOrigin
::
signed
(
AccountKeyring
::
Ferdie
.to_account_id
()),
"ferdie"
.into
(),
));
assert_eq!
(
pallet_identity
::
Identities
::
<
Runtime
>
::
get
(
&
5
)
.unwrap
()
.status
,
pallet_identity
::
IdtyStatus
::
Unvalidated
);
let
xt
=
get_unchecked_extrinsic
(
call
.clone
(),
4u64
,
8u64
,
AccountKeyring
::
Ferdie
,
0u64
,
1
);
assert_ok!
(
Executive
::
apply_extrinsic
(
xt
));
assert!
(
pallet_quota
::
RefundQueue
::
<
Runtime
>
::
get
()
.is_empty
());
// NotMember identities are not eligible for a refund
pallet_identity
::
Pallet
::
<
Runtime
>
::
membership_removed
(
1
);
assert_eq!
(
pallet_identity
::
Identities
::
<
Runtime
>
::
get
(
&
1
)
.unwrap
()
.status
,
pallet_identity
::
IdtyStatus
::
NotMember
);
let
call
=
RuntimeCall
::
Balances
(
BalancesCall
::
transfer_allow_death
{
dest
:
AccountKeyring
::
Bob
.to_account_id
()
.into
(),
value
:
500
,
});
let
xt
=
get_unchecked_extrinsic
(
call
.clone
(),
4u64
,
8u64
,
AccountKeyring
::
Alice
,
0u64
,
0
);
assert_ok!
(
Executive
::
apply_extrinsic
(
xt
));
assert!
(
pallet_quota
::
RefundQueue
::
<
Runtime
>
::
get
()
.is_empty
());
})
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment