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
7149f764
Commit
7149f764
authored
4 years ago
by
André Silva
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
rococo: use insecure parent hash randomness (#2701)
parent
bfbb0785
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
polkadot/runtime/rococo/src/lib.rs
+10
-14
10 additions, 14 deletions
polkadot/runtime/rococo/src/lib.rs
with
10 additions
and
14 deletions
polkadot/runtime/rococo/src/lib.rs
+
10
−
14
View file @
7149f764
...
...
@@ -612,21 +612,17 @@ impl paras_registrar::Config for Runtime {
type
WeightInfo
=
paras_registrar
::
TestWeightInfo
;
}
// A wrapper around `babe::CurrentBlockRandomness` that does not return `Option<Random>`.
pub
struct
CurrentBlockRandomness
;
/// An insecure randomness beacon that uses the parent block hash as random material.
///
/// THIS SHOULD ONLY BE USED FOR TESTING PURPOSES.
pub
struct
ParentHashRandomness
;
impl
Randomness
<
Hash
,
BlockNumber
>
for
Cur
rent
Block
Randomness
{
impl
Randomness
<
Hash
,
BlockNumber
>
for
Pa
rent
Hash
Randomness
{
fn
random
(
subject
:
&
[
u8
])
->
(
Hash
,
BlockNumber
)
{
let
(
randomness
,
block_number
)
=
pallet_babe
::
CurrentBlockRandomness
::
<
Runtime
>
::
random
(
subject
);
let
randomness
=
randomness
.expect
(
"only returns None when secondary VRF slots are not enabled;
\
secondary VRF slots are enbaled for rococo runtime;
\
qed."
,
);
(
randomness
,
block_number
)
(
(
System
::
parent_hash
(),
subject
)
.using_encoded
(
sp_io
::
hashing
::
blake2_256
)
.into
(),
System
::
block_number
(),
)
}
}
...
...
@@ -640,7 +636,7 @@ impl auctions::Config for Runtime {
type
Leaser
=
Slots
;
type
EndingPeriod
=
EndingPeriod
;
type
SampleLength
=
SampleLength
;
type
Randomness
=
Cur
rent
Block
Randomness
;
type
Randomness
=
Pa
rent
Hash
Randomness
;
type
InitiateOrigin
=
EnsureRoot
<
AccountId
>
;
type
WeightInfo
=
auctions
::
TestWeightInfo
;
}
...
...
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