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-v1.5.0 #1494

Merged
merged 5 commits into from
Dec 26, 2023
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
2,081 changes: 1,393 additions & 688 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ derive_more = { version = "0.99.17", git = "https://github.com/JelteF/derive_mor

ring = { git = "https://github.com/jasl/ring-xous", branch = "better-wasm32-support" }

sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-core-hashing = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-core-hashing = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-std = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-runtime-interface = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }

# For pink-extension-runtime, it will introduce Substrate from crates-io which usually different with polkadot-branch
pink-extension = { path = "crates/pink/pink-extension" }
Expand Down
19 changes: 9 additions & 10 deletions crates/phactory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ pink = { path = "../pink/runner", package = "pink-runner" }
pink-extension-runtime = { path = "../pink/pink-extension-runtime" }
pink-extension = { path = "../pink/pink-extension" }

sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-externalities = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-externalities = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
parity-scale-codec = { package = "parity-scale-codec", version = "3.6.5", default-features = false, features = ["derive", "full", "chain-error"] }

# Phala specific
Expand All @@ -49,12 +49,11 @@ derive_more = "0.99.0"
hash-db = { version = "0.16.0", default-features = false }
num = { package = "num-traits", version = "0.2", default-features = false }
finality-grandpa = { version = "0.16.1", default-features = false, features = ["derive-codec"] }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
pallet-contracts-primitives = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }

fixed = "1.9.0"
fixed-sqrt = "0.2.4"
Expand Down
8 changes: 4 additions & 4 deletions crates/phactory/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ prpc = { path = "../../../crates/prpc", default-features = false }
phala-crypto = { path = "../../../crates/phala-crypto" }
chain = { path = "../../../standalone/runtime", default-features = false, package = "phala-node-runtime" }

sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }
phala-git-revision = { path = "../../phala-git-revision" }

# for pruntime_client
Expand Down
21 changes: 14 additions & 7 deletions crates/phactory/src/light_validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use std::collections::BTreeMap;
use std::fmt;
use std::marker::PhantomData;

use anyhow::Result;
use anyhow::{Context, Result};
use error::JustificationError;
use justification::GrandpaJustification;
use log::{error, info};
Expand Down Expand Up @@ -289,14 +289,21 @@ where
// By encoding the given set we should have an easy way to compare
// with the stuff we get out of storage via `read_value`
let encoded_validator_set = validator_set.encode();
let matches = if let Some(authorities) = checker.read_value(b":grandpa_authorities")? {
encoded_validator_set.get(..) == authorities.get(1..)

let alt_key = utils::storage_prefix("Grandpa", "Authorities");
let old_key = b":grandpa_authorities";

let matches = if let Some(authorities) = checker
.read_value(&alt_key)
.context("Faield to read Grandpa::Authorities")?
{
encoded_validator_set == authorities
} else {
let key = utils::storage_prefix("Grandpa", "Authorities");
let authorities = checker
.read_value(&key)?
.ok_or_else(|| anyhow::Error::msg(Error::StorageValueUnavailable))?;
encoded_validator_set == authorities
.read_value(old_key)
.context("Faield to read :grandpa_authorities")?
.ok_or_else(|| anyhow::anyhow!("Missing grandpa authorities"))?;
encoded_validator_set.get(..) == authorities.get(1..)
};

// TODO: check set_id
Expand Down
4 changes: 1 addition & 3 deletions crates/phactory/src/light_validation/storage_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ use hash_db::{HashDB, Hasher, EMPTY_PREFIX};
use sp_trie::trie_types::TrieDBBuilder;
use sp_trie::{trie_types::TrieDB, MemoryDB, Trie};

use super::Error;

pub(crate) type StorageProof = Vec<Vec<u8>>;

/// This struct is used to read storage values from a subset of a Merklized database. The "proof"
Expand Down Expand Up @@ -60,7 +58,7 @@ where
self.trie()
.get(key)
.map(|value| value.map(|value| value.to_vec()))
.map_err(|_| anyhow::Error::msg(Error::StorageValueUnavailable))
.map_err(|err| anyhow::anyhow!("Failed to read value from trie: {err:?}"))
}

fn trie(&self) -> TrieDB<H> {
Expand Down
2 changes: 1 addition & 1 deletion crates/phala-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2018"
resolver = "2"

[dependencies]
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }

ring = { version = "0.16.20", default-features = false, features = ["alloc"] }
curve25519-dalek = { version = "2.0", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/phala-mq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hex = { version = "0.4.3", default-features = false, features = ['alloc'] }
derive_more = { version = "0.99", default-features = false, features = ["display"] }
parity-scale-codec = { version = "3.6.5", default-features = false, features = ["derive"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"] }

spin = { version = "0.9", default-features = false, features = ["mutex", "use_ticket_mutex"], optional = true }
Expand Down
10 changes: 5 additions & 5 deletions crates/phala-node-rpc-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ hex = { version = "0.4.3", default-features = false }
codec = { package = "parity-scale-codec", version = "3.6.5" }

# primitives
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }

# client dependencies
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sc-client-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }

phala-mq = { path = "../../crates/phala-mq" }
phala-pallets = { path = "../../pallets/phala" }
Expand Down
8 changes: 5 additions & 3 deletions crates/phala-node-rpc-ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ use jsonrpsee::{
RpcModule,
};
use pallet_mq_runtime_api::MqApi;
use sc_client_api::blockchain::{HeaderBackend, HeaderMetadata};
use sc_client_api::{Backend, BlockBackend, StorageProvider};
use sc_client_api::{
blockchain::{HeaderBackend, HeaderMetadata},
Backend, BlockBackend, StateBackend, StorageProvider,
};
use sc_transaction_pool_api::{InPoolTransaction, TransactionPool};
use sp_api::{ApiExt, Core, ProvideRuntimeApi, StateBackend};
use sp_api::{ApiExt, Core, ProvideRuntimeApi};
use sp_runtime::traits::Header;
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
use std::fmt::Display;
Expand Down
2 changes: 1 addition & 1 deletion crates/phala-serde-more/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
serde = { version = "1.0.130", default-features = false, features = ["derive", "alloc"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }
scale = { package = "parity-scale-codec", version = "3.6.5", default-features = false }

[features]
Expand Down
10 changes: 5 additions & 5 deletions crates/phala-trie-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ repository = "https://github.com/Phala-Network/phala-blockchain"
[dependencies]
parity-scale-codec = { version = "3.6.5", default-features = false }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }

serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }
hash-db = "0.16.0"
Expand All @@ -21,8 +21,8 @@ im = { version = "15", features = ["serde"] }
log = "0.4"

[dev-dependencies]
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-application-crypto = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", features = ["full_crypto"] }
hash256-std-hasher = { version = "0.15", default-features = false }
hex = "0.4"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/phala-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hex = { version = "0.4", default-features = false, features = ["alloc"] }
serde = { version = "1.0.101", default-features = false, optional = true }
codec = { package = "parity-scale-codec", version = "3.6.5", default-features = false, features = ["full"] }
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }

phala-mq = { path = "../../crates/phala-mq", default-features = false }
prpc = { path = "../../crates/prpc", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/phaxt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ subxt = { path = "../../subxt/subxt", features = ["jsonrpsee-ws"] }
phala-types = { path = "../phala-types" }
phala-node-rpc-ext-types = { path = "../phala-node-rpc-ext/types" }
jsonrpsee = "0.16.2"
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }
primitive-types = { version = "0.12.2", default-features = false }
2 changes: 1 addition & 1 deletion crates/pink-libs/subrpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ base58 = { version = "0.2.0", default-features = false }

[dev-dependencies]
pink-extension-runtime = { path = "../../pink/pink-extension-runtime" }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false, features = ["std"] }
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false, features = ["std"] }

[features]
default = ["std"]
Expand Down
4 changes: 2 additions & 2 deletions crates/pink/capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.1.0"
edition = "2021"

[dependencies]
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
pink-extension = { path = "../pink-extension" }
scale = { package = "parity-scale-codec", version = "3.6.5", default-features = false, features = [
"derive",
Expand Down
5 changes: 2 additions & 3 deletions crates/pink/runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pink-capi = { path = "../capi" }
pink-extension-runtime = { path = "../pink-extension-runtime" }
phala-crypto = { path = "../../phala-crypto" }
serde = { version = "1", features = ["derive"] }
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-weights = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
im = { version = "15", features = ["serde"] }
once_cell = "1"
libc = "0.2"
Expand All @@ -24,7 +24,6 @@ scale = { package = "parity-scale-codec", version = "3.6.5", default-features =
"derive",
] }
insta = "1"
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
pallet-contracts-primitives = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0" }
env_logger = "0.10.0"
assert_matches = "1.5.0"
Loading
Loading