Skip to content

Commit 53ffd81

Browse files
committed
Align with #1599
1 parent 23ecf2c commit 53ffd81

File tree

15 files changed

+584
-246
lines changed

15 files changed

+584
-246
lines changed

Cargo.lock

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ members = [
333333
"substrate/frame/root-testing",
334334
"substrate/frame/safe-mode",
335335
"substrate/frame/salary",
336+
"substrate/frame/sassafras",
336337
"substrate/frame/scheduler",
337338
"substrate/frame/scored-pool",
338-
"substrate/frame/sassafras",
339339
"substrate/frame/session",
340340
"substrate/frame/session/benchmarking",
341341
"substrate/frame/society",
@@ -531,3 +531,16 @@ wasmi = { opt-level = 3 }
531531
x25519-dalek = { opt-level = 3 }
532532
yamux = { opt-level = 3 }
533533
zeroize = { opt-level = 3 }
534+
535+
# [patch."https://github.com/w3f/ring-vrf"]
536+
# bandersnatch_vrfs = { path = "../../w3f/ring-vrf/bandersnatch_vrfs" }
537+
538+
[patch."https://github.com/w3f/ring-proof"]
539+
ring = { git = "https://github.com/davxy/ring-proof", branch = "davxy-patch" }
540+
common = { git = "https://github.com/davxy/ring-proof", branch = "davxy-patch" }
541+
# ring = { path = "../../w3f/ring-proof/ring" }
542+
# common = { path = "../../w3f/ring-proof/common" }
543+
544+
[patch."https://github.com/w3f/fflonk"]
545+
fflonk = { git = "https://github.com/davxy/fflonk", branch = "davxy-patch" }
546+
# fflonk = { path = "../../w3f/fflonk" }

substrate/bin/node-sassafras/node/src/service.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
185185
import_queue,
186186
block_announce_validator_builder: None,
187187
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
188+
block_relay: None,
188189
})?;
189190

190191
if config.offchain_worker.enabled {

substrate/bin/node-sassafras/runtime/Cargo.toml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,38 @@ targets = ["x86_64-unknown-linux-gnu"]
1515
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
1616
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
1717

18-
pallet-sassafras = { version = "0.3.4-dev", default-features = false, path = "../../../frame/sassafras" }
19-
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../../frame/balances" }
20-
pallet-session = { version = "4.0.0-dev", default-features = false, path = "../../../frame/session" }
21-
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../../frame/support" }
22-
pallet-grandpa = { version = "4.0.0-dev", default-features = false, path = "../../../frame/grandpa" }
23-
pallet-sudo = { version = "4.0.0-dev", default-features = false, path = "../../../frame/sudo" }
24-
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../frame/system" }
25-
pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../../../frame/timestamp" }
26-
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-payment" }
27-
frame-executive = { version = "4.0.0-dev", default-features = false, path = "../../../frame/executive" }
28-
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/api" }
29-
sp-block-builder = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/block-builder"}
30-
sp-consensus-sassafras = { version = "0.3.4-dev", default-features = false, path = "../../../primitives/consensus/sassafras" }
31-
sp-core = { version = "21.0.0", default-features = false, path = "../../../primitives/core" }
32-
sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/inherents"}
33-
sp-offchain = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/offchain" }
34-
sp-runtime = { version = "24.0.0", default-features = false, path = "../../../primitives/runtime" }
35-
sp-session = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/session" }
36-
sp-std = { version = "8.0.0", default-features = false, path = "../../../primitives/std" }
37-
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" }
38-
sp-version = { version = "22.0.0", default-features = false, path = "../../../primitives/version" }
18+
pallet-sassafras = { path = "../../../frame/sassafras", default-features = false }
19+
pallet-balances = { path = "../../../frame/balances", default-features = false }
20+
pallet-session = { path = "../../../frame/session", default-features = false }
21+
frame-support = { path = "../../../frame/support", default-features = false }
22+
pallet-grandpa = { path = "../../../frame/grandpa", default-features = false }
23+
pallet-sudo = { path = "../../../frame/sudo", default-features = false }
24+
frame-system = { path = "../../../frame/system", default-features = false }
25+
pallet-timestamp = { path = "../../../frame/timestamp", default-features = false }
26+
pallet-transaction-payment = { path = "../../../frame/transaction-payment", default-features = false }
27+
frame-executive = { path = "../../../frame/executive", default-features = false }
28+
sp-api = { path = "../../../primitives/api", default-features = false }
29+
sp-block-builder = { path = "../../../primitives/block-builder", default-features = false }
30+
sp-consensus-sassafras = { path = "../../../primitives/consensus/sassafras", default-features = false }
31+
sp-core = { path = "../../../primitives/core", default-features = false }
32+
sp-inherents = { path = "../../../primitives/inherents", default-features = false }
33+
sp-offchain = { path = "../../../primitives/offchain", default-features = false }
34+
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
35+
sp-session = { path = "../../../primitives/session", default-features = false }
36+
sp-std = { path = "../../../primitives/std", default-features = false }
37+
sp-transaction-pool = { path = "../../../primitives/transaction-pool", default-features = false }
38+
sp-version = { path = "../../../primitives/version", default-features = false }
3939

4040
# Used for the node template's RPCs
41-
frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, path = "../../../frame/system/rpc/runtime-api/" }
42-
pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-payment/rpc/runtime-api/" }
41+
frame-system-rpc-runtime-api = { path = "../../../frame/system/rpc/runtime-api/", default-features = false }
42+
pallet-transaction-payment-rpc-runtime-api = { path = "../../../frame/transaction-payment/rpc/runtime-api/", default-features = false }
4343

4444
# Used for runtime benchmarking
45-
frame-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../../frame/benchmarking", optional = true }
46-
frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, path = "../../../frame/system/benchmarking", optional = true }
45+
frame-benchmarking = { path = "../../../frame/benchmarking", optional = true, default-features = false }
46+
frame-system-benchmarking = { path = "../../../frame/system/benchmarking", optional = true, default-features = false }
4747

4848
[build-dependencies]
49-
substrate-wasm-builder = { version = "5.0.0-dev", path = "../../../utils/wasm-builder" }
49+
substrate-wasm-builder = { path = "../../../utils/wasm-builder" }
5050

5151
[features]
5252
default = ["std"]
@@ -88,4 +88,4 @@ runtime-benchmarks = [
8888
"pallet-timestamp/runtime-benchmarks",
8989
"sp-runtime/runtime-benchmarks",
9090
]
91-
use-session-pallet = []
91+
use-session-pallet = ["pallet-sassafras/session-pallet-support"]

substrate/bin/node-sassafras/runtime/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ impl pallet_sassafras::Config for Runtime {
199199
type SlotDuration = ConstU64<SLOT_DURATION_IN_MILLISECONDS>;
200200
type EpochDuration = ConstU64<EPOCH_DURATION_IN_SLOTS>;
201201
type MaxAuthorities = ConstU32<MAX_AUTHORITIES>;
202-
type MaxTickets = ConstU32<{ EPOCH_DURATION_IN_SLOTS as u32 }>;
202+
type WeightInfo = ();
203203
#[cfg(feature = "use-session-pallet")]
204-
type EpochChangeTrigger = pallet_sassafras::ExternalTrigger;
204+
type EpochChangeTrigger = pallet_sassafras::EpochChangeExternalTrigger;
205205
#[cfg(not(feature = "use-session-pallet"))]
206-
type EpochChangeTrigger = pallet_sassafras::SameAuthoritiesForever;
206+
type EpochChangeTrigger = pallet_sassafras::EpochChangeInternalTrigger;
207207
}
208208

209209
impl pallet_grandpa::Config for Runtime {

substrate/frame/sassafras/Cargo.toml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pallet-sassafras"
3-
version = "0.3.4-dev"
3+
version = "0.3.5-dev"
44
authors = ["Parity Technologies <[email protected]>"]
55
edition = "2021"
66
license = "Apache-2.0"
@@ -16,32 +16,30 @@ targets = ["x86_64-unknown-linux-gnu"]
1616
[dependencies]
1717
scale-codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
1818
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
19-
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
20-
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
21-
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
19+
frame-benchmarking = { path = "../benchmarking", default-features = false, optional = true }
20+
frame-support = { path = "../support", default-features = false }
21+
frame-system = { path = "../system", default-features = false }
2222
log = { version = "0.4.17", default-features = false }
23-
pallet-session = { version = "4.0.0-dev", default-features = false, path = "../session" }
24-
pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../timestamp" }
25-
sp-consensus-sassafras = { version = "0.3.4-dev", default-features = false, path = "../../primitives/consensus/sassafras", features = ["serde"] }
26-
sp-io = { version = "23.0.0", default-features = false, path = "../../primitives/io" }
27-
sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime" }
28-
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
23+
pallet-session = { path = "../session", default-features = false, optional = true }
24+
sp-consensus-sassafras = { path = "../../primitives/consensus/sassafras", default-features = false, features = ["serde"] }
25+
sp-io = { path = "../../primitives/io", default-features = false }
26+
sp-runtime = { path = "../../primitives/runtime", default-features = false }
27+
sp-std = { path = "../../primitives/std", default-features = false }
2928

3029
[dev-dependencies]
3130
array-bytes = "6.1"
32-
sp-core = { version = "21.0.0", path = "../../primitives/core" }
3331
env_logger = "0.10"
32+
sp-core = { path = "../../primitives/core" }
3433

3534
[features]
3635
default = ["std"]
3736
std = [
3837
"scale-codec/std",
39-
"frame-benchmarking/std",
38+
"frame-benchmarking?/std",
4039
"frame-support/std",
4140
"frame-system/std",
4241
"log/std",
43-
"pallet-session/std",
44-
"pallet-timestamp/std",
42+
"pallet-session?/std",
4543
"scale-info/std",
4644
"sp-consensus-sassafras/std",
4745
"sp-io/std",
@@ -50,3 +48,4 @@ std = [
5048
]
5149
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
5250
try-runtime = ["frame-support/try-runtime"]
51+
session-pallet-support = ["pallet-session"]

substrate/frame/sassafras/README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,4 @@ These structs were mostly extracted from the main SASSAFRAS protocol PR: https:/
1111

1212
Tracking issue: https://github.com/paritytech/polkadot-sdk/issues/41
1313

14-
## Protocol description
15-
16-
TODO
17-
18-
## References
19-
20-
* [w3f introduction](https://research.web3.foundation/en/latest/polkadot/block-production/SASSAFRAS.html):
21-
a fairly friendly overview to the protocol building blocks;
22-
* [research paper](https://github.com/w3f/research/tree/master/docs/papers/sass)
23-
from Web3 foundation;
24-
* [ring-vrg paper](https://github.com/w3f/ring-vrf/papers/ring_vrf)
25-
from Web3 foundation;
14+
Protocol RFC proposal: https://github.com/polkadot-fellows/RFCs/pull/26

0 commit comments

Comments
 (0)