Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
f2c8b88
Fix typo: eror -> error (#6293)
subsocialdev Jun 8, 2020
cc5b3a6
Fix typo: PRORITY -> PRIORITY (#6291)
subsocialdev Jun 8, 2020
e287915
Intent to release rc3 (#6290)
gnunicorn Jun 8, 2020
85cd556
Fix transaction pool & network issues (#6288)
NikVolf Jun 8, 2020
863611e
Use `sign_with` for signing grandpa's outgoing message (#6178)
rakanalh Jun 9, 2020
a8bf260
Revalidation tweak & logging for transaction pool (#6258)
NikVolf Jun 9, 2020
feb334d
Update README.md
gavofyork Jun 9, 2020
1853b9a
Allow adding a prefix to the informant (#6174)
cecton Jun 9, 2020
65fe00b
Transaction pool added missed comment (#6308)
bkchr Jun 9, 2020
a3a5160
Add a test for lots of nodes connecting at the same time (#6247)
tomaka Jun 9, 2020
4b1d862
Introduce frozen indices. (#6307)
gavofyork Jun 9, 2020
6c01b10
new crate sc-light (#6235)
seunlanlege Jun 9, 2020
9c39e2c
Fix ui tests for latest rust stable (#6310)
bkchr Jun 9, 2020
b1038c8
Expose light client. (#6313)
dvc94ch Jun 10, 2020
571cfc1
Fix nits in rpc error display. (#6302)
seerscode Jun 10, 2020
e2a6c3e
"OR gate" for EnsureOrigin (#6237)
shaunxw Jun 10, 2020
69034ef
New CI image (#6223)
TriplEight Jun 10, 2020
a684e83
Add a feature to create automatically a random temporary directory fo…
cecton Jun 10, 2020
f06d5f0
Add a [prefix]_process_start_time_seconds metric (#6315)
tomaka Jun 10, 2020
8aeda51
Make NumberOrHex a common primitive. (#6321)
pepyakin Jun 10, 2020
70cfeff
Avoid self-lookups in Authority Discovery (#6317)
romanb Jun 10, 2020
606c56d
Fix quadratic iterations in transaction pool ready set (#6256)
NikVolf Jun 10, 2020
164fb3b
Find the alive incoming entry on disconnect. (#6320)
romanb Jun 11, 2020
99708c0
Impl Debug and Display for Ss58AddressFormat when compiled with std (…
cecton Jun 11, 2020
0a169d4
transaction-pool: expose blocking api for tx submission (#6325)
andresilva Jun 11, 2020
f893506
Pruned and resubmitted metrics in transaction pool (#6322)
NikVolf Jun 11, 2020
4bd0785
Enable wasmtime on node-template (#6336)
shawntabrizi Jun 11, 2020
75113aa
Adds support for storage parameter types (#6296)
bkchr Jun 11, 2020
883c89a
Basic documentation for Scheduler pallet (#6338)
danforbes Jun 12, 2020
6b45e24
Fix check-line-width CI script (#6326)
athei Jun 12, 2020
0dc6634
client: use appropriate ExecutionContext for initial sync / regular i…
andresilva Jun 12, 2020
384be7e
Fix transaction pool event sending (#6341)
bkchr Jun 12, 2020
afdf5ef
Deprecate FunctionOf and remove its users (#6340)
athei Jun 12, 2020
d735e4d
Add events for balance reserve and unreserve functions (#6330)
joepetrowski Jun 12, 2020
1a31f43
Update contributing guide with new label policy (#6333)
apopiak Jun 13, 2020
7401153
adding a ss58 format for Stafi Network (#6347)
Tore19 Jun 14, 2020
f837c39
add extend_lock for StorageLock (#6323)
wangjj9219 Jun 15, 2020
0db70ea
Introduce in-origin filtering (#6318)
gui1117 Jun 15, 2020
4368fc6
pallet-evm add get(fn) to AccountStorages (#6279)
tgmichel Jun 15, 2020
6907018
Add IPC support (#6348)
Demi-Marie Jun 16, 2020
9e999b2
expose constants of pallet_recovery trait (#6363)
wangjj9219 Jun 16, 2020
b29e467
Impl integrity test for runtime (#6356)
gui1117 Jun 16, 2020
1095920
historical slashing w ocw w adhoc tree creation (#6220)
drahnr Jun 16, 2020
1f536e9
[CI] Auto-label new PRs according to draft status (#6361)
s3krit Jun 16, 2020
6199d86
Split the service initialisation up into seperate functions (#6332)
expenses Jun 16, 2020
54d1c5c
[CI] Add label enforcement (#6365)
s3krit Jun 16, 2020
24cbfc4
vesting: Force Vested Transfer (#6368)
gavofyork Jun 16, 2020
288ead0
client/authority-discovery: Don't add own address to priority group (…
mxinden Jun 16, 2020
74efab4
.gitlab-ci.yml: Run promtool on Prometheus alerting rules (#6344)
mxinden Jun 16, 2020
1823782
Use /dns/ instead of /dns4/ (#6369)
tomaka Jun 16, 2020
02e77d2
add system_dryRun (#6300)
xlc Jun 16, 2020
db8916a
fix BlockAttributes encoding (#6281)
svyatonik Jun 16, 2020
bdae39f
Allow Sudo to do anything (#6375)
gavofyork Jun 17, 2020
17be6fd
Stored call in multisig (#6319)
gavofyork Jun 17, 2020
0c42ced
Fix the broken weight multiplier update function (#6334)
kianenigma Jun 17, 2020
8e1f753
Restrict remove_proxies (#6383)
gavofyork Jun 18, 2020
a2653e8
Remove penalty on duplicate Status message (#6377)
tomaka Jun 18, 2020
d6d688c
`decl_module!` print better error on duplicate reserved keyword (#6384)
bkchr Jun 18, 2020
f8afa52
FixedPointNumber: zero is not positive. (#6385)
shaunxw Jun 18, 2020
b02101e
Allow empty values in the storage (#6364)
arkpar Jun 18, 2020
bd72cb6
Pallet: Atomic Swap (#6349)
sorpaas Jun 18, 2020
81ba3e2
Runtime interface to add support for tracing from wasm (#6381)
mattrutherford Jun 18, 2020
9a5892e
Block packet size limit
arkpar Jun 18, 2020
0bb3001
Revert "Block packet size limit"
arkpar Jun 18, 2020
9402334
Update s3 artifact url (#6399)
ddorgan Jun 18, 2020
44978b9
Increase network buffer sizes even more (#6080)
tomaka Jun 18, 2020
cb83391
Remove pallet-balances from non-dev-deps (#6407)
gnunicorn Jun 18, 2020
9b08492
Babe VRF Signing in keystore (#6225)
rakanalh Jun 18, 2020
caf9fbe
Update `libp2p-ping`. (#6412)
twittner Jun 18, 2020
7a4bd76
Remove --legacy-network-protocol CLI flag (#6411)
tomaka Jun 18, 2020
4f0b601
Scale and increase validator count (#6417)
gavofyork Jun 19, 2020
369f9fc
Expose constants from Proxy Pallet (#6420)
shawntabrizi Jun 19, 2020
31c3e06
.maintain/monitoring: Add alerting rule tests (#6343)
mxinden Jun 19, 2020
31af203
[CI] Label PRs if polkadot companion build fails (#6410)
s3krit Jun 19, 2020
3ca1d91
Print bad mandatory error (#6416)
bkchr Jun 19, 2020
9758376
Track last blocks in informant display (#6429)
bkchr Jun 19, 2020
2bb79cb
Simple Docs for Atomic Swap Pallet (#6434)
danforbes Jun 19, 2020
a2c493d
More descriptive error message when invalid slot duration is used (#6…
cecton Jun 19, 2020
d343bfc
Root origin use no filter by default. Scheduler and Democracy dispatc…
gui1117 Jun 19, 2020
111b628
llow decl-module to have a where clause with trailing comma (#6431)
gui1117 Jun 19, 2020
18707b3
.gitlab-ci.yml: Use promtool from paritytech/tools:latest image (#6425)
mxinden Jun 19, 2020
26aec42
Update sync chain info on own block import (#6424)
bkchr Jun 19, 2020
4c67aee
client/authority-discovery: Compare PeerIds and not Multihashes (#6414)
mxinden Jun 19, 2020
c8c16d1
add network propagated metrics (#6438)
NikVolf Jun 19, 2020
f9d4d30
change (ci): add interruptible to kubernetes jobs (#6441)
TriplEight Jun 19, 2020
9cbda1e
Avoid multisig reentrancy (#6445)
gavofyork Jun 19, 2020
d0ab405
Validate encoding of extrinsics passed to runtime (#6442)
arkpar Jun 19, 2020
8032321
Fix Babe secondary plain slots claiming (#6451)
bkchr Jun 19, 2020
1fae45f
sp-npos-elections should not depend on itself (#6444)
bkchr Jun 20, 2020
6c16d15
Don't autolabel insubstantial PRs 'pleasereview' (#6447)
s3krit Jun 20, 2020
ef2a6c1
change everything to transaction (#6440)
NikVolf Jun 21, 2020
41970e7
node: spawn block authoring and grandpa voter as blocking tasks (#6446)
andresilva Jun 21, 2020
a5bcfed
pallet-atomic-swap: generialized swap action (#6421)
sorpaas Jun 21, 2020
6f86bdd
Fix issues with `Operational` transactions validity and prioritizatio…
tomusdrw Jun 21, 2020
3bf25c2
`pallet-staking`: Expose missing consts (#6456)
bkchr Jun 22, 2020
8329dbd
update collective events docs to be consistent with changes (#6463)
apopiak Jun 22, 2020
94b3812
[CI] Don't tag PRs on companion job cancels (#6470)
s3krit Jun 22, 2020
50eb257
network: remove unused variable (#6460)
andresilva Jun 22, 2020
19826b9
Avoid panic on dropping a `sc_network::service::out_events::Receiver`…
romanb Jun 23, 2020
5a102f7
Implement nested storage transactions (#6269)
athei Jun 23, 2020
fed834c
Optimize offchain worker api by re-using http-client (#6454)
pscott Jun 23, 2020
cf7432a
Remove lingering runtime upgrades (#6476)
shawntabrizi Jun 23, 2020
6221146
impl Debug for sc_service::Configuration (#6400)
cecton Jun 23, 2020
c771821
Fix `sp-api` handling of multiple arguments (#6484)
bkchr Jun 23, 2020
ad7b5ef
Fix the browser node and ensure it doesn't colour the informant outpu…
expenses Jun 23, 2020
8baaa18
bound some missing bound for elevated trait (#6487)
gui1117 Jun 23, 2020
034055a
`pallet-scheduler`: Check that `when` is not in the past (#6480)
bkchr Jun 23, 2020
4c03656
client/network/service: Add primary dimension to connection metrics (…
mxinden Jun 23, 2020
d59281f
Ensure the listen addresses are consistent with the transport (#6436)
cecton Jun 23, 2020
9a9b248
pallet-contracts: migrate to nested storage transaction mechanism (#6…
pepyakin Jun 23, 2020
b1ba3a4
Update lock
drewstone Jun 23, 2020
11682ef
Another upstream merge
drewstone Jun 23, 2020
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
Fix the broken weight multiplier update function (paritytech#6334)
* Initial draft, has some todos left

* remove ununsed import

* Apply suggestions from code review

* Some refactors with migration

* Fix more test and cleanup

* Fix for companion

* Apply suggestions from code review

Co-authored-by: Alexander Popiak <[email protected]>

* Update bin/node/runtime/src/impls.rs

* Fix weight

* Add integrity test

* length is not affected.

Co-authored-by: Alexander Popiak <[email protected]>
  • Loading branch information
kianenigma and apopiak authored Jun 17, 2020
commit 0c42cedaac0b1bf3a608031ee3e494b51bfaa0fe
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.

55 changes: 24 additions & 31 deletions bin/node/executor/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ use codec::{Encode, Decode, Joiner};
use frame_support::{
StorageValue, StorageMap,
traits::Currency,
weights::{
GetDispatchInfo, DispatchInfo, DispatchClass, constants::ExtrinsicBaseWeight,
WeightToFeePolynomial,
},
weights::{GetDispatchInfo, DispatchInfo, DispatchClass},
};
use sp_core::{NeverNativeValue, traits::Externalities, storage::well_known_keys};
use sp_runtime::{
ApplyExtrinsicResult, FixedI128, FixedPointNumber,
ApplyExtrinsicResult,
traits::Hash as HashT,
transaction_validity::InvalidTransaction,
};
Expand All @@ -35,7 +32,7 @@ use frame_system::{self, EventRecord, Phase};

use node_runtime::{
Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances,
System, TransactionPayment, Event, TransactionByteFee,
System, TransactionPayment, Event,
constants::currency::*,
};
use node_primitives::{Balance, Hash};
Expand All @@ -52,16 +49,17 @@ use self::common::{*, sign};
/// test code paths that differ between native and wasm versions.
pub const BLOATY_CODE: &[u8] = node_runtime::WASM_BINARY_BLOATY;

/// Default transfer fee
fn transfer_fee<E: Encode>(extrinsic: &E, fee_multiplier: FixedI128) -> Balance {
let length_fee = TransactionByteFee::get() * (extrinsic.encode().len() as Balance);

let base_weight = ExtrinsicBaseWeight::get();
let base_fee = <Runtime as pallet_transaction_payment::Trait>::WeightToFee::calc(&base_weight);
let weight = default_transfer_call().get_dispatch_info().weight;
let weight_fee = <Runtime as pallet_transaction_payment::Trait>::WeightToFee::calc(&weight);

base_fee + fee_multiplier.saturating_mul_acc_int(length_fee + weight_fee)
/// Default transfer fee. This will use the same logic that is implemented in transaction-payment module.
///
/// Note that reads the multiplier from storage directly, hence to get the fee of `extrinsic`
/// at block `n`, it must be called prior to executing block `n` to do the calculation with the
/// correct multiplier.
fn transfer_fee<E: Encode>(extrinsic: &E) -> Balance {
TransactionPayment::compute_fee(
extrinsic.encode().len() as u32,
&default_transfer_call().get_dispatch_info(),
0,
)
}

fn xt() -> UncheckedExtrinsic {
Expand Down Expand Up @@ -242,7 +240,7 @@ fn successful_execution_with_native_equivalent_code_gives_ok() {
).0;
assert!(r.is_ok());

let fm = t.execute_with(TransactionPayment::next_fee_multiplier);
let fees = t.execute_with(|| transfer_fee(&xt()));

let r = executor_call::<NeverNativeValue, fn() -> _>(
&mut t,
Expand All @@ -254,7 +252,6 @@ fn successful_execution_with_native_equivalent_code_gives_ok() {
assert!(r.is_ok());

t.execute_with(|| {
let fees = transfer_fee(&xt(), fm);
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees);
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
});
Expand Down Expand Up @@ -286,7 +283,7 @@ fn successful_execution_with_foreign_code_gives_ok() {
).0;
assert!(r.is_ok());

let fm = t.execute_with(TransactionPayment::next_fee_multiplier);
let fees = t.execute_with(|| transfer_fee(&xt()));

let r = executor_call::<NeverNativeValue, fn() -> _>(
&mut t,
Expand All @@ -298,7 +295,6 @@ fn successful_execution_with_foreign_code_gives_ok() {
assert!(r.is_ok());

t.execute_with(|| {
let fees = transfer_fee(&xt(), fm);
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees);
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
});
Expand All @@ -311,7 +307,7 @@ fn full_native_block_import_works() {
let (block1, block2) = blocks();

let mut alice_last_known_balance: Balance = Default::default();
let mut fm = t.execute_with(TransactionPayment::next_fee_multiplier);
let mut fees = t.execute_with(|| transfer_fee(&xt()));

executor_call::<NeverNativeValue, fn() -> _>(
&mut t,
Expand All @@ -322,7 +318,6 @@ fn full_native_block_import_works() {
).0.unwrap();

t.execute_with(|| {
let fees = transfer_fee(&xt(), fm);
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees);
assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS);
alice_last_known_balance = Balances::total_balance(&alice());
Expand Down Expand Up @@ -361,7 +356,7 @@ fn full_native_block_import_works() {
assert_eq!(System::events(), events);
});

fm = t.execute_with(TransactionPayment::next_fee_multiplier);
fees = t.execute_with(|| transfer_fee(&xt()));

executor_call::<NeverNativeValue, fn() -> _>(
&mut t,
Expand All @@ -372,7 +367,6 @@ fn full_native_block_import_works() {
).0.unwrap();

t.execute_with(|| {
let fees = transfer_fee(&xt(), fm);
assert_eq!(
Balances::total_balance(&alice()),
alice_last_known_balance - 10 * DOLLARS - fees,
Expand Down Expand Up @@ -450,7 +444,7 @@ fn full_wasm_block_import_works() {
let (block1, block2) = blocks();

let mut alice_last_known_balance: Balance = Default::default();
let mut fm = t.execute_with(TransactionPayment::next_fee_multiplier);
let mut fees = t.execute_with(|| transfer_fee(&xt()));

executor_call::<NeverNativeValue, fn() -> _>(
&mut t,
Expand All @@ -461,12 +455,12 @@ fn full_wasm_block_import_works() {
).0.unwrap();

t.execute_with(|| {
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - transfer_fee(&xt(), fm));
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees);
assert_eq!(Balances::total_balance(&bob()), 169 * DOLLARS);
alice_last_known_balance = Balances::total_balance(&alice());
});

fm = t.execute_with(TransactionPayment::next_fee_multiplier);
fees = t.execute_with(|| transfer_fee(&xt()));

executor_call::<NeverNativeValue, fn() -> _>(
&mut t,
Expand All @@ -479,11 +473,11 @@ fn full_wasm_block_import_works() {
t.execute_with(|| {
assert_eq!(
Balances::total_balance(&alice()),
alice_last_known_balance - 10 * DOLLARS - transfer_fee(&xt(), fm),
alice_last_known_balance - 10 * DOLLARS - fees,
);
assert_eq!(
Balances::total_balance(&bob()),
179 * DOLLARS - 1 * transfer_fee(&xt(), fm),
179 * DOLLARS - 1 * fees,
);
});
}
Expand Down Expand Up @@ -755,7 +749,7 @@ fn successful_execution_gives_ok() {
assert_eq!(Balances::total_balance(&alice()), 111 * DOLLARS);
});

let fm = t.execute_with(TransactionPayment::next_fee_multiplier);
let fees = t.execute_with(|| transfer_fee(&xt()));

let r = executor_call::<NeverNativeValue, fn() -> _>(
&mut t,
Expand All @@ -770,7 +764,6 @@ fn successful_execution_gives_ok() {
.expect("Extrinsic failed");

t.execute_with(|| {
let fees = transfer_fee(&xt(), fm);
assert_eq!(Balances::total_balance(&alice()), 42 * DOLLARS - fees);
assert_eq!(Balances::total_balance(&bob()), 69 * DOLLARS);
});
Expand Down
12 changes: 6 additions & 6 deletions bin/node/executor/tests/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use frame_support::{
weights::{GetDispatchInfo, constants::ExtrinsicBaseWeight, IdentityFee, WeightToFeePolynomial},
};
use sp_core::NeverNativeValue;
use sp_runtime::{FixedPointNumber, FixedI128, Perbill};
use sp_runtime::{Perbill, FixedPointNumber};
use node_runtime::{
CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment,
CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, Multiplier,
TransactionByteFee,
constants::currency::*,
};
Expand All @@ -38,8 +38,8 @@ use self::common::{*, sign};
fn fee_multiplier_increases_and_decreases_on_big_weight() {
let mut t = new_test_ext(COMPACT_CODE, false);

// initial fee multiplier must be zero
let mut prev_multiplier = FixedI128::from_inner(0);
// initial fee multiplier must be one.
let mut prev_multiplier = Multiplier::one();

t.execute_with(|| {
assert_eq!(TransactionPayment::next_fee_multiplier(), prev_multiplier);
Expand All @@ -59,7 +59,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(0, 0))),
function: Call::System(frame_system::Call::fill_block(Perbill::from_percent(90))),
function: Call::System(frame_system::Call::fill_block(Perbill::from_percent(60))),
}
]
);
Expand Down Expand Up @@ -122,7 +122,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
}

#[test]
fn transaction_fee_is_correct_ultimate() {
fn transaction_fee_is_correct() {
// This uses the exact values of substrate-node.
//
// weight of transfer call as of now: 1_000_000
Expand Down
Loading