Skip to content

Commit 8c7d16e

Browse files
authored
Merge pull request #1494 from Phala-Network/upgrade-polkadot-v1.5.0
Upgrade to polkadot-v1.5.0
2 parents b027efd + f730bb1 commit 8c7d16e

File tree

48 files changed

+3448
-2134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3448
-2134
lines changed

Cargo.lock

Lines changed: 1393 additions & 688 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ derive_more = { version = "0.99.17", git = "https://github.com/JelteF/derive_mor
103103

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

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

111111
# For pink-extension-runtime, it will introduce Substrate from crates-io which usually different with polkadot-branch
112112
pink-extension = { path = "crates/pink/pink-extension" }

crates/phactory/Cargo.toml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ pink = { path = "../pink/runner", package = "pink-runner" }
3131
pink-extension-runtime = { path = "../pink/pink-extension-runtime" }
3232
pink-extension = { path = "../pink/pink-extension" }
3333

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

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

5958
fixed = "1.9.0"
6059
fixed-sqrt = "0.2.4"

crates/phactory/api/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ prpc = { path = "../../../crates/prpc", default-features = false }
1818
phala-crypto = { path = "../../../crates/phala-crypto" }
1919
chain = { path = "../../../standalone/runtime", default-features = false, package = "phala-node-runtime" }
2020

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

2727
# for pruntime_client

crates/phactory/src/light_validation/mod.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use std::collections::BTreeMap;
4747
use std::fmt;
4848
use std::marker::PhantomData;
4949

50-
use anyhow::Result;
50+
use anyhow::{Context, Result};
5151
use error::JustificationError;
5252
use justification::GrandpaJustification;
5353
use log::{error, info};
@@ -289,14 +289,21 @@ where
289289
// By encoding the given set we should have an easy way to compare
290290
// with the stuff we get out of storage via `read_value`
291291
let encoded_validator_set = validator_set.encode();
292-
let matches = if let Some(authorities) = checker.read_value(b":grandpa_authorities")? {
293-
encoded_validator_set.get(..) == authorities.get(1..)
292+
293+
let alt_key = utils::storage_prefix("Grandpa", "Authorities");
294+
let old_key = b":grandpa_authorities";
295+
296+
let matches = if let Some(authorities) = checker
297+
.read_value(&alt_key)
298+
.context("Faield to read Grandpa::Authorities")?
299+
{
300+
encoded_validator_set == authorities
294301
} else {
295-
let key = utils::storage_prefix("Grandpa", "Authorities");
296302
let authorities = checker
297-
.read_value(&key)?
298-
.ok_or_else(|| anyhow::Error::msg(Error::StorageValueUnavailable))?;
299-
encoded_validator_set == authorities
303+
.read_value(old_key)
304+
.context("Faield to read :grandpa_authorities")?
305+
.ok_or_else(|| anyhow::anyhow!("Missing grandpa authorities"))?;
306+
encoded_validator_set.get(..) == authorities.get(1..)
300307
};
301308

302309
// TODO: check set_id

crates/phactory/src/light_validation/storage_proof.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ use hash_db::{HashDB, Hasher, EMPTY_PREFIX};
2121
use sp_trie::trie_types::TrieDBBuilder;
2222
use sp_trie::{trie_types::TrieDB, MemoryDB, Trie};
2323

24-
use super::Error;
25-
2624
pub(crate) type StorageProof = Vec<Vec<u8>>;
2725

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

6664
fn trie(&self) -> TrieDB<H> {

crates/phala-crypto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2018"
55
resolver = "2"
66

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

1010
ring = { version = "0.16.20", default-features = false, features = ["alloc"] }
1111
curve25519-dalek = { version = "2.0", default-features = false }

crates/phala-mq/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ hex = { version = "0.4.3", default-features = false, features = ['alloc'] }
1212
derive_more = { version = "0.99", default-features = false, features = ["display"] }
1313
parity-scale-codec = { version = "3.6.5", default-features = false, features = ["derive"] }
1414
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
15-
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.2.0", default-features = false }
15+
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", branch = "release-polkadot-v1.5.0", default-features = false }
1616
serde = { version = "1.0", default-features = false, features = ["derive"] }
1717

1818
spin = { version = "0.9", default-features = false, features = ["mutex", "use_ticket_mutex"], optional = true }

crates/phala-node-rpc-ext/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ hex = { version = "0.4.3", default-features = false }
1717
codec = { package = "parity-scale-codec", version = "3.6.5" }
1818

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

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

2828
phala-mq = { path = "../../crates/phala-mq" }
2929
phala-pallets = { path = "../../pallets/phala" }

crates/phala-node-rpc-ext/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ use jsonrpsee::{
99
RpcModule,
1010
};
1111
use pallet_mq_runtime_api::MqApi;
12-
use sc_client_api::blockchain::{HeaderBackend, HeaderMetadata};
13-
use sc_client_api::{Backend, BlockBackend, StorageProvider};
12+
use sc_client_api::{
13+
blockchain::{HeaderBackend, HeaderMetadata},
14+
Backend, BlockBackend, StateBackend, StorageProvider,
15+
};
1416
use sc_transaction_pool_api::{InPoolTransaction, TransactionPool};
15-
use sp_api::{ApiExt, Core, ProvideRuntimeApi, StateBackend};
17+
use sp_api::{ApiExt, Core, ProvideRuntimeApi};
1618
use sp_runtime::traits::Header;
1719
use sp_runtime::{generic::BlockId, traits::Block as BlockT};
1820
use std::fmt::Display;

0 commit comments

Comments
 (0)