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 v0.9.43 #293

Merged
merged 9 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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,671 changes: 878 additions & 793 deletions Cargo.lock

Large diffs are not rendered by default.

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.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.42", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", 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
2 changes: 1 addition & 1 deletion crates/phala-mq/src/checkpoint_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod send_mq {
}

mod dispatcher {
use crate::{Message, MessageDispatcher, Path, dispatcher::Receiver};
use crate::{dispatcher::Receiver, Message, MessageDispatcher, Path};

environmental::environmental!(global_dispatcher: MessageDispatcher);

Expand Down
4 changes: 2 additions & 2 deletions crates/phala-mq/src/signer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ pub trait MessageVerifier {
pub mod signers {
use super::MessageSigner;
use alloc::vec::Vec;
use sp_core::{crypto::Pair as PairTrait, sr25519};
use serde::{Serialize, Deserialize};
use phala_serde_more as more;
use serde::{Deserialize, Serialize};
use sp_core::{crypto::Pair as PairTrait, sr25519};

#[derive(Serialize, Deserialize, Clone)]
pub struct Sr25519Signer {
Expand Down
5 changes: 1 addition & 4 deletions crates/phala-mq/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ impl MessageOrigin {

/// Returns if we can trust the origin to not send us non-well-formed messages
pub fn always_well_formed(&self) -> bool {
matches!(
self,
Self::Pallet(_) | Self::Worker(_) | Self::Gatekeeper
)
matches!(self, Self::Pallet(_) | Self::Worker(_) | Self::Gatekeeper)
}

/// Returns if the origin is from a Gatekeeper
Expand Down
2 changes: 1 addition & 1 deletion crates/phala-mq/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use phala_mq::MessageOrigin;
use phala_mq::traits::MessageChannel;
use phala_mq::MessageOrigin;

#[cfg(feature = "queue")]
#[test]
Expand Down
12 changes: 6 additions & 6 deletions crates/phala-node-rpc-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ 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.42" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }

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

phala-mq = { path = "../../crates/phala-mq" }
phala-pallets = { path = "../../pallets/phala" }
Expand Down
12 changes: 3 additions & 9 deletions crates/phala-node-rpc-ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use jsonrpsee::{
core::{async_trait, Error as JsonRpseeError, RpcResult},
proc_macros::rpc,
types::error::{CallError, ErrorObject},
RpcModule
RpcModule,
};
use pallet_mq_runtime_api::MqApi;
use sc_client_api::blockchain::{HeaderBackend, HeaderMetadata};
Expand Down Expand Up @@ -142,12 +142,6 @@ pub fn extend_rpc<Client, BE, Block, P>(
<<Block as BlockT>::Header as Header>::Number: Into<u64>,
P: TransactionPool + 'static,
{
io.merge(
NodeRpcExt::new(
client,
backend,
is_archive_mode,
pool,
).into_rpc(),
).expect("Initialize Phala node RPC ext failed.");
io.merge(NodeRpcExt::new(client, backend, is_archive_mode, pool).into_rpc())
.expect("Initialize Phala node RPC ext failed.");
}
18 changes: 8 additions & 10 deletions crates/phala-node-rpc-ext/src/storage_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ impl Error {

impl From<Error> for JsonRpseeError {
fn from(e: Error) -> Self {
JsonRpseeError::Call(
CallError::Custom(
ErrorObject::owned(
CUSTOM_RPC_ERROR,
e.to_string(),
Option::<()>::None
)
)
)
JsonRpseeError::Call(CallError::Custom(ErrorObject::owned(
CUSTOM_RPC_ERROR,
e.to_string(),
Option::<()>::None,
)))
}
}

Expand Down Expand Up @@ -109,7 +105,9 @@ where
.into_iter()
.map(|(id, mut header)| -> Result<_, Error> {
let api = client.runtime_api();
let hash = client.expect_block_hash_from_id(&id).expect("Should get the block hash");
let hash = client
.expect_block_hash_from_id(&id)
.expect("Should get the block hash");
if (*header.number()).into() == 0u64 {
let state = backend
.state_at(hash)
Expand Down
28 changes: 14 additions & 14 deletions crates/phala-pallet-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ codec = { package = "parity-scale-codec", version = "3.0", default-features = fa
scale-info = { version = "2.0", default-features = false, features = ["derive", "serde", "decode"] }

# Substrate
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }

# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
# Polkadot
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42" }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43" }

[features]
default = ["std"]
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/substrate", branch = "polkadot-v0.9.42", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
scale = { package = "parity-scale-codec", version = "3.3", default-features = false }
hex = { version = "0.4.3", default-features = false, features = ["alloc"] }

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.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.42", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", 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/substrate", branch = "polkadot-v0.9.42" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", 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.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.42", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }

phala-mq = { path = "../../crates/phala-mq", default-features = false }
prpc = { path = "../../crates/prpc", default-features = false }
Expand Down
6 changes: 2 additions & 4 deletions crates/phala-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ pub mod contract;
use alloc::borrow::Cow;
use alloc::string::String;
use alloc::vec::Vec;
use codec::{Decode, Encode};
use core::fmt::Debug;
use scale_info::TypeInfo;
use sp_core::H256;
use codec::{Decode, Encode};

#[cfg(feature = "enable_serde")]
use serde::{Deserialize, Serialize};
Expand All @@ -27,9 +27,7 @@ pub mod messaging {
#[cfg(feature = "enable_serde")]
use serde::{Deserialize, Serialize};

use super::{
EcdhPublicKey, MasterPublicKey, WorkerIdentity, WorkerPublicKey,
};
use super::{EcdhPublicKey, MasterPublicKey, WorkerIdentity, WorkerPublicKey};

pub use phala_mq::bind_topic;
pub use phala_mq::types::*;
Expand Down
Loading