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

Update to polkadot-v0.9.31 #156

Merged
merged 3 commits into from
Nov 8, 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
1,855 changes: 862 additions & 993 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ configured to include Substrate's [`pallet-contracts`](https://github.com/parity
‒ a smart contract module.

This repository is tracking Substrate's
[`polkadot-v0.9.29`](https://github.com/paritytech/substrate/tree/polkadot-v0.9.29) branch.
[`polkadot-v0.9.31`](https://github.com/paritytech/substrate/tree/polkadot-v0.9.31) branch.
When new Polkadot releases come out we may update to those.

_This repository contains a couple of modifications that make it unsuitable
Expand Down Expand Up @@ -81,10 +81,11 @@ Once the node template is running locally, you can connect to it with frontends
- [ ] Check commits for [`pallet-contracts`](https://github.com/paritytech/substrate/tree/master/frame/contracts)
since the last time someone synchronized this repository with Substrate
in order to not miss any important changes.
- [ ] Execute `diener -s --branch my_polkadot_release_branch` and then `cargo update -p pallet-contracts`
for this repository. The specific crate which is mentioned here is actually not important: since
Substrate uses git references for its Substrate dependencies it means
that once one package is updated all are.
- [ ] Execute `diener update -s --branch my_polkadot_release_branch`. Manually upgrade the
`pallet-assets-chain-extension` dependency to the latest release branch and then
`cargo update -p palle-contracts` for this repository. The specific crate which is mentioned
here is actually not important: since Substrate uses git references for its Substrate
dependencies it means that once one package is updated all are.
- [ ] Increment the minor version number in `node/Cargo.toml` and `runtime/Cargo.toml`.
- [ ] Execute `cargo run --release -- --tmp`. If successful, it should produce blocks
and a new, up to date, `Cargo.lock` will be created.
Expand Down
70 changes: 30 additions & 40 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,47 @@ name = "substrate-contracts-node"
path = "src/main.rs"

[dependencies]
clap = { version = "3.2.10", features = ["derive"] }
clap = { version = "4", features = ["derive"] }

sc-cli = { git = "https://github.com/paritytech/substrate", package = "sc-cli", features = ["wasmtime"] , branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", package = "sp-core" , branch = "polkadot-v0.9.29" }
sc-executor = { git = "https://github.com/paritytech/substrate", package = "sc-executor", features = ["wasmtime"] , branch = "polkadot-v0.9.29" }
sc-service = { git = "https://github.com/paritytech/substrate", package = "sc-service", features = ["wasmtime"] , branch = "polkadot-v0.9.29" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", package = "sc-telemetry" , branch = "polkadot-v0.9.29" }
sc-keystore = { git = "https://github.com/paritytech/substrate", package = "sc-keystore" , branch = "polkadot-v0.9.29" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool" , branch = "polkadot-v0.9.29" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool-api" , branch = "polkadot-v0.9.29" }
sp-consensus = { git = "https://github.com/paritytech/substrate", package = "sp-consensus" , branch = "polkadot-v0.9.29" }
sc-consensus = { git = "https://github.com/paritytech/substrate", package = "sc-consensus" , branch = "polkadot-v0.9.29" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", package = "sc-consensus-manual-seal" , branch = "polkadot-v0.9.29" }
sc-client-api = { git = "https://github.com/paritytech/substrate", package = "sc-client-api" , branch = "polkadot-v0.9.29" }
sp-runtime = { git = "https://github.com/paritytech/substrate", package = "sp-runtime" , branch = "polkadot-v0.9.29" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", package = "sp-timestamp" , branch = "polkadot-v0.9.29" }
sp-inherents = { git = "https://github.com/paritytech/substrate", package = "sp-inherents" , branch = "polkadot-v0.9.29" }
sp-keyring = { git = "https://github.com/paritytech/substrate", package = "sp-keyring" , branch = "polkadot-v0.9.29" }
frame-system = { git = "https://github.com/paritytech/substrate", package = "frame-system" , branch = "polkadot-v0.9.29" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", package = "pallet-transaction-payment" , branch = "polkadot-v0.9.29" }
sc-cli = { git = "https://github.com/paritytech/substrate", package = "sc-cli", features = ["wasmtime"] , branch = "polkadot-v0.9.31" }
sp-core = { git = "https://github.com/paritytech/substrate", package = "sp-core" , branch = "polkadot-v0.9.31" }
sc-executor = { git = "https://github.com/paritytech/substrate", package = "sc-executor", features = ["wasmtime"] , branch = "polkadot-v0.9.31" }
sc-service = { git = "https://github.com/paritytech/substrate", package = "sc-service", features = ["wasmtime"] , branch = "polkadot-v0.9.31" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", package = "sc-telemetry" , branch = "polkadot-v0.9.31" }
sc-keystore = { git = "https://github.com/paritytech/substrate", package = "sc-keystore" , branch = "polkadot-v0.9.31" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool" , branch = "polkadot-v0.9.31" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", package = "sc-transaction-pool-api" , branch = "polkadot-v0.9.31" }
sp-consensus = { git = "https://github.com/paritytech/substrate", package = "sp-consensus" , branch = "polkadot-v0.9.31" }
sc-consensus = { git = "https://github.com/paritytech/substrate", package = "sc-consensus" , branch = "polkadot-v0.9.31" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", package = "sc-consensus-manual-seal" , branch = "polkadot-v0.9.31" }
sc-client-api = { git = "https://github.com/paritytech/substrate", package = "sc-client-api" , branch = "polkadot-v0.9.31" }
sp-runtime = { git = "https://github.com/paritytech/substrate", package = "sp-runtime" , branch = "polkadot-v0.9.31" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", package = "sp-timestamp" , branch = "polkadot-v0.9.31" }
sp-inherents = { git = "https://github.com/paritytech/substrate", package = "sp-inherents" , branch = "polkadot-v0.9.31" }
sp-keyring = { git = "https://github.com/paritytech/substrate", package = "sp-keyring" , branch = "polkadot-v0.9.31" }
frame-system = { git = "https://github.com/paritytech/substrate", package = "frame-system" , branch = "polkadot-v0.9.31" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", package = "pallet-transaction-payment" , branch = "polkadot-v0.9.31" }

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

# These dependencies are used for runtime benchmarking
frame-benchmarking = { git = "https://github.com/paritytech/substrate", package = "frame-benchmarking" , branch = "polkadot-v0.9.29" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", package = "frame-benchmarking-cli" , branch = "polkadot-v0.9.29" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", package = "frame-benchmarking" , branch = "polkadot-v0.9.31" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", package = "frame-benchmarking-cli" , branch = "polkadot-v0.9.31" }

# Local Dependencies
contracts-node-runtime = { path = "../runtime" }

# CLI-specific dependencies
try-runtime-cli = { git = "https://github.com/paritytech/substrate", package = "try-runtime-cli", optional = true , branch = "polkadot-v0.9.29" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", package = "substrate-build-script-utils" , branch = "polkadot-v0.9.29" }
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", package = "substrate-build-script-utils" , branch = "polkadot-v0.9.31" }

[features]
default = []
runtime-benchmarks = [
"contracts-node-runtime/runtime-benchmarks",
]
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
try-runtime = ["contracts-node-runtime/try-runtime", "try-runtime-cli"]
2 changes: 1 addition & 1 deletion node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
pub fn create_benchmark_extrinsic(
client: &FullClient,
sender: sp_core::sr25519::Pair,
call: runtime::Call,
call: runtime::RuntimeCall,
nonce: u32,
) -> runtime::UncheckedExtrinsic {
let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
Expand Down
8 changes: 0 additions & 8 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ pub enum Subcommand {
#[clap(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some command against runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),

/// Try some command against runtime state. Note: `try-runtime` feature must be enabled.
#[cfg(not(feature = "try-runtime"))]
TryRuntime,

/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
}
38 changes: 2 additions & 36 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::{
chain_spec,
cli::{Cli, Subcommand},
service,
service::ExecutorDispatch,
};
use contracts_node_runtime::{Block, EXISTENTIAL_DEPOSIT};
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
Expand Down Expand Up @@ -125,28 +124,12 @@ pub fn run() -> sc_cli::Result<()> {
// which sub-commands it wants to support.
// In the case of substrate-contract-node we only support benchmark for pallet
match cmd {
BenchmarkCmd::Pallet(cmd) => {
if !cfg!(feature = "runtime-benchmarks") {
return Err(
"Runtime benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
.into(),
)
}

cmd.run::<Block, ExecutorDispatch>(config)
},
BenchmarkCmd::Pallet(_) | BenchmarkCmd::Storage(_) =>
Err("Runtime Benchmarking not supported.")?,
BenchmarkCmd::Block(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
cmd.run(client)
},
BenchmarkCmd::Storage(cmd) => {
let PartialComponents { client, backend, .. } =
service::new_partial(&config)?;
let db = backend.expose_db();
let storage = backend.expose_storage();
cmd.run(config, client, db, storage)
},
BenchmarkCmd::Overhead(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
let ext_builder = RemarkBuilder::new(client.clone());
Expand Down Expand Up @@ -178,23 +161,6 @@ pub fn run() -> sc_cli::Result<()> {
}
})
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
// we don't need any of the components of new_partial, just a runtime, or a task
// manager to do `async_run`.
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
Ok((cmd.run::<Block, service::ExecutorDispatch>(config), task_manager))
})
},
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
You can enable it with `--features try-runtime`."
.into()),
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<Block>(&config))
Expand Down
7 changes: 1 addition & 6 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

use std::sync::Arc;

use contracts_node_runtime::{opaque::Block, AccountId, Balance, BlockNumber, Hash, Index};
use contracts_node_runtime::{opaque::Block, AccountId, Balance, Index};
use jsonrpsee::RpcModule;
use sc_client_api::BlockBackend;
use sc_rpc::dev::{Dev, DevApiServer};
Expand Down Expand Up @@ -38,12 +38,10 @@ where
C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,
C: Send + Sync + 'static,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + 'static,
{
use pallet_contracts_rpc::{Contracts, ContractsApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use substrate_frame_rpc_system::{System, SystemApiServer};

Expand All @@ -58,9 +56,6 @@ where
// to call into the runtime.
// `module.merge(YourRpcTrait::into_rpc(YourRpcStruct::new(ReferenceToClient, ...)))?;`

// Contracts RPC API extension
module.merge(Contracts::new(client.clone()).into_rpc())?;

// Dev RPC API extension
module.merge(Dev::new(client, deny_unsafe).into_rpc())?;

Expand Down
9 changes: 3 additions & 6 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ use std::sync::Arc;
pub struct ExecutorDispatch;

impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
/// Only enable the benchmarking host functions when we actually want to benchmark.
#[cfg(feature = "runtime-benchmarks")]
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
/// Otherwise we only use the default Substrate host functions.
#[cfg(not(feature = "runtime-benchmarks"))]
/// We only use the default Substrate host functions as runtime benchmarks are not supported.
type ExtendHostFunctions = ();

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
Expand Down Expand Up @@ -139,7 +135,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
};
}

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(),
Expand Down Expand Up @@ -180,6 +176,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(),
})?;
Expand Down
Loading