Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Pallet: Atomic Swap #6349

Merged
merged 21 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add ProofLimit parameter to prevent proof size being too large
  • Loading branch information
sorpaas committed Jun 14, 2020
commit f885efbd4114b47b89a073cd9397e2abcd2a70c3
4 changes: 3 additions & 1 deletion frame/atomic-swap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use sp_std::prelude::*;
use sp_io::hashing::blake2_256;
use frame_support::{
decl_module, decl_storage, decl_event, decl_error, ensure,
traits::{Currency, ReservableCurrency, BalanceStatus},
traits::{Get, Currency, ReservableCurrency, BalanceStatus},
};
use frame_system::{self as system, ensure_signed};
use codec::{Encode, Decode};
Expand Down Expand Up @@ -64,6 +64,8 @@ pub trait Trait: frame_system::Trait {
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
/// The currency mechanism.
type Currency: ReservableCurrency<Self::AccountId>;
/// Limit of proof size.
type ProofLimit: Get<u32>;
}

decl_storage! {
Expand Down
2 changes: 2 additions & 0 deletions frame/atomic-swap/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ parameter_types! {
pub const MaximumBlockWeight: Weight = 1024;
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
pub const ProofLimit: u32 = 1024;
}
impl frame_system::Trait for Test {
type Origin = Origin;
Expand Down Expand Up @@ -67,6 +68,7 @@ impl pallet_balances::Trait for Test {
impl Trait for Test {
type Event = ();
type Currency = Balances;
type ProofLimit = ProofLimit;
}
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;
Expand Down