Skip to content
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
35 changes: 35 additions & 0 deletions .github/workflows/client-release-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create client release ticket
on:
workflow_dispatch:
inputs:
from:
description: "Previous client version"
required: true
to:
description: "Next client version"
required: true

jobs:
create_client_ticket:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Generate client release issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd tools
yarn install
yarn --silent run print-client-release-issue --from ${{ github.event.inputs.from }} --to ${{ github.event.inputs.to }} | tee ../client-release-issue.md
- name: Create version bump issue
uses: peter-evans/create-issue-from-file@v3
with:
title: v${{ github.event.inputs.to }} release
content-filepath: ./client-release-issue.md
labels: |
automated issue
2 changes: 2 additions & 0 deletions .github/workflows/publish-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ jobs:
with:
node-version: 14.x
- name: Generate release body
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: generate-release-body
run: |
cd tools
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/runtime-release-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create runtime release ticket
on:
workflow_dispatch:
inputs:
from:
description: "Previous runtime version"
required: true
to:
description: "Next runtime version"
required: true

jobs:
create_runtime_ticket:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Generate runtime release issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd tools
yarn install
yarn --silent run print-runtime-release-issue --from ${{ github.event.inputs.from }} --to ${{ github.event.inputs.to }} | tee ../runtime-release-issue.md
- name: Create version bump issue
uses: peter-evans/create-issue-from-file@v3
with:
title: v${{ github.event.inputs.to }} release
content-filepath: ./runtime-release-issue.md
labels: |
automated issue
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ fn load_spec(
para_id: ParaId,
run_cmd: &RunCmd,
) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
if id.is_empty() {
return Err("Not specific which chain to run.".into());
}
Ok(match id {
// Moonbase networks
"moonbase-alpha" | "alphanet" => Box::new(chain_spec::RawChainSpec::from_json_bytes(
Expand All @@ -66,14 +63,9 @@ fn load_spec(
"moonriver-local" => Box::new(chain_spec::moonriver::get_chain_spec(para_id)),

// Moonbeam networks
"moonbeam" => {
return Err(
"You chosen the moonbeam mainnet spec. This network is not yet available.".into(),
);
// Box::new(chain_spec::RawChainSpec::from_json_bytes(
// &include_bytes!("../../../specs/moonbeam.json")[..],
// )?)
}
"moonbeam" | "" => Box::new(chain_spec::RawChainSpec::from_json_bytes(
&include_bytes!("../../../specs/moonbeam/parachain-embedded-specs.json")[..],
)?),
#[cfg(feature = "moonbeam-native")]
"moonbeam-dev" => Box::new(chain_spec::moonbeam::development_chain_spec(None, None)),
#[cfg(feature = "moonbeam-native")]
Expand Down
88 changes: 87 additions & 1 deletion pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,63 @@ pub mod pallet {
pub state: CollatorStatus,
}

// Temporary manual implementation for migration testing purposes
impl<A: PartialEq, B: PartialEq> PartialEq for CollatorCandidate<A, B> {
fn eq(&self, other: &Self) -> bool {
let must_be_true = self.id == other.id
&& self.bond == other.bond
&& self.total_counted == other.total_counted
&& self.total_backing == other.total_backing
&& self.request == other.request
&& self.state == other.state;
if !must_be_true {
return false;
}
for (x, y) in self.delegators.0.iter().zip(other.delegators.0.iter()) {
if x != y {
return false;
}
}
for (
Bond {
owner: o1,
amount: a1,
},
Bond {
owner: o2,
amount: a2,
},
) in self
.top_delegations
.iter()
.zip(other.top_delegations.iter())
{
if o1 != o2 || a1 != a2 {
return false;
}
}
for (
Bond {
owner: o1,
amount: a1,
},
Bond {
owner: o2,
amount: a2,
},
) in self
.bottom_delegations
.iter()
.zip(other.bottom_delegations.iter())
{
if o1 != o2 || a1 != a2 {
return false;
}
}
true
}
}

/// Convey relevant information describing if a delegator was added to the top or bottom
/// Delegations added to the top yield a new total
#[derive(Clone, Copy, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
Expand Down Expand Up @@ -634,6 +691,35 @@ pub mod pallet {
pub status: DelegatorStatus,
}

// Temporary manual implementation for migration testing purposes
impl<A: PartialEq, B: PartialEq> PartialEq for Delegator<A, B> {
fn eq(&self, other: &Self) -> bool {
let must_be_true = self.id == other.id
&& self.total == other.total
&& self.requests == other.requests
&& self.status == other.status;
if !must_be_true {
return false;
}
for (
Bond {
owner: o1,
amount: a1,
},
Bond {
owner: o2,
amount: a2,
},
) in self.delegations.0.iter().zip(other.delegations.0.iter())
{
if o1 != o2 || a1 != a2 {
return false;
}
}
true
}
}

impl<
AccountId: Ord + Clone + Default,
Balance: Copy
Expand Down Expand Up @@ -1005,7 +1091,7 @@ pub mod pallet {
pub action: DelegationChange,
}

#[derive(Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
#[derive(Clone, Encode, PartialEq, Decode, RuntimeDebug, TypeInfo)]
/// Pending requests to mutate delegations for each delegator
pub struct PendingDelegationRequests<AccountId, Balance> {
/// Number of pending revocations (necessary for determining whether revoke is exit)
Expand Down
27 changes: 18 additions & 9 deletions pallets/parachain-staking/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ use crate::{
BalanceOf, CandidateState, CollatorCandidate, CollatorState2, Config, DelegatorState,
ExitQueue2, NominatorState2, Points, Round, Staked,
};
#[cfg(feature = "try-runtime")]
use crate::{Collator2, Delegator, Nominator2};
#[cfg(feature = "try-runtime")]
use frame_support::Twox64Concat;
use frame_support::{
pallet_prelude::PhantomData,
traits::{Get, OnRuntimeUpgrade},
Expand Down Expand Up @@ -83,7 +87,10 @@ impl<T: Config> OnRuntimeUpgrade for RemoveExitQueue<T> {

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
use frame_support::{storage::migration::storage_iter, traits::OnRuntimeUpgradeHelpersExt};
use frame_support::{
storage::migration::{storage_iter, storage_key_iter},
traits::OnRuntimeUpgradeHelpersExt,
};

let pallet_prefix: &[u8] = b"ParachainStaking";
let collator_state_prefix: &[u8] = b"CollatorState2";
Expand Down Expand Up @@ -150,11 +157,12 @@ impl<T: Config> OnRuntimeUpgrade for RemoveExitQueue<T> {
// Check that our example candidate is converted correctly
if new_candidate_count > 0 {
let (account, original_collator_state): (
T::AuthorId,
T::AccountId,
Collator2<T::AccountId, BalanceOf<T>>,
) = Self::get_temp_storage("example_collator").expect("qed");
let new_candidate_state = CandidateState::<T>::get(account).expect("qed");
let old_candidate_converted: CollatorCandidate<_, _> = original_collator_state.into();
let old_candidate_converted: CollatorCandidate<T::AccountId, BalanceOf<T>> =
original_collator_state.into();
assert_eq!(new_candidate_state, old_candidate_converted);
}

Expand All @@ -164,15 +172,16 @@ impl<T: Config> OnRuntimeUpgrade for RemoveExitQueue<T> {
let new_delegator_count = DelegatorState::<T>::iter().count() as u64;
assert_eq!(old_nominator_count, new_delegator_count);

// Check that our example nominator is converted correctly
// Check that our example delegator is converted correctly
if new_delegator_count > 0 {
let (account, original_nominator_state): (
T::AuthorId,
let (account, original_delegator_state): (
T::AccountId,
Nominator2<T::AccountId, BalanceOf<T>>,
) = Self::get_temp_storage("example_nominator").expect("qed");
let new_candidate_state = DelegatorState::<T>::get(account).expect("qed");
let old_candidate_converted: Delegator<_, _> = original_nominator_state.into();
assert_eq!(old_candidate_converted, new_candidate_state);
let new_delegator_state = DelegatorState::<T>::get(&account).expect("qed");
let old_delegator_converted: Delegator<T::AccountId, BalanceOf<T>> =
migrate_nominator_to_delegator_state::<T>(account, original_delegator_state);
assert_eq!(old_delegator_converted, new_delegator_state);
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion primitives/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub use serde::{de::DeserializeOwned, Deserialize, Serialize};
Clone,
Encode,
Decode,
sp_core::RuntimeDebug,
Debug,
TypeInfo,
MaxEncodedLen,
Default,
Expand Down
6 changes: 6 additions & 0 deletions runtime/moonbase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ scale-info = { version = "1.0", default-features = false, features = [ "derive"
sp-api = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-block-builder = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-core = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-debug-derive = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-inherents = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-io = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-offchain = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
Expand Down Expand Up @@ -220,8 +221,13 @@ std = [
"xcm/std",
"xtokens-precompiles/std",
]

# Must be enabled for tracing runtimes only
evm-tracing = [ "evm-tracing-events", "moonbeam-evm-tracer", "rlp", "sha3" ]

# Allow to print logs details (no wasm:stripped)
force-debug = [ "sp-debug-derive/force-debug" ]

# Will be enabled by the `wasm-builder` when building the runtime for WASM.
runtime-wasm = []

Expand Down
6 changes: 6 additions & 0 deletions runtime/moonbeam/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ scale-info = { version = "1.0", default-features = false, features = [ "derive"
sp-api = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-block-builder = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-core = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-debug-derive = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-inherents = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-io = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-offchain = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
Expand Down Expand Up @@ -173,8 +174,13 @@ std = [
"sp-transaction-pool/std",
"sp-version/std",
]

# Must be enabled for tracing runtimes only
evm-tracing = [ "evm-tracing-events", "moonbeam-evm-tracer", "rlp", "sha3" ]

# Allow to print logs details (no wasm:stripped)
force-debug = [ "sp-debug-derive/force-debug" ]

# Will be enabled by the `wasm-builder` when building the runtime for WASM.
runtime-wasm = []

Expand Down
6 changes: 6 additions & 0 deletions runtime/moonriver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ scale-info = { version = "1.0", default-features = false, features = [ "derive"
sp-api = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-block-builder = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-core = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-debug-derive = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-inherents = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-io = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
sp-offchain = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.13", default-features = false }
Expand Down Expand Up @@ -174,8 +175,13 @@ std = [
"sp-transaction-pool/std",
"sp-version/std",
]

# Must be enabled for tracing runtimes only
evm-tracing = [ "evm-tracing-events", "moonbeam-evm-tracer", "rlp", "sha3" ]

# Allow to print logs details (no wasm:stripped)
force-debug = [ "sp-debug-derive/force-debug" ]

# Will be enabled by the `wasm-builder` when building the runtime for WASM.
runtime-wasm = []

Expand Down
Loading