Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
c5ee502
add drand
JohnReedV Nov 7, 2024
dc2ca17
bring in drand & configure runtime
JohnReedV Nov 7, 2024
be1c132
fmt
JohnReedV Nov 7, 2024
578fc29
successful drand pulse acquisitions
JohnReedV Nov 7, 2024
03c4413
bring drand deps into workspace
JohnReedV Nov 8, 2024
5d6b6c0
zepter & fmt
JohnReedV Nov 8, 2024
3d2e5f5
remove "expect()" in offchain worker
JohnReedV Nov 8, 2024
656f0a6
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 8, 2024
c213d2c
etf crypto
orriin Nov 12, 2024
5c664c0
drand mainnet
JohnReedV Nov 12, 2024
f3c7150
tune down logs
JohnReedV Nov 12, 2024
a79e7d1
adhere to lints
JohnReedV Nov 12, 2024
bf5cf12
fix tests
JohnReedV Nov 12, 2024
bd286e8
fix most clippy
JohnReedV Nov 12, 2024
797a6a7
use quicknet
JohnReedV Nov 13, 2024
0078ce4
remove warnings
JohnReedV Nov 13, 2024
feb0bda
stable quicknet
JohnReedV Nov 13, 2024
ccc3c31
update logging
JohnReedV Nov 14, 2024
241a4d4
decrease max pulses
JohnReedV Nov 14, 2024
d2b6e8e
update dep
JohnReedV Nov 14, 2024
93e38e9
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 14, 2024
b684810
fmt, clippy, bump spec
JohnReedV Nov 14, 2024
14daf26
use saturating math
JohnReedV Nov 14, 2024
676ad8c
wip crv3
orriin Nov 15, 2024
4ee5e06
Merge branch 'spiigot/add-pallet-drand' into commit-reveal-v3
orriin Nov 15, 2024
1323cc2
update doc comment
JohnReedV Nov 15, 2024
1bfe856
remove newpulse event & increase max pulses
JohnReedV Nov 15, 2024
6961db4
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 15, 2024
4926c1b
add node config again
JohnReedV Nov 15, 2024
41cfff9
crv3 implementation
orriin Nov 18, 2024
3224834
Merge branch 'spiigot/add-pallet-drand' into commit-reveal-v3
orriin Nov 18, 2024
bb16b28
clippy
orriin Nov 18, 2024
c8facf4
zepter
orriin Nov 18, 2024
7ea88f9
make setconfig require root call
JohnReedV Nov 19, 2024
64c52b7
fmt & clippy
JohnReedV Nov 19, 2024
51cb0ce
fmt & bump spec
JohnReedV Nov 19, 2024
47bd2dd
re-implement pairing comparison & address clippy
JohnReedV Nov 19, 2024
c4cfecb
re-order HostFunctions
JohnReedV Nov 19, 2024
40f220b
drand verifier bug fix
JohnReedV Nov 21, 2024
c92519e
remove mainnet feature
JohnReedV Nov 21, 2024
ddc51e5
merge
orriin Nov 21, 2024
46b512f
doc
orriin Nov 21, 2024
357fd6a
bring drand into mock runtimes
JohnReedV Nov 21, 2024
557da60
remove redundant comments
JohnReedV Nov 22, 2024
fbf06e0
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 22, 2024
6e2a4ad
Update chainspecs
JohnReedV Nov 22, 2024
2686215
add drand to benches
JohnReedV Nov 22, 2024
9bfc747
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 23, 2024
2fb43a7
Update chainspecs
JohnReedV Nov 23, 2024
b1401c2
fix tests
JohnReedV Nov 23, 2024
3d9e408
consider reveal epochs in crv3
JohnReedV Nov 23, 2024
bb11a7c
add hyperparam crv3 rate limit
JohnReedV Nov 23, 2024
318c244
move test
JohnReedV Nov 23, 2024
7492611
move imports
JohnReedV Nov 23, 2024
fdd4280
Merge pull request #1012 from opentensor/spiigot/drand-mock-runtimes
JohnReedV Nov 23, 2024
47df1b4
Merge branch 'spiigot/add-pallet-drand' into commit-reveal-v3
JohnReedV Nov 23, 2024
faa5d9b
Update chainspecs
JohnReedV Nov 23, 2024
1a59ba0
fmt & clippy
JohnReedV Nov 23, 2024
a123ad7
add hyperparam enable/disable crv3
JohnReedV Nov 23, 2024
5479995
Update chainspecs
JohnReedV Nov 24, 2024
3e4076d
add tests & fix bugs
JohnReedV Nov 26, 2024
a51741f
freeze struct WeightsTlockPayload
JohnReedV Nov 26, 2024
40b67df
zepter
JohnReedV Nov 26, 2024
08961fa
Update chainspecs
JohnReedV Nov 26, 2024
9d4dcb5
enable NewPulse event
JohnReedV Nov 26, 2024
2c4c109
Update chainspecs
JohnReedV Nov 26, 2024
aeeaad8
use commit-reveal-enabled
JohnReedV Nov 26, 2024
61d754b
fix bug and test
JohnReedV Nov 26, 2024
62ccf80
Merge branch 'commit-reveal-v3' of github.com:opentensor/subtensor in…
JohnReedV Nov 26, 2024
45830c5
fmt
JohnReedV Nov 26, 2024
8b6351b
Update chainspecs
JohnReedV Nov 26, 2024
574bf7f
add test & saturating math
JohnReedV Nov 26, 2024
3fba9a0
Merge branch 'commit-reveal-v3' of github.com:opentensor/subtensor in…
JohnReedV Nov 26, 2024
af3e095
Update chainspecs
JohnReedV Nov 26, 2024
b510fc8
check weightsminstake pre-dispatch crv3
JohnReedV Nov 26, 2024
864c89a
Update chainspecs
JohnReedV Nov 26, 2024
a0b9d66
more unit tests
JohnReedV Nov 27, 2024
4f90985
Update chainspecs
JohnReedV Nov 27, 2024
3addecc
even more unit tests
JohnReedV Nov 27, 2024
f1ed637
Update chainspecs
JohnReedV Nov 27, 2024
16551f8
expand a test
JohnReedV Nov 27, 2024
965ee3e
Update chainspecs
JohnReedV Nov 27, 2024
af90612
remove deprecated
JohnReedV Nov 27, 2024
e62d438
Merge branch 'commit-reveal-v3' of github.com:opentensor/subtensor in…
JohnReedV Nov 27, 2024
6e2ecbe
Merge pull request #982 from opentensor/commit-reveal-v3
JohnReedV Nov 27, 2024
966ae1d
fix keystore key accumulation bug
JohnReedV Nov 28, 2024
f7c5898
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Nov 28, 2024
83f75cc
Update chainspecs
JohnReedV Nov 28, 2024
c7bf1cb
Use existing rate limit
JohnReedV Nov 28, 2024
bc926b2
fmt
JohnReedV Nov 28, 2024
1caead6
Update chainspecs
JohnReedV Nov 28, 2024
b07f802
remove signature prefix
JohnReedV Nov 29, 2024
47367d6
Update chainspecs
JohnReedV Nov 29, 2024
6d86c12
give each OCW a unique tx tag
JohnReedV Dec 2, 2024
ba03f23
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Dec 2, 2024
ee0756b
clean expired commits
JohnReedV Dec 3, 2024
a0e96d5
bump spec
JohnReedV Dec 3, 2024
1438380
Merge branch 'devnet-ready' into spiigot/add-pallet-drand
JohnReedV Dec 3, 2024
247d8db
remove sneaky unwrap from drand pallet
JohnReedV Dec 3, 2024
44a34a8
Merge branch 'spiigot/add-pallet-drand' of https://github.com/openten…
JohnReedV Dec 3, 2024
80a0001
fmt
JohnReedV Dec 3, 2024
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
945 changes: 723 additions & 222 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 24 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ members = [
"support/macros",
"support/linting",
"support/procedural-fork",
"pallets/drand",
]
exclude = ["support/procedural-fork"]
resolver = "2"
Expand All @@ -49,7 +50,7 @@ manual_inspect = "allow"
async-trait = "0.1"
cargo-husky = { version = "1", default-features = false }
clap = "4.5.4"
codec = { version = "3.2.2", default-features = false }
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
ed25519-dalek = { version = "2.1.0", default-features = false, features = ["alloc"] }
enumflags2 = "0.7.9"
futures = "0.3.30"
Expand All @@ -63,14 +64,14 @@ parity-util-mem = "0.12.0"
rand = "0.8.5"
scale-codec = { package = "parity-scale-codec", version = "3.6.12", default-features = false, features = ["derive"] }
scale-info = { version = "2.11.2", default-features = false }
serde = { version = "1.0.199", default-features = false }
serde = { version = "1.0.214", default-features = false }
serde-tuple-vec-map = { version = "1.0.1", default-features = false }
serde_bytes = { version = "0.11.14", default-features = false }
serde_json = { version = "1.0.121", default-features = false }
serde_with = { version = "=2.0.0", default-features = false }
smallvec = "1.13.2"
litep2p = { git = "https://github.com/paritytech/litep2p", tag = "v0.7.0" }
syn = { version = "2", features = [
syn = { version = "2.0.87", features = [
"full",
"visit-mut",
"visit",
Expand Down Expand Up @@ -142,7 +143,7 @@ sp-genesis-builder = { git = "https://github.com/paritytech/polkadot-sdk.git", t
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
sp-inherents = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409" }
sp-keyring = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
sp-offchain = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
sp-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
Expand Down Expand Up @@ -192,6 +193,25 @@ pallet-evm-precompile-sha3fips = { git = "https://github.com/gztensor/frontier",
pallet-evm-precompile-simple = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }
pallet-hotfix-sufficients = { git = "https://github.com/gztensor/frontier", rev = "b8e3025", default-features = false }

#DRAND
pallet-drand = { path = "pallets/drand", default-features = false }
sp-crypto-ec-utils = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", features = ["bls12-381"] }
getrandom = { version = "0.2.15", features = ["custom"], default-features = false }
sp-keystore = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
w3f-bls = { version = "=0.1.3", default-features = false }
ark-crypto-primitives = { version = "0.4.0", default-features = false, features = [ "r1cs", "snark" ] }
ark-scale = { version = "0.0.11", default-features = false, features = ["hazmat"] }
sp-ark-bls12-381 = { git = "https://github.com/paritytech/substrate-curves", default-features = false }
ark-bls12-381 = { version = "0.4.0", features = ["curve"], default-features = false }
ark-serialize = { version = "0.4.0", features = [ "derive" ], default-features = false }
ark-ff = { version = "0.4.0", default-features = false }
ark-ec = { version = "0.4.0", default-features = false }
ark-std = { version = "0.4.0", default-features = false }
anyhow = "1.0.81"
sha2 = { version = "0.10.8", default-features = false }
rand_chacha = { version = "0.3.1", default-features = false }
tle = { git = "https://github.com/ideal-lab5/timelock", rev = "5416406cfd32799e31e1795393d4916894de4468", default-features = false }

frame-metadata = "16"

[profile.release]
Expand Down
6 changes: 6 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ frame-metadata-hash-extension = { workspace = true }
frame-system = { workspace = true }
pallet-transaction-payment = { workspace = true }
pallet-commitments = { path = "../pallets/commitments" }
pallet-drand = { workspace = true }
sp-crypto-ec-utils = { workspace = true }
sp-keystore = { workspace = true, default-features = false }


# These dependencies are used for the subtensor's RPCs
jsonrpsee = { workspace = true, features = ["server"] }
Expand Down Expand Up @@ -128,6 +132,7 @@ runtime-benchmarks = [
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-commitments/runtime-benchmarks",
"pallet-drand/runtime-benchmarks"
]
pow-faucet = []

Expand All @@ -139,6 +144,7 @@ try-runtime = [
"pallet-transaction-payment/try-runtime",
"sp-runtime/try-runtime",
"pallet-commitments/try-runtime",
"pallet-drand/try-runtime"
]

metadata-hash = ["node-subtensor-runtime/metadata-hash"]
6 changes: 4 additions & 2 deletions node/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ use sc_executor::WasmExecutor;
/// Full backend.
pub type FullBackend = sc_service::TFullBackend<Block>;
/// Full client.
pub type FullClient = sc_service::TFullClient<Block, RuntimeApi, WasmExecutor<HostFunctions>>;
pub type FullClient = sc_service::TFullClient<Block, RuntimeApi, RuntimeExecutor>;
/// Always enable runtime benchmark host functions, the genesis state
/// was built with them so we're stuck with them forever.
///
/// They're just a noop, never actually get used if the runtime was not compiled with
/// `runtime-benchmarks`.
type HostFunctions = (
pub type HostFunctions = (
sp_io::SubstrateHostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
sp_crypto_ec_utils::bls12_381::host_calls::HostFunctions,
);
pub type RuntimeExecutor = WasmExecutor<HostFunctions>;
34 changes: 28 additions & 6 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::{marker::PhantomData, sync::Arc, time::Duration};
use substrate_prometheus_endpoint::Registry;

use crate::cli::Sealing;
use crate::client::{FullBackend, FullClient};
use crate::client::{FullBackend, FullClient, HostFunctions, RuntimeExecutor};
use crate::ethereum::{
db_config_dir, new_frontier_partial, spawn_frontier_tasks, BackendType, EthConfiguration,
FrontierBackend, FrontierBlockImport, FrontierPartialComponents, StorageOverride,
Expand Down Expand Up @@ -84,13 +84,14 @@ where
})
.transpose()?;

let executor = sc_service::new_wasm_executor(&config.executor);
let executor = sc_service::new_wasm_executor::<HostFunctions>(&config.executor);
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
sc_service::new_full_parts::<Block, RuntimeApi, RuntimeExecutor>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;

let client = Arc::new(client);

let telemetry = telemetry.map(|(worker, telemetry)| {
Expand Down Expand Up @@ -427,10 +428,31 @@ where
metrics,
})?;

if config.offchain_worker.enabled {
task_manager.spawn_handle().spawn(
if config.offchain_worker.enabled && config.role.is_authority() {
let public_keys = keystore_container
.keystore()
.sr25519_public_keys(pallet_drand::KEY_TYPE);

if public_keys.is_empty() {
match sp_keystore::Keystore::sr25519_generate_new(
&*keystore_container.keystore(),
pallet_drand::KEY_TYPE,
None,
) {
Ok(_) => {
log::debug!("Offchain worker key generated");
}
Err(e) => {
log::error!("Failed to create SR25519 key for offchain worker: {:?}", e);
}
}
} else {
log::debug!("Offchain worker key already exists");
}

task_manager.spawn_essential_handle().spawn(
"offchain-workers-runner",
"offchain-worker",
None,
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
is_validator: config.role.is_authority(),
Expand Down
6 changes: 5 additions & 1 deletion pallets/admin-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ log = { workspace = true }
pallet-subtensor = { version = "4.0.0-dev", default-features = false, path = "../subtensor" }
sp-weights = { workspace = true }
substrate-fixed = { workspace = true }
pallet-drand = { workspace = true, default-features = false }


[dev-dependencies]
Expand Down Expand Up @@ -60,6 +61,7 @@ std = [
"sp-io/std",
"sp-std/std",
"substrate-fixed/std",
"pallet-drand/std"
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand All @@ -69,12 +71,14 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"pallet-subtensor/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-drand/runtime-benchmarks"
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-balances/try-runtime",
"pallet-scheduler/try-runtime",
"sp-runtime/try-runtime",
"pallet-subtensor/try-runtime"
"pallet-subtensor/try-runtime",
"pallet-drand/try-runtime"
]
Loading