Skip to content

Commit

Permalink
Merge pull request #627 from galacticcouncil/asset_registry_bounded_s…
Browse files Browse the repository at this point in the history
…torage

fix: asset registry bounded storage
  • Loading branch information
Roznovjak authored Jul 6, 2023
2 parents 91ea9db + ac1bb3e commit 27b0a27
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 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 pallets/asset-registry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-asset-registry"
version = "2.2.1"
version = "2.2.2"
description = "Pallet for asset registry management"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
11 changes: 8 additions & 3 deletions pallets/asset-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ pub mod pallet {
+ TypeInfo;

/// Balance type
type Balance: Parameter + Member + AtLeast32BitUnsigned + Default + Copy + MaybeSerializeDeserialize;
type Balance: Parameter
+ Member
+ AtLeast32BitUnsigned
+ Default
+ Copy
+ MaybeSerializeDeserialize
+ MaxEncodedLen;

/// Asset location type
type AssetNativeLocation: Parameter + Member + Default;
type AssetNativeLocation: Parameter + Member + Default + MaxEncodedLen;

/// The maximum length of a name or symbol stored on-chain.
type StringLimit: Get<u32>;
Expand All @@ -95,7 +101,6 @@ pub mod pallet {
}

#[pallet::pallet]
#[pallet::without_storage_info]
pub struct Pallet<T>(_);

#[pallet::hooks]
Expand Down
4 changes: 2 additions & 2 deletions pallets/asset-registry/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ impl system::Config for Test {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}

use codec::{Decode, Encode};
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;

#[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
#[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
pub struct AssetLocation(pub MultiLocation);

impl Config for Test {
Expand Down
6 changes: 3 additions & 3 deletions pallets/asset-registry/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ use sp_std::vec::Vec;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};

#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum AssetType<AssetId> {
Token,
PoolShare(AssetId, AssetId),
}

#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Eq, PartialEq, Copy, Clone, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub struct AssetDetails<AssetId, Balance, BoundedString> {
/// The name of this asset. Limited in length by `StringLimit`.
Expand All @@ -42,7 +42,7 @@ pub struct AssetDetails<AssetId, Balance, BoundedString> {
pub(super) xcm_rate_limit: Option<Balance>,
}

#[derive(Clone, Encode, Decode, Eq, PartialEq, Default, RuntimeDebug, TypeInfo)]
#[derive(Clone, Encode, Decode, Eq, PartialEq, Default, RuntimeDebug, TypeInfo, MaxEncodedLen)]
pub struct AssetMetadata<BoundedString> {
/// The ticker symbol for this asset. Limited in length by `StringLimit`.
pub(super) symbol: BoundedString,
Expand Down
2 changes: 1 addition & 1 deletion runtime/hydradx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydradx-runtime"
version = "165.0.0"
version = "166.0.0"
authors = ["GalacticCouncil"]
edition = "2021"
license = "Apache 2.0"
Expand Down
2 changes: 1 addition & 1 deletion runtime/hydradx/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("hydradx"),
impl_name: create_runtime_str!("hydradx"),
authoring_version: 1,
spec_version: 165,
spec_version: 166,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
3 changes: 2 additions & 1 deletion runtime/hydradx/src/xcm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use super::*;

use codec::MaxEncodedLen;
use hydradx_adapters::{MultiCurrencyTrader, ReroutingMultiCurrencyAdapter, ToFeeReceiver};
use pallet_transaction_multi_payment::DepositAll;
use primitives::AssetId; // shadow glob import of polkadot_xcm::v3::prelude::AssetId
Expand All @@ -26,7 +27,7 @@ use xcm_builder::{
};
use xcm_executor::{Config, XcmExecutor};

#[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo)]
#[derive(Debug, Default, Encode, Decode, Clone, PartialEq, Eq, TypeInfo, MaxEncodedLen)]
pub struct AssetLocation(pub polkadot_xcm::v3::MultiLocation);

pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
Expand Down

0 comments on commit 27b0a27

Please sign in to comment.