Skip to content

Commit

Permalink
Upgrade to Polkadot 0.9.30
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Oct 8, 2022
1 parent 0eb8246 commit d80afb9
Show file tree
Hide file tree
Showing 40 changed files with 1,633 additions and 1,239 deletions.
867 changes: 520 additions & 347 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ members = [
rocket = { version = "0.5.0-rc.2", git = "https://github.com/SergioBenitez/Rocket" }

# For pink-extension-runtime, it will introduce Substrate from crates-io which usually different with polkadot-branch
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
18 changes: 9 additions & 9 deletions crates/phactory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ 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.29", features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", features = ["disable_target_static_assertions"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", features = ["disable_panic_handler", "disable_oom", "disable_allocator"] }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", features = ["disable_target_static_assertions"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
parity-scale-codec = { package = "parity-scale-codec", version = "3.1", default-features = false, features = ["derive", "full", "chain-error"] }
scopeguard = { version = "1.1", default-features = false }

Expand All @@ -53,11 +53,11 @@ 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.15", default-features = false, features = ["derive-codec"] }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

fixed = "1.9.0"
fixed-sqrt = "0.2.4"
Expand Down
10 changes: 5 additions & 5 deletions crates/phactory/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ 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.29", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", default-features = false, features = ["full_crypto"] }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", default-features = false }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false, features = ["full_crypto"] }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false }

# for pruntime_client
async-trait = "0.1.57"
Expand Down
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.29", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", 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 @@ -11,7 +11,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.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.29", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", 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
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.1" }
scale-info = { version = "2.1", default-features = false }

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

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

phala-mq = { path = "../../crates/phala-mq" }
phala-pallets = { path = "../../pallets/phala" }
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.29", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false }
scale = { package = "parity-scale-codec", version = "3.1", 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.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.29", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", features = ["full_crypto"] }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false }

serde = { version = "1.0", default-features = false, features = ["derive", "alloc"], optional = true }
hash-db = "0.15.2"
Expand All @@ -21,8 +21,8 @@ im = { version = "15", features = ["serde"] }
parity-util-mem = "0.11.0"

[dev-dependencies]
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", 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.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.29", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30", default-features = false }

phala-mq = { path = "../../crates/phala-mq", default-features = false }
prpc = { path = "../../crates/prpc", default-features = false }
Expand Down
8 changes: 5 additions & 3 deletions crates/phaxt/src/chain_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ impl ChainApi {
.fetch(&addr, hash)
.await
.context("Failed to fetch validation data")?
.ok_or(anyhow!("ValidationData not found"))?;
.ok_or(anyhow!("ValidationData not found"))?
.to_value()?;
let number = validation_data
.at("relay_parent_number")
.ok_or(anyhow!("No relay_parent_number"))?
Expand All @@ -54,7 +55,7 @@ impl ChainApi {
.await
.context("Failed to get current set_id")?
.ok_or(anyhow!("No set id"))?;
Ok(set_id.as_u128().ok_or(anyhow!("Invalid set id"))? as _)
Ok(set_id.to_value()?.as_u128().ok_or(anyhow!("Invalid set id"))? as _)
}

pub async fn get_paraid(&self, hash: Option<Hash>) -> Result<u32> {
Expand All @@ -64,7 +65,8 @@ impl ChainApi {
.fetch(&address, hash)
.await
.context("Failed to get current set_id")?
.ok_or(anyhow!("No paraid found"))?;
.ok_or(anyhow!("No paraid found"))?
.to_value()?;
let id = id
.at(0)
.ok_or(anyhow!("Invalid paraid"))?
Expand Down
32 changes: 16 additions & 16 deletions crates/pink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ edition = "2021"
[dependencies]
sha2 = "0.10.2"
log = "0.4.14"
pallet-contracts = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-contracts-proc-macro = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-contracts = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-contracts-proc-macro = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-sandbox = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-sandbox = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

scale = { package = "parity-scale-codec", version = "3.1", default-features = false, features = ["derive"] }
scale-info = { version = "2.1", default-features = false, features = ["derive", "serde", "decode"] }
Expand Down
14 changes: 6 additions & 8 deletions crates/pink/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ impl frame_system::Config for PinkRuntime {
type BlockWeights = RuntimeBlockWeights;
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type RuntimeOrigin = RuntimeOrigin;
type Index = Index;
type BlockNumber = BlockNumber;
type Hash = Hash;
type Call = Call;
type RuntimeCall = RuntimeCall;
type Hashing = Hashing;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header<Self::BlockNumber, Self::Hashing>;
type Event = Event;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
Expand Down Expand Up @@ -98,7 +98,6 @@ parameter_types! {
pub const DeletionQueueDepth: u32 = 1024;
pub const DeletionWeightLimit: Weight = Weight::from_ref_time(500_000_000_000);
pub const MaxCodeLen: u32 = 2 * 1024 * 1024;
pub const RelaxedMaxCodeLen: u32 = 2 * 1024 * 1024;
pub const TransactionByteFee: u64 = 0;
pub const MaxStorageKeyLen: u32 = 128;

Expand All @@ -122,8 +121,8 @@ impl Config for PinkRuntime {
type Time = Timestamp;
type Randomness = Randomness;
type Currency = mock_types::NoCurrency;
type Event = Event;
type Call = Call;
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type CallFilter = frame_support::traits::Everything;
type CallStack = [Frame<Self>; 31];
type WeightPrice = Self;
Expand All @@ -137,7 +136,6 @@ impl Config for PinkRuntime {
type AddressGenerator = Pink;
type ContractAccessWeight = pallet_contracts::DefaultContractAccessWeight<RuntimeBlockWeights>;
type MaxCodeLen = MaxCodeLen;
type RelaxedMaxCodeLen = RelaxedMaxCodeLen;
type MaxStorageKeyLen = MaxStorageKeyLen;
}

Expand Down Expand Up @@ -196,7 +194,7 @@ mod tests {
use sp_runtime::{traits::Hash, AccountId32};

use crate::{
runtime::{Contracts, Origin, PinkRuntime},
runtime::{Contracts, RuntimeOrigin as Origin, PinkRuntime},
types::{ENOUGH, QUERY_GAS_LIMIT},
};
pub use frame_support::weights::Weight;
Expand Down
4 changes: 2 additions & 2 deletions crates/pink/src/runtime/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl ExecSideEffects {

fn deposit_pink_event(contract: AccountId, event: PinkEvent) {
let topics = [pink_extension::PinkEvent::event_topic().into()];
let event = super::Event::Contracts(pallet_contracts::Event::ContractEmitted {
let event = super::RuntimeEvent::Contracts(pallet_contracts::Event::ContractEmitted {
contract,
data: event.encode(),
});
Expand All @@ -54,7 +54,7 @@ fn deposit_pink_event(contract: AccountId, event: PinkEvent) {
pub fn get_side_effects() -> ExecSideEffects {
let mut result = ExecSideEffects::default();
for event in super::System::events() {
if let super::Event::Contracts(ink_event) = event.event {
if let super::RuntimeEvent::Contracts(ink_event) = event.event {
use pallet_contracts::Event as ContractEvent;
match ink_event {
ContractEvent::Instantiated {
Expand Down
Loading

0 comments on commit d80afb9

Please sign in to comment.