Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
80f98b1
split off system randomness functions into a new module
Sep 26, 2019
b6dbab6
bump spec and impl version
Sep 27, 2019
5c59f76
Move randomness to bottom of construct_runtime calls, move initializa…
Sep 27, 2019
81d082f
Update srml/randomness/Cargo.toml
expenses Sep 27, 2019
fb41b38
Update srml/randomness/src/lib.rs
expenses Sep 27, 2019
6fafe55
Update srml/randomness/src/lib.rs
expenses Sep 27, 2019
8755b97
Update srml/randomness/Cargo.toml
expenses Sep 27, 2019
12158e3
Improve system example
expenses Sep 27, 2019
2bbc03a
Merge branch 'master' into randomness-module
expenses Sep 27, 2019
71bf01c
Merge branch 'randomness-module' of https://github.com/expenses/subst…
expenses Sep 27, 2019
394ad49
Update Cargo.lock
expenses Sep 27, 2019
664fc3c
Fix randomness example
expenses Sep 27, 2019
e3761d2
Get rid of the stored index
expenses Sep 27, 2019
907a29a
Add tests
expenses Sep 27, 2019
d98c7db
Add a random test
expenses Sep 27, 2019
64e3c22
Merge branch 'master' into randomness-module
expenses Sep 29, 2019
908d00f
Improve docs
expenses Sep 29, 2019
15011d1
Merge branch 'randomness-module' of https://github.com/expenses/subst…
expenses Sep 29, 2019
fb96026
Fix executive test :^)
expenses Sep 29, 2019
bc15acc
Add a utility function to tests
expenses Sep 29, 2019
f7e4d4d
Update srml/randomness/Cargo.toml
expenses Oct 1, 2019
8c8f70b
Update srml/randomness/src/lib.rs
expenses Oct 1, 2019
b71e627
Update srml/randomness/src/lib.rs
expenses Oct 2, 2019
44a3cc1
Merge branch 'master' into randomness-module
expenses Oct 2, 2019
d491ac8
Change interpretation of block numbers
expenses Oct 2, 2019
23b29af
Merge branch 'master' into randomness-module
expenses Oct 6, 2019
bb84094
rename crate
expenses Oct 7, 2019
3a28382
Merge branch 'randomness-module' of https://github.com/expenses/subst…
expenses Oct 7, 2019
742b3db
refactor randomess module usage
expenses Oct 7, 2019
8388726
Merge branch 'master' of https://github.com/paritytech/substrate into…
expenses Oct 7, 2019
b5cd993
change random material len to a const
expenses Oct 8, 2019
0db8a8b
Update srml/randomness-collective-flip/src/lib.rs
expenses Oct 8, 2019
6a88d62
Update srml/randomness-collective-flip/src/lib.rs
expenses Oct 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ members = [
"srml/membership",
"srml/metadata",
"srml/offences",
"srml/randomness-collective-flip",
"srml/scored-pool",
"srml/session",
"srml/staking",
Expand Down
2 changes: 2 additions & 0 deletions node-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ babe-primitives = { package = "substrate-consensus-babe-primitives", path = "../
executive = { package = "srml-executive", path = "../../srml/executive", default_features = false }
indices = { package = "srml-indices", path = "../../srml/indices", default_features = false }
grandpa = { package = "srml-grandpa", path = "../../srml/grandpa", default-features = false }
randomness-collective-flip = { package = "srml-randomness-collective-flip", path = "../../srml/randomness-collective-flip", default_features = false }
system = { package = "srml-system", path = "../../srml/system", default_features = false }
timestamp = { package = "srml-timestamp", path = "../../srml/timestamp", default_features = false }
sudo = { package = "srml-sudo", path = "../../srml/sudo", default_features = false }
Expand All @@ -46,6 +47,7 @@ std = [
"grandpa/std",
"primitives/std",
"sr-primitives/std",
"randomness-collective-flip/std",
"system/std",
"timestamp/std",
"sudo/std",
Expand Down
3 changes: 2 additions & 1 deletion node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ construct_runtime!(
Sudo: sudo,
// Used for the module template in `./template.rs`
TemplateModule: template::{Module, Call, Storage, Event<T>},
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
}
);

Expand Down Expand Up @@ -340,7 +341,7 @@ impl_runtime_apis! {
}

fn random_seed() -> <Block as BlockT>::Hash {
System::random_seed()
RandomnessCollectiveFlip::random_seed()
}
}

Expand Down
2 changes: 2 additions & 0 deletions node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ im-online = { package = "srml-im-online", path = "../../srml/im-online", default
indices = { package = "srml-indices", path = "../../srml/indices", default-features = false }
membership = { package = "srml-membership", path = "../../srml/membership", default-features = false }
offences = { package = "srml-offences", path = "../../srml/offences", default-features = false }
randomness-collective-flip = { package = "srml-randomness-collective-flip", path = "../../srml/randomness-collective-flip", default-features = false }
session = { package = "srml-session", path = "../../srml/session", default-features = false, features = ["historical"] }
staking = { package = "srml-staking", path = "../../srml/staking", default-features = false }
srml-staking-reward-curve = { path = "../../srml/staking/reward-curve"}
Expand Down Expand Up @@ -78,6 +79,7 @@ std = [
"offchain-primitives/std",
"offences/std",
"primitives/std",
"randomness-collective-flip/std",
"rstd/std",
"rustc-hex",
"safe-mix/std",
Expand Down
7 changes: 4 additions & 3 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 172,
impl_version: 172,
spec_version: 173,
impl_version: 173,
apis: RUNTIME_API_VERSIONS,
};

Expand Down Expand Up @@ -518,6 +518,7 @@ construct_runtime!(
ImOnline: im_online::{Module, Call, Storage, Event<T>, ValidateUnsigned, Config<T>},
AuthorityDiscovery: authority_discovery::{Module, Call, Config<T>},
Offences: offences::{Module, Call, Storage, Event},
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
}
);

Expand Down Expand Up @@ -589,7 +590,7 @@ impl_runtime_apis! {
}

fn random_seed() -> <Block as BlockT>::Hash {
System::random_seed()
RandomnessCollectiveFlip::random_seed()
}
}

Expand Down
3 changes: 3 additions & 0 deletions srml/contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ rstd = { package = "sr-std", path = "../../core/sr-std", default-features = fals
sandbox = { package = "sr-sandbox", path = "../../core/sr-sandbox", default-features = false }
support = { package = "srml-support", path = "../support", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
randomness-collective-flip = { package = "srml-randomness-collective-flip", path = "../randomness-collective-flip", default-features = false }
timestamp = { package = "srml-timestamp", path = "../timestamp", default-features = false }

[dev-dependencies]
wabt = "0.9.2"
Expand All @@ -33,6 +35,7 @@ std = [
"codec/std",
"primitives/std",
"sr-primitives/std",
"randomness-collective-flip/std",
"runtime-io/std",
"rstd/std",
"sandbox/std",
Expand Down
2 changes: 1 addition & 1 deletion srml/contracts/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ where
}

fn random(&self, subject: &[u8]) -> SeedOf<T> {
system::Module::<T>::random(subject)
randomness_collective_flip::Module::<T>::random(subject)
}

fn now(&self) -> &MomentOf<T> {
Expand Down
2 changes: 1 addition & 1 deletion srml/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ mod tests {
header: Header {
parent_hash: [69u8; 32].into(),
number: 1,
state_root: hex!("3e51b47b6cc8449eece93eee4b01f03b00a0ca7981c0b6c0447b6e0d50ca886d").into(),
state_root: hex!("a6378d7fdd31029d13718d54bdff10a370e75cc624aaf94a90e7e7d4a24e0bcc").into(),
extrinsics_root: hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into(),
digest: Digest { logs: vec![], },
},
Expand Down
28 changes: 28 additions & 0 deletions srml/randomness-collective-flip/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "srml-randomness-collective-flip"
version = "2.0.0"
authors = ["Parity Technologies <[email protected]>"]
edition = "2018"

[dependencies]
safe-mix = { version = "1.0", default-features = false }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
sr-primitives = { path = "../../core/sr-primitives", default-features = false }
support = { package = "srml-support", path = "../support", default-features = false }
system = { package = "srml-system", path = "../system", default-features = false }
rstd = { package = "sr-std", path = "../../core/sr-std", default-features = false }

[dev-dependencies]
primitives = { package = "substrate-primitives", path = "../../core/primitives" }
runtime-io = { package = "sr-io", path = "../../core/sr-io" }

[features]
default = ["std"]
std = [
"safe-mix/std",
"system/std",
"codec/std",
"support/std",
"sr-primitives/std",
"rstd/std",
]
Loading