Skip to content

Commit

Permalink
Upgrade to Polkadot v0.9.39
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Mar 20, 2023
1 parent ac65c00 commit 45fae7c
Show file tree
Hide file tree
Showing 54 changed files with 4,112 additions and 2,953 deletions.
1,648 changes: 856 additions & 792 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 @@ -92,10 +92,10 @@ rocket = { version = "0.5.0-rc.2", git = "https://github.com/SergioBenitez/Rocke
# TODO.kevin: Move back to crates.io once it released 1.0
derive_more = { version = "0.99.17", git = "https://github.com/JelteF/derive_more" }

sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-core-hashing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-core-hashing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }

# 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
26 changes: 13 additions & 13 deletions crates/phactory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde_cbor = "0.11.2"
hex = { version = "0.4", default-features = false, features = ["alloc"] }
hex-literal = "0.3"
hex_fmt = "0.3"
anyhow = { version = "1.0", default-features = false }
anyhow = { version = "1.0.69", default-features = false }
thiserror = { version = "1.0", default-features = false }
itertools = { version = "0.10.1", default-features = false }

Expand All @@ -34,12 +34,12 @@ phala-crypto = { path = "../phala-crypto", features = ["getrandom", "stream"] }
prpc = { path = "../prpc" }
pink = { path = "../pink" }

sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", features = ["disable_target_static_assertions"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
parity-scale-codec = { package = "parity-scale-codec", version = "3.1", default-features = false, features = ["derive", "full", "chain-error"] }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", features = ["disable_target_static_assertions"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
parity-scale-codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive", "full", "chain-error"] }
scopeguard = { version = "1.1", default-features = false }

# Phala specific
Expand All @@ -54,18 +54,18 @@ derive_more = "0.99.0"
hash-db = { version = "0.15.2", 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/substrate", branch = "polkadot-v0.9.37" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }

fixed = "1.9.0"
fixed-sqrt = "0.2.4"
fixed-macro = "1.2"

# for network service
surf = { version = "2.3.1", default-features = false, features = ["h1-client-rustls"] }
surf = { version = "2.3.2", default-features = false, features = ["h1-client-rustls"] }
futures = { version = "0.3.17", default-features = false }
async-io = { version = "1.6.0" }
async-executor = { version = "1.4.1" }
Expand Down
16 changes: 8 additions & 8 deletions crates/phactory/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2018"
resolver = "2"

[dependencies]
parity-scale-codec = { package = "parity-scale-codec", version = "3.1", default-features = false, features = ["derive"] }
scale-info = { version = "2.1", default-features = false, features = ["derive"] }
parity-scale-codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
serde = { version = "1", features = ["derive"], default-features = false }
base64 = { version = "0.13" }
derive_more = { version = "0.99.17" }
Expand All @@ -19,15 +19,15 @@ phala-crypto = { path = "../../../crates/phala-crypto" }
phala-mq = { path = "../../../crates/phala-mq" }
chain = { path = "../../../standalone/runtime", default-features = false, package = "phala-node-runtime" }

sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false, features = ["full_crypto"] }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false, features = ["full_crypto"] }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }

# for pruntime_client
async-trait = "0.1.57"
anyhow = { version = "1.0.43", optional = true }
anyhow = { version = "1.0.69", optional = true }
log = { version = "0.4.14" }
reqwest = { version = "0.11", optional = true, default-features = false, features = ["rustls-tls", "socks"] }

Expand Down
2 changes: 1 addition & 1 deletion crates/phactory/pal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ edition = "2018"
description = "Platform abstraction layer for Phactory Runtime"

[dependencies]
anyhow = "1.0.43"
anyhow = "1.0.69"
phala-types = { path = "../../phala-types", default-features = false, features = ["enable_serde", "sgx"] }
4 changes: 2 additions & 2 deletions crates/phala-crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2018"
resolver = "2"

[dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }

ring = { version = "0.16.20", default-features = false, features = ["alloc"] }
curve25519-dalek = { version = "2.0", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions crates/phala-mq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ edition = "2018"
log = "0.4.14"
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.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
parity-scale-codec = { version = "3.3", default-features = false, features = ["derive"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", 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
16 changes: 8 additions & 8 deletions crates/phala-node-rpc-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jsonrpsee = { version = "0.16.2", features = ["server"] }
impl-serde = "0.4.0"
log = { version = "0.4.14", default-features = false }
hex = { version = "0.4.3", default-features = false }
codec = { package = "parity-scale-codec", version = "3.1" }
scale-info = { version = "2.1", default-features = false }
codec = { package = "parity-scale-codec", version = "3.3" }
scale-info = { version = "2.3", default-features = false }

# primitives
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }

# client dependencies
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }

phala-mq = { path = "../../crates/phala-mq" }
phala-pallets = { path = "../../pallets/phala" }
Expand Down
3 changes: 1 addition & 2 deletions crates/phala-node-rpc-ext/src/mq_seq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ where

let api = client.runtime_api();
let best_hash = client.info().best_hash;
let at = BlockId::hash(best_hash);

let seq = api.sender_sequence(&at, &sender)?.unwrap_or(0);
let seq = api.sender_sequence(best_hash, &sender)?.unwrap_or(0);

log::debug!(target: "rpc-ext", "State seq for {}: {}", sender, seq);

Expand Down
15 changes: 9 additions & 6 deletions crates/phala-node-rpc-ext/src/storage_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ where
.map_err(|e| Error::invalid_block(id, e))?;
return Ok(StorageChanges {
main_storage_changes: state
.pairs()
.pairs(Default::default())
.unwrap()
.into_iter()
.map(|(k, v)| (StorageKey(k), Some(StorageKey(v))))
.map(|pair| {
let (k, v) = pair.expect("Should get the key and value");
(StorageKey(k), Some(StorageKey(v)))
})
.collect(),
child_storage_changes: vec![],
});
Expand All @@ -129,23 +133,22 @@ where
.map_err(|e| Error::invalid_block(id, e))?
.ok_or_else(|| Error::invalid_block(id, "block body not found"))?;
let parent_hash = *header.parent_hash();
let parent_id = BlockId::Hash(parent_hash);

// Remove all `Seal`s as they are added by the consensus engines after building the block.
// On import they are normally removed by the consensus engine.
header.digest_mut().logs.retain(|d| d.as_seal().is_none());

let block = Block::new(header, extrinsics);
api.execute_block(&parent_id, block)
api.execute_block(parent_hash, block)
.map_err(|e| Error::invalid_block(id, e))?;

let state = backend
.state_at(hash)
.map_err(|e| Error::invalid_block(parent_id, e))?;
.map_err(|e| Error::invalid_block(BlockId::<Block>::Hash(parent_hash), e))?;

let storage_changes = api
.into_storage_changes(&state, parent_hash)
.map_err(|e| Error::invalid_block(parent_id, e))?;
.map_err(|e| Error::invalid_block(BlockId::<Block>::Hash(parent_hash), e))?;

Ok(StorageChanges {
main_storage_changes: storage_changes.main_storage_changes.into_(),
Expand Down
4 changes: 2 additions & 2 deletions crates/phala-node-rpc-ext/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
impl-serde = "0.4.0"
scale-info = { version = "2.1", default-features = false }
scale = { package = "parity-scale-codec", version = "3.1" }
scale-info = { version = "2.3", default-features = false }
scale = { package = "parity-scale-codec", version = "3.3" }
4 changes: 2 additions & 2 deletions crates/phala-serde-more/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2021"

[dependencies]
serde = { version = "1.0.130", default-features = false, features = ["derive", "alloc"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
scale = { package = "parity-scale-codec", version = "3.1", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
scale = { package = "parity-scale-codec", version = "3.3", default-features = false }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }

[features]
Expand Down
16 changes: 8 additions & 8 deletions crates/phala-trie-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ homepage = "https://phala.network/"
repository = "https://github.com/Phala-Network/phala-blockchain"

[dependencies]
parity-scale-codec = { version = "3.0", default-features = false }
scale-info = { version = "2.0", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
parity-scale-codec = { version = "3.3", default-features = false }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }

serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }
hash-db = "0.15.2"
trie-db = "0.24.0"
trie-db = "0.25.1"
im = { version = "15", features = ["serde"] }
log = "0.4"

[dev-dependencies]
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", features = ["full_crypto"] }
hash256-std-hasher = { version = "0.15", default-features = false }
hex = "0.4"
serde_json = "1.0"
Expand Down
17 changes: 10 additions & 7 deletions crates/phala-trie-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ pub mod ser;

mod memdb;

use std::iter::FromIterator;
#[cfg(feature = "serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};

use core::iter::FromIterator;

use parity_scale_codec::Codec;
use sp_core::storage::ChildInfo;
use sp_core::Hasher;
use sp_state_machine::{Backend, TrieBackend, TrieBackendBuilder};
use sp_state_machine::{Backend, IterArgs, TrieBackend, TrieBackendBuilder};
use sp_trie::{trie_types::TrieDBMutBuilderV0 as TrieDBMutBuilder, TrieMut};

pub use memdb::GenericMemoryDB as MemoryDB;
Expand Down Expand Up @@ -168,12 +167,16 @@ where
}

fn pairs_into<R: FromIterator<(Vec<u8>, Vec<u8>)>>(&self, prefix: impl AsRef<[u8]>) -> R {
let mut iter_args = IterArgs::default();
iter_args.prefix = Some(prefix.as_ref());

self.0
.keys(prefix.as_ref())
.pairs(iter_args)
.unwrap()
.into_iter()
.map(|key| {
let value = self.get(&key).expect("Reflected key should exists");
(key, value)
.map(|pair| {
let (k, v) = pair.expect("Should get the key and value");
(k, v)
})
.collect()
}
Expand Down
6 changes: 3 additions & 3 deletions crates/phala-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ edition = "2018"
[dependencies]
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.1", default-features = false, features = ["full"] }
scale-info = { version = "2.1", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
codec = { package = "parity-scale-codec", version = "3.3", default-features = false, features = ["full"] }
scale-info = { version = "2.3", default-features = false, features = ["derive"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }

phala-mq = { path = "../../crates/phala-mq", default-features = false }
prpc = { path = "../../crates/prpc", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions crates/phaxt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ edition = "2018"
[dependencies]
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.67"
parity-scale-codec = "3.0"
scale-info = '2.0'
parity-scale-codec = "3.3"
scale-info = '2.3'
anyhow = "1"
tokio = "1"

Expand All @@ -16,5 +16,5 @@ phala-types = { path = "../phala-types" }
phala-node-rpc-ext-types = { path = "../phala-node-rpc-ext/types" }
phala-pallets = { path = "../../pallets/phala" }
jsonrpsee = "0.16.2"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.37", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.39", default-features = false }
primitive-types = { version = "0.12.0", default-features = false }
2 changes: 1 addition & 1 deletion crates/phaxt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Deref for ChainApi {
}

pub use subxt;
pub type BlockNumber = <Config as subxt::Config>::BlockNumber;
pub type BlockNumber = u32;
pub type Hash = primitive_types::H256;
pub type AccountId = <Config as subxt::Config>::AccountId;
pub type Index = <Config as subxt::Config>::Index;
Expand Down
Loading

0 comments on commit 45fae7c

Please sign in to comment.