Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 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 core/sr-arithmetic/src/biguint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rstd::{cmp::Ordering, ops, prelude::*, cell::RefCell, convert::TryFrom};

// A sensible value for this would be half of the dword size of the host machine. Since the
// runtime is compiled to 32bit webassembly, using 32 and 64 for single and double respectively
// should yield the most performance. TODO #3745 we could benchmark this and verify.
// should yield the most performance.
/// Representation of a single limb.
pub type Single = u32;
/// Representation of two limbs.
Expand Down
6 changes: 6 additions & 0 deletions core/sr-arithmetic/src/fixed64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ impl Fixed64 {
DIV
}

/// Consume self and return the inner value.
///
/// This should only be used for testing.
#[cfg(any(feature = "std", test))]
pub fn into_inner(self) -> i64 { self.0 }

/// Raw constructor. Equal to `parts / 1_000_000_000`.
pub fn from_parts(parts: i64) -> Self {
Self(parts)
Expand Down
11 changes: 4 additions & 7 deletions node/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ mod tests {
use super::Executor;
use {balances, contracts, indices, system, timestamp};
use codec::{Encode, Decode, Joiner};
use runtime_support::{
Hashable, StorageValue, StorageMap, traits::Currency,
};
use runtime_support::{Hashable, StorageValue, StorageMap, traits::Currency};
use state_machine::TestExternalities as CoreTestExternalities;
use primitives::{
Blake2Hasher, NeverNativeValue, NativeOrEncoded, map,
Expand All @@ -57,8 +55,9 @@ mod tests {
use node_runtime::{
Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances, BuildStorage,
System, TransactionPayment, Event, TransferFee, TransactionBaseFee, TransactionByteFee,
constants::currency::*, impls::WeightToFee,
WeightFeeCoefficient, constants::currency::*,
};
use node_runtime::impls::LinearWeightToFee;
use node_primitives::{Balance, Hash, BlockNumber};
use node_testing::keyring::*;
use wabt;
Expand Down Expand Up @@ -501,8 +500,6 @@ mod tests {
).0.unwrap();

t.execute_with(|| {
// NOTE: fees differ slightly in tests that execute more than one block due to the
// weight update. Hence, using `assert_eq_error_rate`.
assert_eq!(
Balances::total_balance(&alice()),
alice_last_known_balance - 10 * DOLLARS - transfer_fee(&xt(), fm),
Expand Down Expand Up @@ -1069,7 +1066,7 @@ mod tests {
balance_alice -= length_fee;

let weight = default_transfer_call().get_dispatch_info().weight;
let weight_fee = WeightToFee::convert(weight);
let weight_fee = LinearWeightToFee::<WeightFeeCoefficient>::convert(weight);

// we know that weight to fee multiplier is effect-less in block 1.
assert_eq!(weight_fee as Balance, MILLICENTS);
Expand Down
3 changes: 3 additions & 0 deletions node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ transaction-payment = { package = "srml-transaction-payment", path = "../../srml
[build-dependencies]
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2", path = "../../core/utils/wasm-builder-runner" }

[dev-dependencies]
runtime_io = { package = "sr-io", path = "../../core/sr-io" }

[features]
default = ["std"]
std = [
Expand Down
16 changes: 0 additions & 16 deletions node/runtime/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,3 @@ pub mod time {
pub const HOURS: BlockNumber = MINUTES * 60;
pub const DAYS: BlockNumber = HOURS * 24;
}

// CRITICAL NOTE: The system module maintains two constants: a _maximum_ block weight and a _ratio_
// of it yielding the portion which is accessible to normal transactions (reserving the rest for
// operational ones). `TARGET_BLOCK_FULLNESS` is entirely independent and the system module is not
// aware of if, nor should it care about it. This constant simply denotes on which ratio of the
// _maximum_ block weight we tweak the fees. It does NOT care about the type of the dispatch.
//
// For the system to be configured in a sane way, `TARGET_BLOCK_FULLNESS` should always be less than
// the ratio that `system` module uses to find normal transaction quota.
/// Fee-related.
pub mod fee {
pub use sr_primitives::Perbill;

/// The block saturation level. Fees will be updates based on this value.
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
}
Loading