Skip to content

Commit

Permalink
Align with #1599
Browse files Browse the repository at this point in the history
  • Loading branch information
davxy committed Sep 19, 2023
1 parent 23ecf2c commit 53ffd81
Show file tree
Hide file tree
Showing 15 changed files with 584 additions and 246 deletions.
11 changes: 5 additions & 6 deletions Cargo.lock

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

15 changes: 14 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ members = [
"substrate/frame/root-testing",
"substrate/frame/safe-mode",
"substrate/frame/salary",
"substrate/frame/sassafras",
"substrate/frame/scheduler",
"substrate/frame/scored-pool",
"substrate/frame/sassafras",
"substrate/frame/session",
"substrate/frame/session/benchmarking",
"substrate/frame/society",
Expand Down Expand Up @@ -531,3 +531,16 @@ wasmi = { opt-level = 3 }
x25519-dalek = { opt-level = 3 }
yamux = { opt-level = 3 }
zeroize = { opt-level = 3 }

# [patch."https://github.com/w3f/ring-vrf"]
# bandersnatch_vrfs = { path = "../../w3f/ring-vrf/bandersnatch_vrfs" }

[patch."https://github.com/w3f/ring-proof"]
ring = { git = "https://github.com/davxy/ring-proof", branch = "davxy-patch" }
common = { git = "https://github.com/davxy/ring-proof", branch = "davxy-patch" }
# ring = { path = "../../w3f/ring-proof/ring" }
# common = { path = "../../w3f/ring-proof/common" }

[patch."https://github.com/w3f/fflonk"]
fflonk = { git = "https://github.com/davxy/fflonk", branch = "davxy-patch" }
# fflonk = { path = "../../w3f/fflonk" }
1 change: 1 addition & 0 deletions substrate/bin/node-sassafras/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
import_queue,
block_announce_validator_builder: None,
warp_sync_params: Some(WarpSyncParams::WithProvider(warp_sync)),
block_relay: None,
})?;

if config.offchain_worker.enabled {
Expand Down
54 changes: 27 additions & 27 deletions substrate/bin/node-sassafras/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,38 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }

pallet-sassafras = { version = "0.3.4-dev", default-features = false, path = "../../../frame/sassafras" }
pallet-balances = { version = "4.0.0-dev", default-features = false, path = "../../../frame/balances" }
pallet-session = { version = "4.0.0-dev", default-features = false, path = "../../../frame/session" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../../../frame/support" }
pallet-grandpa = { version = "4.0.0-dev", default-features = false, path = "../../../frame/grandpa" }
pallet-sudo = { version = "4.0.0-dev", default-features = false, path = "../../../frame/sudo" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../../frame/system" }
pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../../../frame/timestamp" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, path = "../../../frame/transaction-payment" }
frame-executive = { version = "4.0.0-dev", default-features = false, path = "../../../frame/executive" }
sp-api = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/api" }
sp-block-builder = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/block-builder"}
sp-consensus-sassafras = { version = "0.3.4-dev", default-features = false, path = "../../../primitives/consensus/sassafras" }
sp-core = { version = "21.0.0", default-features = false, path = "../../../primitives/core" }
sp-inherents = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/inherents"}
sp-offchain = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/offchain" }
sp-runtime = { version = "24.0.0", default-features = false, path = "../../../primitives/runtime" }
sp-session = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/session" }
sp-std = { version = "8.0.0", default-features = false, path = "../../../primitives/std" }
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" }
sp-version = { version = "22.0.0", default-features = false, path = "../../../primitives/version" }
pallet-sassafras = { path = "../../../frame/sassafras", default-features = false }
pallet-balances = { path = "../../../frame/balances", default-features = false }
pallet-session = { path = "../../../frame/session", default-features = false }
frame-support = { path = "../../../frame/support", default-features = false }
pallet-grandpa = { path = "../../../frame/grandpa", default-features = false }
pallet-sudo = { path = "../../../frame/sudo", default-features = false }
frame-system = { path = "../../../frame/system", default-features = false }
pallet-timestamp = { path = "../../../frame/timestamp", default-features = false }
pallet-transaction-payment = { path = "../../../frame/transaction-payment", default-features = false }
frame-executive = { path = "../../../frame/executive", default-features = false }
sp-api = { path = "../../../primitives/api", default-features = false }
sp-block-builder = { path = "../../../primitives/block-builder", default-features = false }
sp-consensus-sassafras = { path = "../../../primitives/consensus/sassafras", default-features = false }
sp-core = { path = "../../../primitives/core", default-features = false }
sp-inherents = { path = "../../../primitives/inherents", default-features = false }
sp-offchain = { path = "../../../primitives/offchain", default-features = false }
sp-runtime = { path = "../../../primitives/runtime", default-features = false }
sp-session = { path = "../../../primitives/session", default-features = false }
sp-std = { path = "../../../primitives/std", default-features = false }
sp-transaction-pool = { path = "../../../primitives/transaction-pool", default-features = false }
sp-version = { path = "../../../primitives/version", default-features = false }

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

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

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

[features]
default = ["std"]
Expand Down Expand Up @@ -88,4 +88,4 @@ runtime-benchmarks = [
"pallet-timestamp/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
use-session-pallet = []
use-session-pallet = ["pallet-sassafras/session-pallet-support"]
6 changes: 3 additions & 3 deletions substrate/bin/node-sassafras/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ impl pallet_sassafras::Config for Runtime {
type SlotDuration = ConstU64<SLOT_DURATION_IN_MILLISECONDS>;
type EpochDuration = ConstU64<EPOCH_DURATION_IN_SLOTS>;
type MaxAuthorities = ConstU32<MAX_AUTHORITIES>;
type MaxTickets = ConstU32<{ EPOCH_DURATION_IN_SLOTS as u32 }>;
type WeightInfo = ();
#[cfg(feature = "use-session-pallet")]
type EpochChangeTrigger = pallet_sassafras::ExternalTrigger;
type EpochChangeTrigger = pallet_sassafras::EpochChangeExternalTrigger;
#[cfg(not(feature = "use-session-pallet"))]
type EpochChangeTrigger = pallet_sassafras::SameAuthoritiesForever;
type EpochChangeTrigger = pallet_sassafras::EpochChangeInternalTrigger;
}

impl pallet_grandpa::Config for Runtime {
Expand Down
27 changes: 13 additions & 14 deletions substrate/frame/sassafras/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-sassafras"
version = "0.3.4-dev"
version = "0.3.5-dev"
authors = ["Parity Technologies <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand All @@ -16,32 +16,30 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
scale-codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }
frame-benchmarking = { path = "../benchmarking", default-features = false, optional = true }
frame-support = { path = "../support", default-features = false }
frame-system = { path = "../system", default-features = false }
log = { version = "0.4.17", default-features = false }
pallet-session = { version = "4.0.0-dev", default-features = false, path = "../session" }
pallet-timestamp = { version = "4.0.0-dev", default-features = false, path = "../timestamp" }
sp-consensus-sassafras = { version = "0.3.4-dev", default-features = false, path = "../../primitives/consensus/sassafras", features = ["serde"] }
sp-io = { version = "23.0.0", default-features = false, path = "../../primitives/io" }
sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime" }
sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" }
pallet-session = { path = "../session", default-features = false, optional = true }
sp-consensus-sassafras = { path = "../../primitives/consensus/sassafras", default-features = false, features = ["serde"] }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }

[dev-dependencies]
array-bytes = "6.1"
sp-core = { version = "21.0.0", path = "../../primitives/core" }
env_logger = "0.10"
sp-core = { path = "../../primitives/core" }

[features]
default = ["std"]
std = [
"scale-codec/std",
"frame-benchmarking/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"log/std",
"pallet-session/std",
"pallet-timestamp/std",
"pallet-session?/std",
"scale-info/std",
"sp-consensus-sassafras/std",
"sp-io/std",
Expand All @@ -50,3 +48,4 @@ std = [
]
runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"]
try-runtime = ["frame-support/try-runtime"]
session-pallet-support = ["pallet-session"]
13 changes: 1 addition & 12 deletions substrate/frame/sassafras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,4 @@ These structs were mostly extracted from the main SASSAFRAS protocol PR: https:/

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

## Protocol description

TODO

## References

* [w3f introduction](https://research.web3.foundation/en/latest/polkadot/block-production/SASSAFRAS.html):
a fairly friendly overview to the protocol building blocks;
* [research paper](https://github.com/w3f/research/tree/master/docs/papers/sass)
from Web3 foundation;
* [ring-vrg paper](https://github.com/w3f/ring-vrf/papers/ring_vrf)
from Web3 foundation;
Protocol RFC proposal: https://github.com/polkadot-fellows/RFCs/pull/26
Loading

0 comments on commit 53ffd81

Please sign in to comment.