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
1e1d9cd1
Unverified
Commit
1e1d9cd1
authored
1 year ago
by
bgallois
Browse files
Options
Downloads
Patches
Plain Diff
tmp
parent
bfdfaa5d
No related branches found
No related tags found
No related merge requests found
Pipeline
#34132
failed
1 year ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Stage: deploy
This commit is part of merge request
!190
. Comments created here will be created in the context of that merge request.
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pallets/quota/src/benchmarking.rs
+29
-5
29 additions, 5 deletions
pallets/quota/src/benchmarking.rs
with
29 additions
and
5 deletions
pallets/quota/src/benchmarking.rs
+
29
−
5
Edit
View file @
1e1d9cd1
...
...
@@ -34,17 +34,41 @@ benchmarks! {
}
queue_refund
{
let
account
:
T
::
AccountId
=
account
(
"Alice"
,
1
,
1
);
let
dummy_refund
=
Refund
{
account
:
account
.clone
(),
identity
:
0u32
.into
(),
amount
:
20u64
.into
(),
};
let
refund
=
Refund
{
account
,
identity
:
1u32
.into
(),
amount
:
10u64
.into
(),
};
}:
{
Pallet
::
<
T
>
::
queue_refund
(
refund
)
}
// Complexity is bound to MAX_QUEUD_REFUNDS where an insertion is O(n-1)
for
i
in
0
..
MAX_QUEUED_REFUNDS
-
1
{
Pallet
::
<
T
>
::
queue_refund
(
dummy_refund
.clone
())
}
}:
{
Pallet
::
<
T
>
::
queue_refund
(
refund
.clone
())
}
verify
{
assert_eq!
(
RefundQueue
::
<
T
>
::
get
()
.last
(),
Some
(
refund
)
.as_ref
());
assert_eq!
(
RefundQueue
::
<
T
>
::
get
()
.len
()
as
u32
,
MAX_QUEUED_REFUNDS
);
}
spend_quota
{
let
idty_id
=
1u32
;
let
amount
=
1u64
;
let
idty_id
:
IdtyId
<
T
>
=
1u32
.into
();
let
amount
=
2u64
;
IdtyQuota
::
<
T
>
::
insert
(
idty_id
,
Quota
{
last_use
:
T
::
BlockNumber
::
zero
(),
amount
:
10u64
.into
(),
},
);
}:
{
Pallet
::
<
T
>
::
spend_quota
(
idty_id
.into
(),
amount
.into
())
}
try_refund
{
verify
{
// Initially 10, updated to 11, minus 2
assert_eq!
(
IdtyQuota
::
<
T
>
::
get
(
idty_id
)
.unwrap
()
.amount
,
9u64
.into
());
}
/*try_refund {
let account: T::AccountId = account("Alice", 1, 1);
let refund = Refund {
account,
...
...
@@ -60,5 +84,5 @@ benchmarks! {
amount: 10u64.into(),
};
let amount = 5u64.into();
}:
{
Pallet
::
<
T
>
::
do_refund
(
refund
,
amount
)
}
}: { Pallet::<T>::do_refund(refund, amount) }
*/
}
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