Skip to content

Commit

Permalink
Update from polkadot-v0.9.38 to polkadot-v0.9.39
Browse files Browse the repository at this point in the history
Breaking changes from upstream:

- Rename pallet-random-collective-flip to Insecure...
  paritytech/substrate#13301
- sc_service::BuildNetworkParams::warp_sync field has changed,
  paritytech/substrate#12761

- SortedListProvider::try_state() now only available for the try-runtime
  feature

- Updaged function arguments b/c of mismatched types:

  --> node/rpc/src/task.rs:64:26
   |
64 |         api.offchain_nonce_key(&at, &account_id).map_err(|e| {
   |             ------------------ ^^^ expected associated type, found `&BlockId<_>`
   |             |
   |             arguments to this method are incorrect
   |
   = note: expected associated type `<B as BlockT>::Hash`
           found reference `&BlockId<_>`

  --> sha3pow/src/lib.rs:84:33
   |
84 |         self.runtime_api().difficulty(&parent_id).map_err(|err| {
   |                            ---------- ^^^^^^^^^^ expected struct `H256`, found `&BlockId<B>`
   |                            |
   |                            arguments to this method are incorrect
   |
   = note: expected struct `H256`
           found reference `&BlockId<B>`
  • Loading branch information
atodorov committed Mar 31, 2023
1 parent 1a5b9c5 commit 39f4668
Show file tree
Hide file tree
Showing 9 changed files with 404 additions and 371 deletions.
623 changes: 329 additions & 294 deletions Cargo.lock

Large diffs are not rendered by default.

128 changes: 64 additions & 64 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,69 +52,69 @@ runtime-utils = { package = "test-runtime-utils", path = "test/runtime-utils", d
task-scheduler-runtime-api = { path = "pallets/offchain-task-scheduler/runtime-api", default-features = false }

# Substrate Dependencies
frame-benchmarking-cli = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git"}
frame-benchmarking = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-executive = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-election-provider-support = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-support = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-system = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-system-benchmarking = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-system-rpc-runtime-api = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-balances = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-randomness-collective-flip = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-session = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-staking-substrate = { package = "pallet-staking", branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-scheduler = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-sudo = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-timestamp = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-transaction-payment = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-transaction-payment-rpc = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
pallet-transaction-payment-rpc-runtime-api = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sc-basic-authorship = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-cli = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git"}
sc-client-api = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-client-db = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", features = ["test-helpers"] }
sc-consensus = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-consensus-pow = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-executor = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git"}
sc-keystore = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-offchain = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-rpc = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-rpc-api = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-telemetry = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-transaction-pool = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-transaction-pool-api = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sc-service = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", features = [
frame-benchmarking-cli = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git"}
frame-benchmarking = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-executive = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-election-provider-support = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-support = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-system = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-system-benchmarking = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-system-rpc-runtime-api = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-balances = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-insecure-randomness-collective-flip = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-session = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-staking-substrate = { package = "pallet-staking", branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-scheduler = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-sudo = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-timestamp = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-transaction-payment = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
pallet-transaction-payment-rpc = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
pallet-transaction-payment-rpc-runtime-api = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sc-basic-authorship = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-cli = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git"}
sc-client-api = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-client-db = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", features = ["test-helpers"] }
sc-consensus = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-consensus-pow = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-executor = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git"}
sc-keystore = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-offchain = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-rpc = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-rpc-api = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-telemetry = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-transaction-pool = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-transaction-pool-api = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sc-service = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", features = [
"test-helpers",
] }
sp-api = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-application-crypto = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sp-arithmetic = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-block-builder = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-blockchain = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sp-consensus = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-consensus-pow = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-core = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-inherents = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-io = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-keystore = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-offchain = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-runtime = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-runtime-interface = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-session = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-state-machine = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-staking = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-std = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-timestamp = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sp-transaction-pool = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-version = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
substrate-build-script-utils = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
substrate-frame-rpc-system = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
substrate-prometheus-endpoint = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
substrate-test-client = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
tracing = { package = "sp-tracing", branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-try-runtime = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-externalities = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git", default-features = false }
substrate-wasm-builder = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
try-runtime-cli = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sp-keyring = { branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
sp-api = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-application-crypto = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sp-arithmetic = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-block-builder = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-blockchain = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sp-consensus = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-consensus-pow = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-core = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-inherents = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-io = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-keystore = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-offchain = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-runtime = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-runtime-interface = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-session = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-state-machine = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-staking = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-std = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-timestamp = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sp-transaction-pool = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-version = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
substrate-build-script-utils = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
substrate-frame-rpc-system = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
substrate-prometheus-endpoint = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
substrate-test-client = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
tracing = { package = "sp-tracing", branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
frame-try-runtime = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
sp-externalities = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git", default-features = false }
substrate-wasm-builder = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
try-runtime-cli = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
sp-keyring = { branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
9 changes: 3 additions & 6 deletions node/rpc/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::str::FromStr;
use creditcoin_node_runtime as runtime;
use sc_rpc::DenyUnsafe;
use sp_blockchain::HeaderBackend;
use sp_runtime::{generic::BlockId, traits};
use sp_runtime::{traits};
use std::sync::Arc;
use task_scheduler_runtime_api::TaskApi;

Expand Down Expand Up @@ -49,10 +49,7 @@ where
async fn offchain_nonce_key(&self, account_id: String) -> RpcResult<Vec<u8>> {
self.deny_unsafe.check_if_safe()?;
let api = self.client.runtime_api();
let at = {
let best = self.client.info().best_hash;
BlockId::hash(best)
};
let at = self.client.info().best_hash;
let account_id = AccountId::from_str(&account_id).map_err(|e| {
JsonRpseeError::Call(CallError::Custom(ErrorObject::owned(
ErrorCode::InvalidParams.code(),
Expand All @@ -61,7 +58,7 @@ where
)))
})?;

api.offchain_nonce_key(&at, &account_id).map_err(|e| {
api.offchain_nonce_key(at, &account_id).map_err(|e| {
JsonRpseeError::Call(CallError::Custom(ErrorObject::owned(
ErrorCode::ServerError(Error::RuntimeError.into()).code(),
"Unable to query offchain nonce key.",
Expand Down
2 changes: 1 addition & 1 deletion node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pub fn new_full(config: Configuration, cli: Cli) -> Result<TaskManager, ServiceE
spawn_handle: task_manager.spawn_handle(),
import_queue,
block_announce_validator_builder: None,
warp_sync: None,
warp_sync_params: None,
})?;

if config.offchain_worker.enabled {
Expand Down
4 changes: 2 additions & 2 deletions pallets/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ frame-system = { workspace = true }
log = { workspace = true }
pallet-offchain-task-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-staking-substrate = { package = "pallet-staking", default-features = false, branch = "polkadot-v0.9.38", git = "https://github.com/paritytech/substrate.git" }
pallet-staking-substrate = { package = "pallet-staking", default-features = false, branch = "polkadot-v0.9.39", git = "https://github.com/paritytech/substrate.git" }
parity-scale-codec = { workspace = true }
serde.workspace = true
scale-info = { workspace = true }
Expand Down Expand Up @@ -49,4 +49,4 @@ std = [
'pallet-offchain-task-scheduler/std',
'sp-std/std',
]
try-runtime = ['frame-support/try-runtime']
try-runtime = ['frame-support/try-runtime', 'frame-election-provider-support/try-runtime']
2 changes: 2 additions & 0 deletions pallets/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl<T: Config> SortedListProvider<T::AccountId> for EmptyList<T> {
defensive!();
}

#[cfg(feature = "try-runtime")]
fn try_state() -> Result<(), &'static str> {
defensive!();
Ok(())
Expand Down Expand Up @@ -214,6 +215,7 @@ where
defensive!();
}

#[cfg(feature = "try-runtime")]
fn try_state() -> Result<(), &'static str> {
defensive!();
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ num = { version = "0.4.0", default-features = false, features = [
parity-scale-codec = { workspace = true }
schnorrkel = { version = "0.9", default-features = false }
sp-arithmetic = { workspace = true }
sp-consensus-vrf = { branch = "polkadot-v0.9.38", default-features = false, git = "https://github.com/paritytech/substrate.git" }
sp-consensus-vrf = { branch = "polkadot-v0.9.39", default-features = false, git = "https://github.com/paritytech/substrate.git" }
sp-externalities = { workspace = true }
sp-keystore = { workspace = true, optional = true }
sp-runtime-interface = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pallet-balances = { workspace = true }
pallet-creditcoin = { workspace = true }
pallet-difficulty = { workspace = true }
pallet-offchain-task-scheduler = { workspace = true }
pallet-randomness-collective-flip = { workspace = true }
pallet-insecure-randomness-collective-flip = { workspace = true }
pallet-rewards = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
Expand Down
3 changes: 1 addition & 2 deletions sha3pow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ where
C::Api: DifficultyApi<B, Difficulty>,
{
fn difficulty(&self, parent: <B as BlockT>::Hash) -> Result<Difficulty, Error<B>> {
let parent_id = BlockId::<B>::hash(parent);
self.runtime_api().difficulty(&parent_id).map_err(|err| {
self.runtime_api().difficulty(parent).map_err(|err| {
sc_consensus_pow::Error::Environment(format!(
"Fetching difficulty from runtime failed: {err:?}"
))
Expand Down

0 comments on commit 39f4668

Please sign in to comment.