Weight annotation. (#3157)

* Make extrinsics extensible.

Also Remove old extrinsic types.

* Rest of mockup. Add tips.

* Fix some build issues

* Runtiem builds :)

* Substrate builds.

* Fix a doc test

* Compact encoding

* Extract out the era logic into an extension

* Weight Check signed extension. (#3115)

* Weight signed extension.

* Revert a bit + test for check era.

* Update Cargo.toml

* Update node/cli/src/factory_impl.rs

* Update node/executor/src/lib.rs

* Update node/executor/src/lib.rs

* Don't use len for weight - use data.

* Operational Transaction; second attempt (#3138)

* working poc added.

* some fixes.

* Update doc.

* Fix all tests + final logic.

* more refactoring.

* nits.

* System block limit in bytes.

* Silent the storage macro warnings.

* More logic more tests.

* Fix import.

* Refactor names.

* Fix build.

* Update srml/balances/src/lib.rs

* Final refactor.

* Bump transaction version

* Fix weight mult test.

* Fix more tests and improve doc.

* Bump.

* Make some tests work again.

* Fix subkey.

* Remove todos + bump.

* First draft of annotating weights.

* Refactor weight to u64.

* More refactoring and tests.

* New convert for weight to fee

* more tests.

* remove merge redundancy.

* Fix system test.

* Bring back subkey stuff.

* a few stress tests.

* fix some of the grumbles.

* Final nits.

* Update srml/system/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Scale weights by 1000.

* Bump.

* Fix decl_storage test.
This commit is contained in:
Kian Peymani
2019-07-25 11:58:47 +02:00
committed by Bastian Köcher
parent 80472956f8
commit 002acb9373
44 changed files with 844 additions and 259 deletions
+12 -12
View File
@@ -26,10 +26,10 @@ use substrate_primitives::{
ed25519, sr25519, hexdisplay::HexDisplay, Pair, Public, blake2_256,
crypto::{Ss58Codec, set_default_ss58_version, Ss58AddressFormat}
};
use parity_codec::{Encode, Decode, Compact};
use parity_codec::{Encode, Decode};
use sr_primitives::generic::Era;
use node_primitives::{Balance, Index, Hash};
use node_runtime::{Call, UncheckedExtrinsic, /*CheckNonce, TakeFees, */BalancesCall};
use node_runtime::{Call, UncheckedExtrinsic, BalancesCall, Runtime};
mod vanity;
@@ -90,14 +90,14 @@ fn execute<C: Crypto>(matches: clap::ArgMatches) where
<<C as Crypto>::Pair as Pair>::Signature: AsRef<[u8]> + AsMut<[u8]> + Default,
<<C as Crypto>::Pair as Pair>::Public: Sized + AsRef<[u8]> + Ss58Codec + AsRef<<<C as Crypto>::Pair as Pair>::Public>,
{
// let extra = |i: Index, f: Balance| {
// (
// system::CheckEra::<Runtime>::from(Era::Immortal),
// system::CheckNonce::<Runtime>::from(i),
// system::CheckWeight::<Runtime>::from(),
// balances::TakeFees::<Runtime>::from(f),
// )
// };
let extra = |i: Index, f: Balance| {
(
system::CheckEra::<Runtime>::from(Era::Immortal),
system::CheckNonce::<Runtime>::from(i),
system::CheckWeight::<Runtime>::from(),
balances::TakeFees::<Runtime>::from(f),
)
};
let password = matches.value_of("password");
let maybe_network = matches.value_of("network");
if let Some(network) = maybe_network {
@@ -138,7 +138,7 @@ fn execute<C: Crypto>(matches: clap::ArgMatches) where
let sig = pair.sign(&message);
println!("{}", hex::encode(&sig));
}
/*("transfer", Some(matches)) => {
("transfer", Some(matches)) => {
let signer = matches.value_of("from")
.expect("parameter is required; thus it can't be None; qed");
let signer = Sr25519::pair_from_suri(signer, password);
@@ -225,7 +225,7 @@ fn execute<C: Crypto>(matches: clap::ArgMatches) where
);
println!("0x{}", hex::encode(&extrinsic.encode()));
}*/
}
("verify", Some(matches)) => {
let sig_data = matches.value_of("sig")
.expect("signature parameter is required; thus it can't be None; qed");