Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
Mirrored projects
polkadot-sdk
Commits
74ed6978
Commit
74ed6978
authored
5 years ago
by
Marcio Diaz
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix identity benchmark (#5229)
* Set identity before calling set_subs. * Remove -1.
parent
abb67d1e
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/frame/identity/src/benchmarking.rs
+8
-13
8 additions, 13 deletions
substrate/frame/identity/src/benchmarking.rs
with
8 additions
and
13 deletions
substrate/frame/identity/src/benchmarking.rs
+
8
−
13
View file @
74ed6978
...
...
@@ -62,6 +62,12 @@ fn add_sub_accounts<T: Trait>(who: T::AccountId, s: u32) -> Result<Vec<(T::Accou
let
sub_account
=
account
::
<
T
>
(
"sub"
,
i
);
subs
.push
((
sub_account
,
data
.clone
()));
}
// Set identity so `set_subs` does not fail.
let
_
=
T
::
Currency
::
make_free_balance_be
(
&
who
,
BalanceOf
::
<
T
>
::
max_value
());
let
info
=
create_identity_info
::
<
T
>
(
1
);
Identity
::
<
T
>
::
set_identity
(
who_origin
.clone
()
.into
(),
info
)
?
;
Identity
::
<
T
>
::
set_subs
(
who_origin
.into
(),
subs
.clone
())
?
;
return
Ok
(
subs
)
...
...
@@ -147,19 +153,8 @@ benchmarks! {
let
caller
=
account
::
<
T
>
(
"caller"
,
0
);
let
caller_origin
:
<
T
as
frame_system
::
Trait
>
::
Origin
=
RawOrigin
::
Signed
(
caller
.clone
())
.into
();
let
_
=
T
::
Currency
::
make_free_balance_be
(
&
caller
,
BalanceOf
::
<
T
>
::
max_value
());
// Create their main identity
let
info
=
create_identity_info
::
<
T
>
(
1
);
Identity
::
<
T
>
::
set_identity
(
caller_origin
,
info
)
?
;
}:
_
(
RawOrigin
::
Signed
(
caller
),
{
let
mut
subs
=
Module
::
<
T
>
::
subs
(
&
caller
);
// Generic data to be used.
let
data
=
Data
::
Raw
(
vec!
[
0
;
32
]);
// Create an s+1 sub account to add
subs
.push
((
account
::
<
T
>
(
"sub"
,
s
+
1
),
data
));
subs
})
let
subs
=
Module
::
<
T
>
::
subs
(
&
caller
);
}:
_
(
RawOrigin
::
Signed
(
caller
),
subs
)
clear_identity
{
let
caller
=
account
::
<
T
>
(
"caller"
,
0
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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