Update to the latest Serai Substrate (#125)

* Update to the latest Serai Substrate

* Add Protobuf to build dependencies

Docker shouldn't need updating as this should've been added to the image 
in 
2dbace5b01.

* Get substrate to build

* Correct protoc build step

* Remove the benchmarking code

There's some macro resolution error that isn't apparent. I worked on it 
for about half an hour but...

* Remove unnecessary clone

* Correct runtime-benchmarks flag usage
This commit is contained in:
Luke Parker
2022-09-29 13:33:09 -05:00
committed by GitHub
parent 2c3f36fd3f
commit 482a8ec209
9 changed files with 588 additions and 515 deletions

View File

@@ -31,7 +31,7 @@ frame-system = { git = "https://github.com/serai-dex/substrate" }
pallet-transaction-payment = { git = "https://github.com/serai-dex/substrate", default-features = false }
# These dependencies are used for the node template's RPCs
jsonrpsee = { version = "0.14.0", features = ["server"] }
jsonrpsee = { version = "0.15.1", features = ["server"] }
sc-rpc = { git = "https://github.com/serai-dex/substrate" }
sp-api = { git = "https://github.com/serai-dex/substrate" }
sc-rpc-api = { git = "https://github.com/serai-dex/substrate" }
@@ -54,4 +54,8 @@ substrate-build-script-utils = { git = "https://github.com/serai-dex/substrate.g
[features]
default = []
runtime-benchmarks = ["serai-runtime/runtime-benchmarks"]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"serai-runtime/runtime-benchmarks"
]

View File

@@ -94,6 +94,12 @@ pub fn run() -> sc_cli::Result<()> {
BenchmarkCmd::Block(cmd) => cmd.run(service::new_partial(&config)?.client),
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) => {
Err("Storage benchmarking can be enabled with `--features runtime-benchmarks`.".into())
}
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => {
let PartialComponents { client, backend, .. } = service::new_partial(&config)?;
cmd.run(config, client, backend.expose_db(), backend.expose_storage())
@@ -101,7 +107,13 @@ pub fn run() -> sc_cli::Result<()> {
BenchmarkCmd::Overhead(cmd) => {
let client = service::new_partial(&config)?.client;
cmd.run(config, client.clone(), inherent_benchmark_data()?, &RemarkBuilder::new(client))
cmd.run(
config,
client.clone(),
inherent_benchmark_data()?,
vec![],
&RemarkBuilder::new(client),
)
}
BenchmarkCmd::Extrinsic(cmd) => {
@@ -109,6 +121,7 @@ pub fn run() -> sc_cli::Result<()> {
cmd.run(
client.clone(),
inherent_benchmark_data()?,
vec![],
&ExtrinsicFactory(vec![Box::new(RemarkBuilder::new(client))]),
)
}

View File

@@ -45,7 +45,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
pub fn create_benchmark_extrinsic(
client: &FullClient,
sender: sp_core::sr25519::Pair,
call: runtime::Call,
call: runtime::RuntimeCall,
nonce: u32,
) -> runtime::UncheckedExtrinsic {
let extra = (

View File

@@ -96,7 +96,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
transaction_pool,
} = new_partial(&config)?;
let (network, system_rpc_tx, network_starter) =
let (network, system_rpc_tx, tx_handler_controller, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
client: client.clone(),
@@ -142,6 +142,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
rpc_builder: rpc_extensions_builder,
backend,
system_rpc_tx,
tx_handler_controller,
config,
telemetry: telemetry.as_mut(),
})?;