Skip to content

Commit

Permalink
Release v3.2.0 (#572)
Browse files Browse the repository at this point in the history
* Bump version to 3.2.0

Signed-off-by: Dengjianping <djptux@gmail.com>

* Revert tx version

Signed-off-by: Dengjianping <djptux@gmail.com>

* Update weights for dolphin

Signed-off-by: Dengjianping <djptux@gmail.com>

* Impl try-runtime for asset-manager

Signed-off-by: Dengjianping <djptux@gmail.com>

* Bump tx-version

Signed-off-by: Dengjianping <djptux@gmail.com>
  • Loading branch information
Dengjianping authored Jun 14, 2022
1 parent cfcd20f commit 2477840
Show file tree
Hide file tree
Showing 55 changed files with 1,295 additions and 1,176 deletions.
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
# CHANGELOG

## Unreleased
## v3.2.0
### Breaking changes

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

### Improvements
- [\#583](https://github.com/Manta-Network/Manta/pull/583) Remove checkpoint from RPC API when synchronizing with MantaPay
- [\#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.
- [Calamari] [\#550](https://github.com/Manta-Network/Manta/pull/550) Remove sudo pallet from calamari runtime.
- [\#560](https://github.com/Manta-Network/Manta/pull/560) Bump srtool to v0.4.0.
- [Dolphin] [\#583](https://github.com/Manta-Network/Manta/pull/583) Remove checkpoint from RPC API when synchronizing with MantaPay.

### 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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 { .. }) => {
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)| {
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
4 changes: 2 additions & 2 deletions runtime/calamari/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ 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,
transaction_version: 5,
state_version: 0,
};

Expand Down
Loading

0 comments on commit 2477840

Please sign in to comment.