Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to polkadot-v0.9.28 #262

Merged
merged 2 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
985 changes: 480 additions & 505 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ pallet-encointer-communities = { git = "https://github.com/encointer/pallets", b
pallet-encointer-scheduler = { git = "https://github.com/encointer/pallets", branch = "master" }

# scs deps
substrate-api-client = { git = "https://github.com/scs/substrate-api-client", branch = "master" }
substrate-client-keystore = { git = "https://github.com/scs/substrate-api-client", branch = "master" }
substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.28" }
substrate-client-keystore = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.28" }

# substrate deps
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-transaction-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-application-crypto = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-rpc = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
frame-support = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
pallet-transaction-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-application-crypto = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-rpc = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }

6 changes: 3 additions & 3 deletions client/encointer-api-client-extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ encointer-primitives = { git = "https://github.com/encointer/pallets", branch =
encointer-ceremonies-assignment = { git = "https://github.com/encointer/pallets", branch = "master" }

# scs deps
substrate-api-client = { git = "https://github.com/scs/substrate-api-client", branch = "master"}
substrate-client-keystore = { git = "https://github.com/scs/substrate-api-client", branch = "master"}
substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.28"}
substrate-client-keystore = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.28"}

# substrate deps
sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
66 changes: 33 additions & 33 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,43 @@ clap = { version = "3.1.18", features = ["derive"] }
log = "0.4.14"
serde_json = "1.0.81"

sc-cli = { version = "0.10.0-dev", features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-executor = { version = "0.10.0-dev", features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-service = { version = "0.10.0-dev", features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-keystore = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-consensus-aura = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-consensus-aura = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-inherents = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git",branch = "master" }
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-cli = { version = "0.10.0-dev", features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-executor = { version = "0.10.0-dev", features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-service = { version = "0.10.0-dev", features = ["wasmtime"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-keystore = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-consensus-aura = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-consensus-aura = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-inherents = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
# encointer-specific
pallet-asset-tx-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
pallet-asset-tx-payment = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }

# These dependencies are used for the node's RPCs
jsonrpsee = { version = "0.14.0", features = ["server"] }
sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
jsonrpsee = { version = "0.15.1", features = ["server"] }
sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }

# These dependencies are used for runtime benchmarking
frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git",branch = "master" }
frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }
frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }

# encointer dependencies
encointer-node-notee-runtime = { path = "../runtime" }
Expand All @@ -76,7 +76,7 @@ encointer-balances-tx-payment-rpc-runtime-api = { git = "https://github.com/enco
encointer-balances-tx-payment-rpc = { git = "https://github.com/encointer/pallets", branch = "master" }

# CLI-specific dependencies
try-runtime-cli = { version = "0.10.0-dev", optional = true, git = "https://github.com/paritytech/substrate.git",branch = "master" }
try-runtime-cli = { version = "0.10.0-dev", optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" }


[features]
Expand Down
60 changes: 55 additions & 5 deletions node/src/command_helper.rs → node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use crate::service::FullClient;

use encointer_node_notee_runtime as runtime;
use runtime::SystemCall;
use runtime::{AccountId, Balance, BalancesCall, SystemCall};
use sc_cli::Result;
use sc_client_api::BlockBackend;
use sp_core::{Encode, Pair};
Expand All @@ -35,19 +35,27 @@ use std::{sync::Arc, time::Duration};
/// Generates extrinsics for the `benchmark overhead` command.
///
/// Note: Should only be used for benchmarking.
pub struct BenchmarkExtrinsicBuilder {
pub struct RemarkBuilder {
client: Arc<FullClient>,
}

impl BenchmarkExtrinsicBuilder {
impl RemarkBuilder {
/// Creates a new [`Self`] from the given client.
pub fn new(client: Arc<FullClient>) -> Self {
Self { client }
}
}

impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkExtrinsicBuilder {
fn remark(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
fn pallet(&self) -> &str {
"system"
}

fn extrinsic(&self) -> &str {
"remark"
}

fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
let acc = Sr25519Keyring::Bob.pair();
let extrinsic: OpaqueExtrinsic = create_benchmark_extrinsic(
self.client.as_ref(),
Expand All @@ -61,6 +69,48 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for BenchmarkExtrinsicBuilder {
}
}

/// Generates `Balances::TransferKeepAlive` extrinsics for the benchmarks.
///
/// Note: Should only be used for benchmarking.
pub struct TransferKeepAliveBuilder {
client: Arc<FullClient>,
dest: AccountId,
value: Balance,
}

impl TransferKeepAliveBuilder {
/// Creates a new [`Self`] from the given client.
pub fn new(client: Arc<FullClient>, dest: AccountId, value: Balance) -> Self {
Self { client, dest, value }
}
}

impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
fn pallet(&self) -> &str {
"balances"
}

fn extrinsic(&self) -> &str {
"transfer_keep_alive"
}

fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
let acc = Sr25519Keyring::Bob.pair();
let extrinsic: OpaqueExtrinsic = create_benchmark_extrinsic(
self.client.as_ref(),
acc,
BalancesCall::transfer_keep_alive {
dest: self.dest.clone().into(),
value: self.value.into(),
}
.into(),
nonce,
)
.into();

Ok(extrinsic)
}
}
/// Create a transaction using the given `call`.
///
/// Note: Should only be used for benchmarking.
Expand Down
1 change: 1 addition & 0 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ fn testnet_genesis(
reputation_lifetime: 337, // 7.02 days at 30min ceremony cycle
inactivity_timeout: 168500, // 10 years at 30min ceremony cycle
meetup_time_offset: 0,
endorsement_tickets_per_reputable: 5,
},
encointer_communities: EncointerCommunitiesConfig {
min_solar_trip_time_s: 1, // [s]
Expand Down
26 changes: 20 additions & 6 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
// limitations under the License.

use crate::{
benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder},
chain_spec,
cli::{Cli, Subcommand},
command_helper::{inherent_benchmark_data, BenchmarkExtrinsicBuilder},
service,
};
use encointer_node_notee_runtime::Block;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use encointer_node_notee_runtime::{Block, EXISTENTIAL_DEPOSIT};
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;
use std::sync::Arc;
use sp_keyring::Sr25519Keyring;

impl SubstrateCli for Cli {
fn impl_name() -> String {
Expand Down Expand Up @@ -154,9 +154,23 @@ pub fn run() -> sc_cli::Result<()> {
},
BenchmarkCmd::Overhead(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
let ext_builder = BenchmarkExtrinsicBuilder::new(client.clone());
let ext_builder = RemarkBuilder::new(client.clone());

cmd.run(config, client, inherent_benchmark_data()?, Arc::new(ext_builder))
cmd.run(config, client, inherent_benchmark_data()?, &ext_builder)
},
BenchmarkCmd::Extrinsic(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
// Register the *Remark* and *TKA* builders.
let ext_factory = ExtrinsicFactory(vec![
Box::new(RemarkBuilder::new(client.clone())),
Box::new(TransferKeepAliveBuilder::new(
client.clone(),
Sr25519Keyring::Alice.to_account_id(),
EXISTENTIAL_DEPOSIT,
)),
]);

cmd.run(client, inherent_benchmark_data()?, &ext_factory)
},
BenchmarkCmd::Machine(cmd) =>
cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()),
Expand Down
2 changes: 1 addition & 1 deletion node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
mod chain_spec;
#[macro_use]
mod service;
mod benchmarking;
mod cli;
mod command;
mod command_helper;
mod rpc;

fn main() -> sc_cli::Result<()> {
Expand Down
34 changes: 17 additions & 17 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,24 +305,24 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
.spawn_blocking("aura", Some("block-authoring"), aura);
}

// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore =
if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };

let grandpa_config = sc_finality_grandpa::Config {
// FIXME #1578 make this available through chainspec
gossip_duration: Duration::from_millis(333),
justification_period: 512,
name: Some(name),
observer_enabled: false,
keystore,
local_role: role,
telemetry: telemetry.as_ref().map(|x| x.handle()),
protocol_name: grandpa_protocol_name,
};

if enable_grandpa {
// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore =
if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };

let grandpa_config = sc_finality_grandpa::Config {
// FIXME #1578 make this available through chainspec
gossip_duration: Duration::from_millis(333),
justification_period: 512,
name: Some(name),
observer_enabled: false,
keystore,
local_role: role,
telemetry: telemetry.as_ref().map(|x| x.handle()),
protocol_name: grandpa_protocol_name,
};

// start the full GRANDPA voter
// NOTE: non-authorities could run the GRANDPA observer protocol, but at
// this point the full voter should provide better guarantees of block
Expand Down
Loading