Skip to content

Commit d38b4b0

Browse files
authored
Ab/porteer optimize compact (#294)
* require PortTokensNonce compact encoding * more compact args
1 parent 3a4fe76 commit d38b4b0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

porteer/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub mod weights;
3939
pub use crate::weights::WeightInfo;
4040
use frame_support::{transactional, Parameter};
4141
pub use pallet::*;
42-
use parity_scale_codec::MaxEncodedLen;
42+
use parity_scale_codec::{DecodeWithMemTracking, HasCompact, MaxEncodedLen};
4343
use sp_runtime::{
4444
traits::{AtLeast32BitUnsigned, MaybeSerializeDeserialize, Member},
4545
DispatchError,
@@ -389,7 +389,7 @@ pub mod pallet {
389389
#[pallet::weight(< T as Config >::WeightInfo::port_tokens())]
390390
pub fn port_tokens(
391391
origin: OriginFor<T>,
392-
amount: BalanceOf<T>,
392+
#[pallet::compact] amount: BalanceOf<T>,
393393
forward_tokens_to_location: Option<T::Location>,
394394
) -> DispatchResult {
395395
let signer = ensure_signed(origin)?;
@@ -448,9 +448,9 @@ pub mod pallet {
448448
pub fn mint_ported_tokens(
449449
origin: OriginFor<T>,
450450
beneficiary: AccountIdOf<T>,
451-
amount: BalanceOf<T>,
451+
#[pallet::compact] amount: BalanceOf<T>,
452452
forward_tokens_to_location: Option<T::Location>,
453-
source_nonce: PortTokensNonceOf<T>,
453+
#[pallet::compact] source_nonce: PortTokensNonceOf<T>,
454454
) -> DispatchResult {
455455
let _signer = T::TokenSenderLocationOrigin::ensure_origin(origin)?;
456456

@@ -499,6 +499,7 @@ pub trait PortTokens {
499499
+ Default
500500
+ Copy
501501
+ MaybeSerializeDeserialize
502+
+ HasCompact<Type: DecodeWithMemTracking>
502503
+ MaxEncodedLen;
503504

504505
type Location;

0 commit comments

Comments
 (0)