Browse Source

substrate v2: 0 weight to fee conversion

Mokhtar Naamani 5 years ago
parent
commit
61b5392310
6 changed files with 7 additions and 42 deletions
  1. 1 8
      src/governance/mock.rs
  2. 1 8
      src/governance/proposals.rs
  3. 2 2
      src/lib.rs
  4. 1 8
      src/membership/mock.rs
  5. 1 8
      src/roles/mock.rs
  6. 1 8
      src/storage/mock.rs

+ 1 - 8
src/governance/mock.rs

@@ -84,13 +84,6 @@ impl election::Trait for Test {
     type Members = MockMembership;
 }
 
-pub struct WeightToFee(u32);
-impl Convert<Weight, u64> for WeightToFee {
-    fn convert(t: Weight) -> u64 {
-        t as u64
-    }
-}
-
 parameter_types! {
     pub const ExistentialDeposit: u32 = 0;
     pub const TransferFee: u32 = 0;
@@ -117,7 +110,7 @@ impl balances::Trait for Test {
     type CreationFee = CreationFee;
     type TransactionBaseFee = TransactionBaseFee;
     type TransactionByteFee = TransactionByteFee;
-    type WeightToFee = WeightToFee;
+    type WeightToFee = ();
 }
 
 impl GovernanceCurrency for Test {

+ 1 - 8
src/governance/proposals.rs

@@ -608,13 +608,6 @@ mod tests {
         type MinimumPeriod = MinimumPeriod;
     }
 
-    pub struct WeightToFee(u32);
-    impl Convert<Weight, u64> for WeightToFee {
-        fn convert(t: Weight) -> u64 {
-            t as u64
-        }
-    }
-
     parameter_types! {
         pub const ExistentialDeposit: u32 = 0;
         pub const TransferFee: u32 = 0;
@@ -641,7 +634,7 @@ mod tests {
         type CreationFee = CreationFee;
         type TransactionBaseFee = TransactionBaseFee;
         type TransactionByteFee = TransactionByteFee;
-        type WeightToFee = WeightToFee;
+        type WeightToFee = ();
     }
 
     impl council::Trait for Test {

+ 2 - 2
src/lib.rs

@@ -15,7 +15,7 @@ use im_online::AuthorityId as ImOnlineId;
 use primitives::{crypto::key_types, OpaqueMetadata};
 use rstd::prelude::*;
 use runtime_primitives::traits::{
-    BlakeTwo256, Block as BlockT, ConvertInto, DigestFor, NumberFor, StaticLookup, Verify,
+    BlakeTwo256, Block as BlockT, DigestFor, NumberFor, StaticLookup, Verify,
 };
 use runtime_primitives::weights::Weight;
 use runtime_primitives::{
@@ -244,7 +244,7 @@ impl balances::Trait for Runtime {
     type CreationFee = CreationFee;
     type TransactionBaseFee = TransactionBaseFee;
     type TransactionByteFee = TransactionByteFee;
-    type WeightToFee = ConvertInto;
+    type WeightToFee = (); // computes fee to be default value of Balance/u128 = 0
 }
 
 impl sudo::Trait for Runtime {

+ 1 - 8
src/membership/mock.rs

@@ -55,13 +55,6 @@ impl timestamp::Trait for Test {
     type MinimumPeriod = MinimumPeriod;
 }
 
-pub struct WeightToFee(u32);
-impl Convert<Weight, u64> for WeightToFee {
-    fn convert(t: Weight) -> u64 {
-        t as u64
-    }
-}
-
 parameter_types! {
     pub const ExistentialDeposit: u32 = 0;
     pub const TransferFee: u32 = 0;
@@ -88,7 +81,7 @@ impl balances::Trait for Test {
     type CreationFee = CreationFee;
     type TransactionBaseFee = TransactionBaseFee;
     type TransactionByteFee = TransactionByteFee;
-    type WeightToFee = WeightToFee;
+    type WeightToFee = ();
 }
 
 impl GovernanceCurrency for Test {

+ 1 - 8
src/roles/mock.rs

@@ -49,13 +49,6 @@ impl system::Trait for Test {
     type Version = ();
 }
 
-pub struct WeightToFee(u32);
-impl Convert<Weight, u64> for WeightToFee {
-    fn convert(t: Weight) -> u64 {
-        t as u64
-    }
-}
-
 parameter_types! {
     pub const ExistentialDeposit: u32 = 0;
     pub const TransferFee: u32 = 0;
@@ -82,7 +75,7 @@ impl balances::Trait for Test {
     type CreationFee = CreationFee;
     type TransactionBaseFee = TransactionBaseFee;
     type TransactionByteFee = TransactionByteFee;
-    type WeightToFee = WeightToFee;
+    type WeightToFee = ();
 }
 
 impl GovernanceCurrency for Test {

+ 1 - 8
src/storage/mock.rs

@@ -149,13 +149,6 @@ impl timestamp::Trait for Test {
     type MinimumPeriod = MinimumPeriod;
 }
 
-pub struct WeightToFee(u32);
-impl Convert<Weight, u64> for WeightToFee {
-    fn convert(t: Weight) -> u64 {
-        t as u64
-    }
-}
-
 parameter_types! {
     pub const ExistentialDeposit: u32 = 0;
     pub const TransferFee: u32 = 0;
@@ -182,7 +175,7 @@ impl balances::Trait for Test {
     type CreationFee = CreationFee;
     type TransactionBaseFee = TransactionBaseFee;
     type TransactionByteFee = TransactionByteFee;
-    type WeightToFee = WeightToFee;
+    type WeightToFee = ();
 }
 
 impl GovernanceCurrency for Test {