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

Release v3.2.0 #572

Merged
merged 8 commits into from Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion CHANGELOG.md
@@ -1,15 +1,29 @@
# CHANGELOG

## Unreleased
## v3.2.0
### Breaking changes
[\#550](https://github.com/Manta-Network/Manta/pull/550) Remove sudo pallet from calamari runtime.
Garandor marked this conversation as resolved.
Show resolved Hide resolved

### Features
- [\#529](https://github.com/Manta-Network/Manta/pull/529) Add RPC for MantaPay to synchronize with latest ledger state

### Improvements
[\#481](https://github.com/Manta-Network/Manta/pull/481) Update upstream dependencies to v0.9.18.
[\#491](https://github.com/Manta-Network/Manta/pull/491) Revamp collator-selection.
[\#493](https://github.com/Manta-Network/Manta/pull/493) Dedupe mock-xcm tests (part 1).
[\#505](https://github.com/Manta-Network/Manta/pull/505) Proper bare-metal instances for benchmarking workflows.
[\#507](https://github.com/Manta-Network/Manta/pull/507) Add issue template for Calamari xcm onboarding of other parachains.
[\#519](https://github.com/Manta-Network/Manta/pull/519) Concrete fungible ledger integration tests.
[\#523](https://github.com/Manta-Network/Manta/pull/523) Move xcm and assets related runtime configurations to own files.
[\#531](https://github.com/Manta-Network/Manta/pull/531) Clean up AssetManager migration code.
[\#541](https://github.com/Manta-Network/Manta/pull/541) Skip build on too tiny change.
[\#542](https://github.com/Manta-Network/Manta/pull/542) Update xcm integrations template issue.
[\#560](https://github.com/Manta-Network/Manta/pull/560) Bump srtool to v0.4.0.

### Bug fixes
[\#558](https://github.com/Manta-Network/Manta/pull/558) Fix try runtime and metadata diff ci workflows.
[\#567](https://github.com/Manta-Network/Manta/pull/567) Fix file structure of relay chian specs.
[\#570](https://github.com/Manta-Network/Manta/pull/570) Revert hard-coded branch of yamllint github action.

## v3.1.5-1
### Breaking changes
Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion node/Cargo.toml
Expand Up @@ -8,7 +8,7 @@ homepage = 'https://manta.network'
license = 'GPL-3.0'
name = 'manta'
repository = 'https://github.com/Manta-Network/Manta/'
version = '3.1.5'
version = '3.2.0'
default-run = "manta"

[package.metadata.docs.rs]
Expand Down
3 changes: 1 addition & 2 deletions node/src/chain_specs/dolphin.rs
Expand Up @@ -20,8 +20,7 @@ use dolphin_runtime::{CouncilConfig, DemocracyConfig, GenesisConfig, TechnicalCo
use manta_primitives::helpers::{get_account_id_from_seed, get_collator_keys_from_seed};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type DolphinChainSpec =
sc_service::GenericChainSpec<GenesisConfig, Extensions>;
pub type DolphinChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;

const DOLPHIN_PROTOCOL_ID: &str = "dolphin"; // for p2p network configuration
const KUSAMA_RELAYCHAIN_LOCAL_NET: &str = "kusama-local";
Expand Down
2 changes: 1 addition & 1 deletion pallets/asset-manager/Cargo.toml
@@ -1,7 +1,7 @@
[package]
authors = ['Manta Network']
name = "pallet-asset-manager"
version = "3.1.5"
version = "3.2.0"
edition = "2021"
homepage = 'https://manta.network'
license = 'GPL-3.0'
Expand Down
91 changes: 73 additions & 18 deletions pallets/asset-manager/src/lib.rs
Expand Up @@ -44,7 +44,11 @@ mod tests;
pub mod pallet {

use crate::weights::WeightInfo;
use frame_support::{pallet_prelude::*, traits::Contains, transactional, PalletId};
use frame_support::{
pallet_prelude::*,
traits::{Contains, StorageVersion},
transactional, PalletId,
};
use frame_system::pallet_prelude::*;
use manta_primitives::{
assets::{
Expand Down Expand Up @@ -532,7 +536,8 @@ pub mod pallet {
// Send tokens back to relaychain.
Junctions::X1(Junction::AccountId32 { .. }) => true,
// Send tokens to sibling chain.
Junctions::X2(Junction::Parachain(para_id), Junction::AccountId32 { .. }) => {
Junctions::X2(Junction::Parachain(para_id), Junction::AccountId32 { .. })
| Junctions::X2(Junction::Parachain(para_id), Junction::AccountKey20 { .. }) => {
Dengjianping marked this conversation as resolved.
Show resolved Hide resolved
AllowedDestParaIds::<T>::contains_key(para_id)
}
// We don't support X3 or longer Junctions.
Expand All @@ -556,23 +561,73 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_runtime_upgrade() -> Weight {
let mut reads: Weight = 0;
let mut writes: Weight = 0;
LocationAssetId::<T>::iter().for_each(|(location, _asset_id)| {
Dengjianping marked this conversation as resolved.
Show resolved Hide resolved
reads += 1;
if let Some(para_id) =
Self::get_para_id_from_multilocation(location.into().as_ref())
{
if para_id != 2084 {
let _ = Self::increase_count_of_associated_assets(para_id);
reads += 1; // There's one read in method increase_count_of_associated_assets.
writes += 1; // There's one write in method increase_count_of_associated_assets.
// currently, it's 0 on calamari.
let storage_version = Self::on_chain_storage_version();
if storage_version < 1 {
log::info!(target: "asset-manager", "Start to execute storage migration for asset-manager.");

let mut reads: Weight = 0;
let mut writes: Weight = 0;
LocationAssetId::<T>::iter().for_each(|(location, _asset_id)| {
reads += 1;
if let Some(para_id) =
Self::get_para_id_from_multilocation(location.into().as_ref())
{
if para_id != 2084 {
let _ = Self::increase_count_of_associated_assets(para_id);
reads += 1; // There's one read in method increase_count_of_associated_assets.
writes += 1; // There's one write in method increase_count_of_associated_assets.
}
}
}
});
T::DbWeight::get()
.reads(reads)
.saturating_add(T::DbWeight::get().writes(writes))
});

// Update storage version.
StorageVersion::new(1u16).put::<Self>();
writes += 1;

T::DbWeight::get()
.reads(reads)
.saturating_add(T::DbWeight::get().writes(writes))
} else {
log::info!("✅ no migration for asset-manager.");
// only 1 read
T::DbWeight::get().reads(1)
}
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
let storage_version = Self::on_chain_storage_version();

if storage_version >= 1 {
return Err("Storage version is >= 1, the migration won't be executed.");
}

Ok(())
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
let storage_version = Self::on_chain_storage_version();

if storage_version < 1 {
return Err("Storage version is >= 1, the migration won't be executed.");
}

let acala = (2000, 3); // karura has 3 asset locations on calamari.
let moonbeam = (2023, 1); // moonbean has 1 asset location on calamari.
let calamari = 2084; // our own asset location won't be counted.
if AllowedDestParaIds::<T>::get(acala.0) == Some(acala.1)
&& AllowedDestParaIds::<T>::get(moonbeam.0) == Some(moonbeam.1)
&& AllowedDestParaIds::<T>::get(calamari).is_none()
{
log::info!(
"✅ Storage migration for asset-manager has been executed successfully."
);
Ok(())
} else {
return Err("Failed to executed storage migration for asset-manager.");
}
}
}

Expand Down
16 changes: 16 additions & 0 deletions pallets/asset-manager/src/tests.rs
Expand Up @@ -461,6 +461,22 @@ fn filter_asset_location_should_work() {
};
assert!(!crate::Pallet::<Runtime>::contains(&wrong_relay_dest));
assert!(!crate::Pallet::<Runtime>::contains(&wrong_para_dest));

// AccountKey20 based location should work
let eve = [1u8; 20]; // evm based account
let para_dest_with_evm_account = MultiLocation {
parents: 1,
interior: X2(
Parachain(para_id),
AccountKey20 {
network: NetworkId::Any,
key: eve.into(),
},
),
};
assert!(crate::Pallet::<Runtime>::contains(
&para_dest_with_evm_account
));
})
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-selection/Cargo.toml
Expand Up @@ -7,7 +7,7 @@ license = 'GPL-3.0'
name = 'manta-collator-selection'
readme = 'README.md'
repository = 'https://github.com/Manta-Network/Manta/'
version = '3.1.5'
version = '3.2.0'

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
Expand Down
11 changes: 6 additions & 5 deletions pallets/manta-pay/src/rpc.rs
Expand Up @@ -65,10 +65,11 @@ where
fn pull_ledger_diff(&self, checkpoint: Checkpoint) -> Result<PullResponse> {
let api = self.client.runtime_api();
let at = BlockId::hash(self.client.info().best_hash);
api.pull_ledger_diff(&at, checkpoint.into()).map_err(|err| Error {
code: ErrorCode::ServerError(1),
message: "Unable to compute state diff for pull".into(),
data: Some(err.to_string().into()),
})
api.pull_ledger_diff(&at, checkpoint.into())
.map_err(|err| Error {
code: ErrorCode::ServerError(1),
message: "Unable to compute state diff for pull".into(),
data: Some(err.to_string().into()),
})
}
}
2 changes: 1 addition & 1 deletion pallets/tx-pause/Cargo.toml
@@ -1,7 +1,7 @@
[package]
authors = ['Manta Network']
name = "pallet-tx-pause"
version = '3.1.5'
version = '3.2.0'
edition = "2021"
homepage = 'https://manta.network'
license = 'GPL-3.0'
Expand Down
2 changes: 1 addition & 1 deletion pallets/vesting/Cargo.toml
@@ -1,7 +1,7 @@
[package]
authors = ['Manta Network']
name = "calamari-vesting"
version = '3.1.5'
version = '3.2.0'
edition = "2021"
homepage = 'https://manta.network'
license = 'GPL-3.0'
Expand Down
2 changes: 1 addition & 1 deletion primitives/Cargo.toml
@@ -1,7 +1,7 @@
[package]
authors = ['Manta Network']
name = "manta-primitives"
version = '3.1.5'
version = '3.2.0'
edition = "2021"
homepage = 'https://manta.network'
license = 'GPL-3.0'
Expand Down
19 changes: 18 additions & 1 deletion runtime/calamari/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ homepage = 'https://manta.network'
license = 'GPL-3.0'
name = 'calamari-runtime'
repository = 'https://github.com/Manta-Network/Manta/'
version = '3.1.5'
version = '3.2.0'

[dependencies]
codec = { package = "parity-scale-codec", version = '3.0.0', default-features = false, features = ["derive", "max-encoded-len"] }
Expand Down Expand Up @@ -105,7 +105,24 @@ default = ['std']
try-runtime = [
'frame-executive/try-runtime',
'frame-try-runtime',
'frame-system/try-runtime',
'pallet-aura/try-runtime',
'pallet-authorship/try-runtime',
'pallet-balances/try-runtime',
'pallet-preimage/try-runtime',
'pallet-multisig/try-runtime',
'pallet-session/try-runtime',
'pallet-timestamp/try-runtime',
'pallet-transaction-payment/try-runtime',
'pallet-utility/try-runtime',
'pallet-collective/try-runtime',
'pallet-democracy/try-runtime',
'pallet-scheduler/try-runtime',
'pallet-membership/try-runtime',
'pallet-treasury/try-runtime',
'pallet-assets/try-runtime',
'pallet-tx-pause/try-runtime',
'pallet-asset-manager/try-runtime',
]
runtime-benchmarks = [
'cumulus-pallet-session-benchmarking/runtime-benchmarks',
Expand Down
2 changes: 1 addition & 1 deletion runtime/calamari/src/lib.rs
Expand Up @@ -104,7 +104,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("calamari"),
impl_name: create_runtime_str!("calamari"),
authoring_version: 1,
spec_version: 3151,
spec_version: 3200,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 4,
Expand Down
3 changes: 3 additions & 0 deletions runtime/calamari/src/migrations/sudo.rs
Expand Up @@ -26,7 +26,9 @@ impl<T: frame_system::Config> OnRuntimeUpgrade for RemoveSudo<T> {
fn on_runtime_upgrade() -> Weight {
if have_storage_value(b"Sudo", b"Key", b"") {
remove_storage_prefix(b"Sudo", b"Key", b"");
remove_storage_prefix(b"Sudo", b":__STORAGE_VERSION__:", b"");
log::info!(target: "OnRuntimeUpgrade", "✅ Sudo key has been removed.");
log::info!(target: "OnRuntimeUpgrade", "✅ The pallet version has been removed.");
T::DbWeight::get()
.reads(1 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Expand All @@ -39,6 +41,7 @@ impl<T: frame_system::Config> OnRuntimeUpgrade for RemoveSudo<T> {
fn pre_upgrade() -> Result<(), &'static str> {
if have_storage_value(b"Sudo", b"Key", b"") {
log::info!(target: "OnRuntimeUpgrade", "✅ Sudo key will be removed soon.");
log::info!(target: "OnRuntimeUpgrade", "✅ The pallet version will be removed soon.");
Ok(())
} else {
Err("Sudo doesn't exist.")
Expand Down