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

Commit

Permalink
Merge commit 5c43b2b (no conflict)
Browse files Browse the repository at this point in the history
Parent branch: origin/master
Forked at: 4da2926
  • Loading branch information
cecton committed Jul 21, 2020
2 parents 2a1a2ac + 5c43b2b commit c079e31
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .maintain/gitlab/check_polkadot_companion_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ curl -H "${github_header}" -sS -o companion_pr_reviews.json \
${github_api_polkadot_pull_url}/${pr_companion}/reviews

# If there are any 'CHANGES_REQUESTED' reviews for the *current* review
jq -r -e '.[] | select(.state == "CHANGES_REQUESTED").commit_id' \
< companion_pr_reviews.json > companion_pr_reviews_current.json
while IFS= read -r line; do
if [ "$line" = "$pr_head_sha" ]; then
boldprint "polkadot pr #${pr_companion} has CHANGES_REQUESTED for the latest commit"
exit 1
fi
done <<< $(jq -r -e '.[] | select(.state == "CHANGES_REQUESTED").commit_id' < companion_pr_reviews.json)
done < companion_pr_reviews_current.json

# Then we check for at least 1 APPROVED
if [ -z "$(jq -r -e '.[].state | select(. == "APPROVED")' < companion_pr_reviews.json)" ]; then
Expand Down
31 changes: 24 additions & 7 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 bin/node/cli/tests/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use regex::Regex;
use std::process::Command;

fn expected_regex() -> Regex {
Regex::new(r"^substrate (\d+\.\d+\.\d+(?:-.+?)?)-([a-f\d]+|unknown-commit)-(.+?)-(.+?)(?:-(.+))?$").unwrap()
Regex::new(r"^substrate (\d+\.\d+\.\d+(?:-.+?)?)-([a-f\d]+|unknown)-(.+?)-(.+?)(?:-(.+))?$").unwrap()
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion client/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pin-project = "0.4.8"
hash-db = "0.15.2"
serde = "1.0.101"
serde_json = "1.0.41"
sysinfo = "0.13.3"
sysinfo = "0.14.3"
sc-keystore = { version = "2.0.0-rc4", path = "../keystore" }
sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" }
sp-runtime = { version = "2.0.0-rc4", path = "../../primitives/runtime" }
Expand Down
2 changes: 2 additions & 0 deletions frame/support/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@ macro_rules! decl_module {
$(#[doc = $doc_attr:tt])*
fn integrity_test() { $( $impl:tt )* }
) => {
#[cfg(feature = "std")]
impl<$trait_instance: $trait_name$(<I>, $instance: $instantiable)?>
$crate::traits::IntegrityTest
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
Expand All @@ -1317,6 +1318,7 @@ macro_rules! decl_module {
$module:ident<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path)?>;
{ $( $other_where_bounds:tt )* }
) => {
#[cfg(feature = "std")]
impl<$trait_instance: $trait_name$(<I>, $instance: $instantiable)?>
$crate::traits::IntegrityTest
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
Expand Down
8 changes: 5 additions & 3 deletions frame/transaction-payment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ frame-support = { version = "2.0.0-rc4", default-features = false, path = "../su
frame-system = { version = "2.0.0-rc4", default-features = false, path = "../system" }
pallet-transaction-payment-rpc-runtime-api = { version = "2.0.0-rc4", default-features = false, path = "./rpc/runtime-api" }
smallvec = "1.4.1"
sp-io = { version = "2.0.0-rc4", path = "../../primitives/io", default-features = false }
sp-core = { version = "2.0.0-rc4", path = "../../primitives/core", default-features = false }

[dev-dependencies]
sp-io = { version = "2.0.0-rc4", path = "../../primitives/io" }
sp-core = { version = "2.0.0-rc4", path = "../../primitives/core" }
pallet-balances = { version = "2.0.0-rc4", path = "../balances" }
sp-storage = { version = "2.0.0-rc4", path = "../../primitives/storage" }

Expand All @@ -36,5 +36,7 @@ std = [
"sp-runtime/std",
"frame-support/std",
"frame-system/std",
"pallet-transaction-payment-rpc-runtime-api/std"
"pallet-transaction-payment-rpc-runtime-api/std",
"sp-io/std",
"sp-core/std",
]
64 changes: 63 additions & 1 deletion frame/transaction-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,42 @@ type NegativeImbalanceOf<T> =
/// https://w3f-research.readthedocs.io/en/latest/polkadot/Token%20Economics.html
pub struct TargetedFeeAdjustment<T, S, V, M>(sp_std::marker::PhantomData<(T, S, V, M)>);

/// Something that can convert the current multiplier to the next one.
pub trait MultiplierUpdate: Convert<Multiplier, Multiplier> {
/// Minimum multiplier
fn min() -> Multiplier;
/// Target block saturation level
fn target() -> Perquintill;
/// Variability factor
fn variability() -> Multiplier;
}

impl MultiplierUpdate for () {
fn min() -> Multiplier {
Default::default()
}
fn target() -> Perquintill {
Default::default()
}
fn variability() -> Multiplier {
Default::default()
}
}

impl<T, S, V, M> MultiplierUpdate for TargetedFeeAdjustment<T, S, V, M>
where T: frame_system::Trait, S: Get<Perquintill>, V: Get<Multiplier>, M: Get<Multiplier>,
{
fn min() -> Multiplier {
M::get()
}
fn target() -> Perquintill {
S::get()
}
fn variability() -> Multiplier {
V::get()
}
}

impl<T, S, V, M> Convert<Multiplier, Multiplier> for TargetedFeeAdjustment<T, S, V, M>
where T: frame_system::Trait, S: Get<Perquintill>, V: Get<Multiplier>, M: Get<Multiplier>,
{
Expand Down Expand Up @@ -192,7 +228,7 @@ pub trait Trait: frame_system::Trait {
type WeightToFee: WeightToFeePolynomial<Balance=BalanceOf<Self>>;

/// Update the multiplier of the next block, based on the previous block's weight.
type FeeMultiplierUpdate: Convert<Multiplier, Multiplier>;
type FeeMultiplierUpdate: MultiplierUpdate;
}

decl_storage! {
Expand Down Expand Up @@ -229,6 +265,32 @@ decl_module! {
<T as frame_system::Trait>::MaximumBlockWeight::get().try_into().unwrap()
).unwrap(),
);

// This is the minimum value of the multiplier. Make sure that if we collapse to this
// value, we can recover with a reasonable amount of traffic. For this test we assert
// that if we collapse to minimum, the trend will be positive with a weight value
// which is 1% more than the target.
let min_value = T::FeeMultiplierUpdate::min();
let mut target =
T::FeeMultiplierUpdate::target() *
(T::AvailableBlockRatio::get() * T::MaximumBlockWeight::get());

// add 1 percent;
let addition = target / 100;
if addition == 0 {
// this is most likely because in a test setup we set everything to ().
return;
}
target += addition;

sp_io::TestExternalities::new_empty().execute_with(|| {
<frame_system::Module<T>>::set_block_limits(target, 0);
let next = T::FeeMultiplierUpdate::convert(min_value);
assert!(next > min_value, "The minimum bound of the multiplier is too low. When \
block saturation is more than target by 1% and multiplier is minimal then \
the multiplier doesn't increase."
);
})
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion primitives/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parity-util-mem = { version = "0.7.0", default-features = false, features = ["pr
futures = { version = "0.3.1", optional = true }

# full crypto
ed25519-dalek = { version = "1.0.0-pre.3", default-features = false, features = ["u64_backend", "alloc"], optional = true }
ed25519-dalek = { version = "1.0.0-pre.4", default-features = false, features = ["u64_backend", "alloc"], optional = true }
blake2-rfc = { version = "0.2.18", default-features = false, optional = true }
tiny-keccak = { version = "2.0.1", features = ["keccak"], optional = true }
schnorrkel = { version = "0.9.1", features = ["preaudit_deprecated", "u64_backend"], default-features = false, optional = true }
Expand Down
4 changes: 3 additions & 1 deletion primitives/core/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use codec::{Encode, Decode};
use blake2_rfc;
#[cfg(feature = "full_crypto")]
use core::convert::TryFrom;
#[cfg(feature = "full_crypto")]
use ed25519_dalek::{Signer as _, Verifier as _};
#[cfg(feature = "std")]
use substrate_bip39::seed_from_entropy;
#[cfg(feature = "std")]
Expand Down Expand Up @@ -513,7 +515,7 @@ impl TraitPair for Pair {
Err(_) => return false,
};

let sig = match ed25519_dalek::Signature::from_bytes(sig) {
let sig = match ed25519_dalek::Signature::try_from(sig) {
Ok(s) => s,
Err(_) => return false
};
Expand Down
4 changes: 2 additions & 2 deletions utils/build-script-utils/src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ pub fn generate_cargo_keys() {
}
Ok(o) => {
println!("cargo:warning=Git command failed with status: {}", o.status);
Cow::from("unknown-commit")
Cow::from("unknown")
},
Err(err) => {
println!("cargo:warning=Failed to execute git command: {}", err);
Cow::from("unknown-commit")
Cow::from("unknown")
},
};

Expand Down

0 comments on commit c079e31

Please sign in to comment.