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
bb792af2
Unverified
Commit
bb792af2
authored
1 year ago
by
Gavin Wood
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Preimage: Check that at least one is upgraded (#1648)
Sanity check.
parent
1517eb8d
Branches
gh-readonly-queue/master/pr-2944-9543d31474195b5f384e298299a483d460f37fe7
Branches containing commit
No related merge requests found
Pipeline
#392497
passed with stages
in 50 minutes and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
substrate/frame/preimage/src/benchmarking.rs
+1
-1
1 addition, 1 deletion
substrate/frame/preimage/src/benchmarking.rs
substrate/frame/preimage/src/lib.rs
+3
-0
3 additions, 0 deletions
substrate/frame/preimage/src/lib.rs
with
4 additions
and
1 deletion
substrate/frame/preimage/src/benchmarking.rs
+
1
−
1
View file @
bb792af2
...
...
@@ -216,7 +216,7 @@ benchmarks! {
}
ensure_updated
{
let
n
in
0
..
MAX_HASH_UPGRADE_BULK_COUNT
;
let
n
in
1
..
MAX_HASH_UPGRADE_BULK_COUNT
;
let
caller
=
funded_account
::
<
T
>
();
let
hashes
=
(
0
..
n
)
.map
(|
i
|
insert_old_unrequested
::
<
T
>
(
i
))
.collect
::
<
Vec
<
_
>>
();
...
...
This diff is collapsed.
Click to expand it.
substrate/frame/preimage/src/lib.rs
+
3
−
0
View file @
bb792af2
...
...
@@ -156,6 +156,8 @@ pub mod pallet {
NotRequested
,
/// More than `MAX_HASH_UPGRADE_BULK_COUNT` hashes were requested to be upgraded at once.
TooMany
,
/// Too few hashes were requested to be upgraded (i.e. zero).
TooFew
,
}
/// A reason for this pallet placing a hold on funds.
...
...
@@ -242,6 +244,7 @@ pub mod pallet {
hashes
:
Vec
<
T
::
Hash
>
,
)
->
DispatchResultWithPostInfo
{
ensure_signed
(
origin
)
?
;
ensure!
(
hashes
.len
()
>
0
,
Error
::
<
T
>
::
TooFew
);
ensure!
(
hashes
.len
()
<=
MAX_HASH_UPGRADE_BULK_COUNT
as
usize
,
Error
::
<
T
>
::
TooMany
);
let
updated
=
hashes
.iter
()
.map
(
Self
::
do_ensure_updated
)
.filter
(|
b
|
*
b
)
.count
()
as
u32
;
...
...
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