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

new proc-macro-based benchmarking syntax #12924

Merged
merged 148 commits into from
Jan 23, 2023

Conversation

sam0x17
Copy link
Contributor

@sam0x17 sam0x17 commented Dec 13, 2022

Description

This PR introduces a new, simplified, and easier-to-use syntax for defining benchmarks that is based on a proc macro instead of a macro_rules! macro like the current system.

Right now the syntax looks like this:

#[benchmarks]
mod benchmarks {
    use super::*;
    ...
    #[benchmark]
    fn transfer_increasing_users(u: Linear<0, 1_000>) {
        let existential_deposit = T::ExistentialDeposit::get();
        let caller = whitelisted_caller();
        let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into());
        let _ = <Balances<T, I> as Currency<_>>::make_free_balance_be(&caller, balance);
        let recipient: T::AccountId = account("recipient", 0, SEED);
        let recipient_lookup = T::Lookup::unlookup(recipient.clone());
        let transfer_amount = existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into();
        for i in 0..u {
            let new_user: T::AccountId = account("new_user", i, SEED);
            let _ = <Balances<T, I> as Currency<_>>::make_free_balance_be(&new_user, balance);
        }

        #[extrinsic_call]
        transfer(RawOrigin::Signed(caller.clone()), recipient_lookup, transfer_amount);

        assert_eq!(Balances::<T, I>::free_balance(&caller), Zero::zero());
        assert_eq!(Balances::<T, I>::free_balance(&recipient), transfer_amount);
    }
    ...
}

Syntax

The #[benchmarks] macro expects a module containing any number of benchmark puesdo function definitions such as the one shown above to be provided in a block. These function definitions should be annotated with #[benchmark]. A where clause can be provided as an optional argument i.e. #[benchmarks(where <clause here>)].

Each benchmark function definition should be zero arg, or should specify one or more named parameters (that meets the requirements of frame_benchmarking::BenchmarkParameter with a type that implements frame_support::benchmarking::ParamRange. Right now the only struct implementing this trait is Linear, which has two generic u32 parameters`:

pub struct Linear<const A: u32, const B: u32>;

These generic parameters represent the (inclusive) start and end range of the benchmark parameter. So if you want to specify a range of 1 to 100,000 (inclusive) for the variable x, you would use:

#[benchmark]
fn my_benchmark(x: Linear<1, 100_000>) {

As mentioned before, you can also specify multiple parameters if necessary:

#[benchmark]
fn my_benchmark(x: Linear<100, 500>, y: Linear<200, 600>) {

These benchmark function definitions can be optionally annotated with the extra and skip_meta i.e. #[benchmark(skip_meta, extra)] and these function the same way they used to function when they were attributes in the old benchmarking syntax

Note that while these benchmark function definitions appear to be function definitions, currently they are not compiled as such (mainly because the signature would be incorrect with respect to the benchmark parameters). If generating a function that resembles the benchmark function definition is desirable, I could easily add this by changing the signature at compile time to transform things like x: Linear<0, 10> to x: u32. If this would be of practical use beyond the structs and trait impls already created by the macro then let me know!

The #[extrinsic_call] acts as a bisector between the setup code, the extrinsic call, and any verification code that needs to go at the end of the benchmark. The extrinsic call can be either block style (pass a block to #[extrinsic_call]), or must be a function call do an extrinsic where the first argument is the origin.

UPDATE: now we use #[block] for the block-style call, and #[extrinsic_call] for an actual extrinsic call.

Instance Benchmarks

You can specify #[instance_benchmarks] in place of #[benchmarks] if your pallet requires this.

Outer Macro Pattern

The new setup uses proc macros and the outer macro pattern, similar to the way pallets themselves are defined, with the caveat that individual benchmark function definitions can technically be parsed and expanded on their own -- the only reason we need the outer macro pattern is once all benchmarks within a benchmarks! {} block have been processed, we need to iterate over them and implement some traits such as run_benchmarks that require knowledge of all of the benchmarks, so this is why we need the outer macro pattern.

Status

  • parsing for new #[benchmark] attribute
  • parsing "bisection" technique for picking out the #[extrinsic_call] and using this to separate the setup code from the verification code
  • new ParamRange trait and a generic Linear struct that implements it
  • parsing support for ParamRange
  • parsing for new benchmarks! {} outer macro
  • basic expansion for #[benchmark] functions
  • expansion of benchmarks! {} macro
  • conversion of the Balances pallet to the new syntax
  • decide on syntax for specifying that we want to code-gen benchmark tests (previously was impl_benchmark_test_suite!, maybe we want to keep this? Update: yes, we need this
  • parsing + expansion for test suite syntax, if applicable
  • proper handling of where clauses
  • docs
  • UI tests

Related Issues

@sam0x17 sam0x17 self-assigned this Dec 13, 2022
@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Dec 13, 2022
@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 2, 2023

I now have the entire balances pallet benchmarking suite emitting code and compiling using the new syntax, and this is using an entirely new pipeline that doesn't use the old macros at all. New bit that I'm starting now is I need to make new syntax for doing the impl_benchmark_test_suite! expansion.

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 3, 2023

For anyone who might need it, this is the one-liner to expand all output of the balances pallet benchmarking code:

cargo expand --tests --lib benchmarking --features=runtime-benchmarks

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 3, 2023

Some high level open questions:

  1. do we want new syntax for specifying that benchmark test suites should be generated, if so, what should that look like? Right now the old syntax works fine inline with the new syntax, so we could address this in a future PR, but I've already been looking into it either way. Update: I am working on implementing this, the new syntax does not work out of the box with the old syntax so I do need to do this so we can have complete benchmark tests for the balances pallet.
  2. Is it correct that within groups of benchmarks, the entire group is always made up of all instance benchmarks or all non-instance benchmarks. If so I can simplify some syntax as mentioned above. I'm 90% sure this is correct. update: This is correct.
  3. Do we want to generate function definitions as well resembling the benchmark function syntax, as mentioned above? update: Looks like no

cc @kianenigma @shawntabrizi @bkchr

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 5, 2023

@ggwpez one question that arose when converting the message-queue pallet benchmarks to use the new syntax:

In situations like

MessageQueue::<T>::execute_overweight(RawOrigin::Signed(whitelisted_caller()).into(), 0u32.into(), 0u32, ((msgs - 1) as u32).into(), Weight::MAX).unwrap()
, would it be preferable that the .unwrap() is executed as part of the extrinsic call (i.e. would it be preferable that the overhead of .unwrap() is included in what we measure during benchmarking), or would it be better to execute this .unwrap() and other chained methods during the verify stage?

The same principle applies here for this .ok():

neighbours = MessageQueue::<T>::ready_ring_knit(&mid).ok();

There are two options I could follow to handle this:

  1. update my parsing code to also allow for method chains within the extrinsic call, allowing lines like this to remain unchanged
  2. require the programmer to refactor lines like this so they resemble the following (force methods chained on the extrinsic call to execute during the verify stage):
#[extrinsic_call]
let call = MessageQueue::<T>::execute_overweight(RawOrigin::Signed(whitelisted_caller()).into(), 0u32.into(), 0u32, ((msgs - 1) as u32).into(), Weight::MAX);

call.unwrap(); // executed during verification stage

(2) would be easier, but I can do either. I suspect it might be necessary to have the .unwrap() as part of the extrinsic call, but I don't know for sure.

@KiChjang
Copy link
Contributor

KiChjang commented Jan 5, 2023

Just one bit about the syntax -- is it possible to make benchmarks! the outer macro become an attribute macro instead, i.e. very much similar to how the pallet macro is an attribute macro over a rust module?

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 6, 2023

@KiChjang

Just one bit about the syntax -- is it possible to make benchmarks! the outer macro become an attribute macro instead, i.e. very much similar to how the pallet macro is an attribute macro over a rust module?

I originally used this approach. The reason I moved away from it is that custom inner attribute macros are unstable, so you would have to have a file called benchmarking.rs with another module (presumably called benchmarking) inside of that, which you would then attach the attribute macro to. If custom inner attribute macros were stable, I could do #![benchmarks] at the top of the file, and this whole thing would work perfectly, but yeah, for these reasons I opted for just having benchmarks! {} and having that inject into whatever module it is run in.

Happy to do it the other way (wouldn't be a difficult change), but it would mean we would have more nesting of modules than we have now.

@KiChjang
Copy link
Contributor

KiChjang commented Jan 6, 2023

Regarding the unwrap or ok being part of the extrinsic call, fundamentally speaking, I don't see why that should be the case. You are measuring the overhead of an extrinsic only, and anything extra is strictly speaking not part of an extrinsic call, thus option 2 is much more preferable.

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 6, 2023

Regarding the unwrap or ok being part of the extrinsic call, fundamentally speaking, I don't see why that should be the case. You are measuring the overhead of an extrinsic only, and anything extra is strictly speaking not part of an extrinsic call, thus option 2 is much more preferable.

@KiChjang I was hoping that was the case -- in that case the easier option is also an option more accurate than what we currently do in several places :)

@KiChjang
Copy link
Contributor

KiChjang commented Jan 6, 2023

@KiChjang

Just one bit about the syntax -- is it possible to make benchmarks! the outer macro become an attribute macro instead, i.e. very much similar to how the pallet macro is an attribute macro over a rust module?

I originally used this approach. The reason I moved away from it is that custom inner attribute macros are unstable, so you would have to have a file called benchmarking.rs with another module (presumably called benchmarking) inside of that, which you would then attach the attribute macro to. If custom inner attribute macros were stable, I could do #![benchmarks] at the top of the file, and this whole thing would work perfectly, but yeah, for these reasons I opted for just having benchmarks! {} and having that inject into whatever module it is run in.

Happy to do it the other way (wouldn't be a difficult change), but it would mean we would have more nesting of modules than we have now.

I was wondering about that as I finished typing, but this seems easily solvable with a re-export of the inner module types, much like how we often place a use pallet::*; on the pallet macro.

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 6, 2023

Ok @KiChjang and I spoke, it looks like we can avoid the double nesting problem the same way we do with pallet modules, by doing something like this:

#[benchmarks]
mod benchmarks {
    ...
}

Part of the expansion would inject a use benchmarks::* line that matches the visibility of the module, which solves the problem of having something like benchmarks::benchmarks::whatever

This also opens up the possibility of having a number of args directly on the #[benchmark] attribute, so will be refactoring a few things tonight and updating the description above accordingly :)

sam0x17 added a commit that referenced this pull request Jan 6, 2023
@kianenigma
Copy link
Contributor

kianenigma commented Jan 6, 2023

Regarding #12924 (comment), I think forcing programmer to put everything in one function is a bit to restrictive. I certainly remember writing benchmarks when the area that I wanted to measure was multiple function calls, also including some calls to .ok and such.

Also happy to hear that Keith's suggestion is feasible, as it looks a lot nicer. Then, we can see a pallet like:

#[pallet::pallet]
mod pallet { .. }

#[pallet::benchmarks]
mod benchmarks { .. }

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 6, 2023

@kianenigma

I certainly remember writing benchmarks when the area that I wanted to measure was multiple function calls, also including some calls to .ok and such.

I could allow a block, but in these situations, how do you specify the origin? This is one of the things that gets passed to the underlying benchmarking impls. For example given the extrinsic call below from the transfer method in the balances pallet, it extracts the first arg of the function call as the origin (RawOrigin::Signed(caller.clone())):

	#[benchmark]
	fn transfer() {
		let existential_deposit = T::ExistentialDeposit::get();
		let caller = whitelisted_caller();

		// Give some multiple of the existential deposit
		let balance = existential_deposit.saturating_mul(ED_MULTIPLIER.into());
		let _ = <Balances<T, I> as Currency<_>>::make_free_balance_be(&caller, balance);

		// Transfer `e - 1` existential deposits + 1 unit, which guarantees to create one account,
		// and reap this user.
		let recipient: T::AccountId = account("recipient", 0, SEED);
		let recipient_lookup = T::Lookup::unlookup(recipient.clone());
		let transfer_amount =
			existential_deposit.saturating_mul((ED_MULTIPLIER - 1).into()) + 1u32.into();

		#[extrinsic_call]
		transfer(RawOrigin::Signed(caller.clone()), recipient_lookup, transfer_amount);

		assert_eq!(Balances::<T, I>::free_balance(&caller), Zero::zero());
		assert_eq!(Balances::<T, I>::free_balance(&recipient), transfer_amount);
	}

How would this work with multiple calls? Or you just mean you want to allow chaining (which would be fine, I just have to extend some things in that case)

@ggwpez
Copy link
Member

ggwpez commented Jan 6, 2023

I could allow a block, but in these situations, how do you specify the origin?

We definitely need blocks. Just pure simple Rust code blocks, no parsing of that or anything. For example in the lottery pallet. There is no origin required, its just a code block.
Otherwise we cannot benchmark arbitrary runtime code. Sorry if that was not clear so far.
Maybe it makes sense to have a different attribute than #[extrinsic_call] in that case, not sure.

Regarding the unwrap: This also only happens in a code-block and therefore happens inside the benchmarked code.
You can get around that by using temporary variables, so I would not focus on optimizing out one unwrap() call.

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 6, 2023 via email

@ggwpez
Copy link
Member

ggwpez commented Jan 6, 2023

We could just have origin as an arg on the attribute

You mean on the #[extrinsic_call]?
Then it looks less like Rust… I think we should try to make it as Rusty as possible. I still dont see where the problem is with the origin. Blocks dont have origin. What I mean:

Origin needed here:

stop_repeat {
	let origin = …
}: _<T::RuntimeOrigin>(origin)
verify {
}

Origin not needed nor wanted here:

on_initialize_end {
	// …
}: {
	// Generate `MaxGenerateRandom` numbers for worst case scenario
	for i in 0 .. T::MaxGenerateRandom::get() {
		Lottery::<T>::generate_random_number(i);
	}
	// Start lottery has block 15 configured for payout
	Lottery::<T>::on_initialize(15u32.into());
}
verify {
	// …
}

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 6, 2023

Got it, I didn't realize the 3 different variants had different expansions 🙃

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 7, 2023

100% working now, finishing up docs 🎉

@ggwpez
Copy link
Member

ggwpez commented Jan 8, 2023

100% working now, finishing up docs tada

Looking really good, nice 🎉 !

For whats its worth, I think we could opt for a more compact syntax for the attributes:

#[benchmark(extra, skip_meta)]

instead of

#[benchmark]
#[extra]
#[skip_meta]

What do you think?

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 8, 2023 via email

sam0x17 added a commit that referenced this pull request Jan 8, 2023
@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 9, 2023

added.

@sam0x17
Copy link
Contributor Author

sam0x17 commented Jan 9, 2023

Need to add slightly more details in docs about the extra and skip_meta options and then this is g2g

@sam0x17 sam0x17 requested a review from ggwpez January 9, 2023 09:19
@sam0x17 sam0x17 marked this pull request as ready for review January 9, 2023 09:19
@github-actions github-actions bot removed the A3-in_progress Pull request is in progress. No review needed at this stage. label Jan 9, 2023
@paritytech-processbot paritytech-processbot bot deleted the sam-benchmarking-overhaul branch January 23, 2023 07:07
true => quote!(T: Config<I>, I: 'static),
};

let krate = generate_crate_access_2018("frame-benchmarking")?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are exporting the macro from frame-support, but require here that frame-benchmarking is present in the Cargo.toml. This is a macro anti pattern. The crate from where you re-export the macro is the crate that you search for in the Cargo.toml.

Copy link
Contributor Author

@sam0x17 sam0x17 Jan 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the reason I need frame-benchmarking is because this is where all the benchmarking-related traits and structs are. I put things in frame support for two reasons:

  1. if I put this in frame-benchmarking there would be a name collision with benchmarks!
  2. frame-benchmarking does not have a sub-crate for procedural macros (like the one in frame_support), so if we do move this over to frame-benchmarking, we will have to make a sub-crate and deal with the name collision issue.

Open to any suggestions. Discussion would be great to have on the follow-up issue here: https://github.com/paritytech/substrate/issues/13132

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2. frame-benchmarking does not have a sub-crate for procedural macros (like the one in frame_support), so if we do move this over to frame-benchmarking, we will have to make a sub-crate and deal with the name collision issue.

You can still reuse frame-support-procedural, but just re-export the macro from frame-benchmarking?

  1. if I put this in frame-benchmarking there would be a name collision with benchmarks!

When you have a declarative macro and a type with the same name, you import both with the same name. Then when you use Rust resolves the correct thing you want. Does that maybe also works for the attribute macro? Or we rename the proc-macro.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that maybe also works for the attribute macro? Or we rename the proc-macro.

This is a great suggestion if this is true. I will try it out and see! Then we could have everything live under frame_benchmarking

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update: this seems to work, see #13235

jiguantong pushed a commit to darwinia-network/substrate that referenced this pull request Feb 3, 2023
* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges 💥

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances 💥

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well 💥

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark 💥

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl 💥

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working 💥

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt paritytech#12924 (comment)

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) 🎉

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>
rossbulat pushed a commit that referenced this pull request Feb 3, 2023
* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges 💥

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances 💥

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well 💥

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark 💥

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl 💥

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working 💥

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt #12924 (comment)

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) 🎉

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>
jiguantong pushed a commit to darwinia-network/substrate that referenced this pull request Feb 8, 2023
* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges 💥

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances 💥

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well 💥

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark 💥

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl 💥

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working 💥

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt paritytech#12924 (comment)

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) 🎉

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>
@EgorPopelyaev EgorPopelyaev added B1-note_worthy Changes should be noted in the release notes T2-API This PR/Issue is related to APIs. and removed B3-apinoteworthy labels Feb 10, 2023
jiguantong pushed a commit to darwinia-network/substrate that referenced this pull request Feb 21, 2023
* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges 💥

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances 💥

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well 💥

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark 💥

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl 💥

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working 💥

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt paritytech#12924 (comment)

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) 🎉

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>
ltfschoen pushed a commit to ltfschoen/substrate that referenced this pull request Feb 22, 2023
* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges 💥

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances 💥

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well 💥

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark 💥

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl 💥

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working 💥

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt paritytech#12924 (comment)

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) 🎉

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>
@Polkadot-Forum
Copy link

ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges 💥

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances 💥

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well 💥

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark 💥

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl 💥

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working 💥

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt paritytech#12924 (comment)

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) 🎉

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>
devdanco added a commit to gasp-xyz/substrate that referenced this pull request May 25, 2023
* Use the balance trait as we have one (#13136)

* CI: Code mark to request a pipeline failure (#13139)

* Annotate thiserror for sp_core::crypto::SecretStringError (#13144)

* pallet-offences-benchmarking: Box events in verify (#13151)

* pallet-offences-benchmarking: Box events in verify

Events in frame are represented by an enum in the pallet and the runtime. The size of an enum in
Rust depends on the size of biggest variant. This means we always need to allocate memory for the
biggest variant when allocating memory for an event. The offences benchmarking is verifying the
benchmarking results by checking the events. To check the events it is generating all the expected
events. With the recent changes in Polkadot the events are too big and lead to issues when running
this verify functions. The solution is to box each event, as the vector holding all the events will
then only need to hold fat pointers * expected events, instead of size_of(event) * expected events.
This issue isn't a problem in production, as we never read the events on chain. When we are reading
the events, it is done in an offchain context and they are only decoded one by one.

Besides that this also enables the benchmarking verification for everyone running these benchmarks.

* FMT

* Disable checking again

* More improvements for the crate publishing pipeline (#13153)

* more improvements for the crate publishing pipeline

* move default definitions to the publish-crates script

* add script to check the crate publishing pipeline at the start

* fix yaml references

* move more variables to .crates-publishing-pipeline

* separate .crates-publishing-pipeline from .crates-publishing-variables

* clean up redundant and unused code

* txpool: don't maintain the pool during major sync (#13004)

* txpool: don't maintain the pool during major sync

Fix shall prevent from wasting the CPU during the major sync. No actions
are actually required in transaction pool during the major sync.

Fixes: #12903

* passing sync_oracle to maintain method

* fixed: builder, txpool tests

* do not maintain tx-pool if node gone out of sync

* EnactmentAction: all logic moved to EnactmentState

Tests to be done.

* maintain guard logic moved directly to MaintainedTransactionPool

* minor fixes

* EnactmentAction: all logic moved to EnactmentState (again)

* SyncOracle fixes here and there

* Update client/transaction-pool/src/enactment_state.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/transaction-pool/src/enactment_state.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* sync_oracle removed

* spelling + fmt + doc

* Review suggestions applied

* log::info -> debug

* Update client/transaction-pool/src/enactment_state.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <git@kchr.de>

* [client/network] Add support  for `/wss` addresses (#13152)

* join dns with another instance of WS transport

Secure Websocket transport needs unresolved addresses, so we join DNS transport with
yet another instance of Websocket transport.

Closes #12024

* WSS transport itself need to wrap DNS transport

in order to resolve addresses before passing them down to TCP transport

Refs https://github.com/libp2p/rust-libp2p/issues/3330

* reverse order

* simplify code: remove WS from WSS inner DNS transport

* remove the 2nd instance of WS transport

* NIS should retain funds in reserve (#12928)

* Keep funds with receipt holder

* Counterpart is optional

* Use named reserves

* Tests

* Benchmarks

* Fixes

* Update frame/nis/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Update frame/nis/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Update frame/nis/src/tests.rs

* Update frame/nis/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nis/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nis/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Update frame/nis/src/lib.rs

* Formatting

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Refactory of `next_slot` method (#13155)

Refactory of `next_slot` method

* Prevents slot worker exit if inherent data provider creation fails
* Failure is not possible anymore
* Fix potential failure after warp-sync where block headers of not already downloaded blocks are used by the inherent data provider

* Breakout mock runtimes to separate files (#13150)

* break out moch runtimes to separate files

* tranaction-payment: break out tests & mock runtime to separate files

* frame-benchmarking: Macros should not force a particular env (#13161)

The macros in frame-benchmarking relied on having all the macros imported, which isn't a behavior
for a proper macro :D This pr fixes this by making all internal macro usages absolute.

* Fix the `storage_size`/`state_getStorageSize` RPC call (#13154)

* Have `KeyIterator` clone the `prefix` it receives

* Stream keys in `storage_size` RPC and add a runtime limit

* Update client/rpc/Cargo.toml

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/rpc/src/state/utils.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Rename the types to signify that the cancellation is due to a timeout

* Move the test into a `mod tests`

* Add a comment regarding `biased` in `tokio::select`

* Make the `clone` explicit when calling `KeyIterator::{new, new_child}`

Co-authored-by: Bastian Köcher <git@kchr.de>

* [contracts] Adapt storage reading host functions to Weights V2 (#12976)

* update RuntimeCosts to Weights V2, update tests

* improve docs

* clearer naming and docs to compat_weight helper

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* save before master merge

* HostFnWeights to Weight

* added to_weight! macro

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* RuntimeCosts::ChainExtension to weight_v2

* chain extension to weight v2

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* zobmienet tests are not supposed to fail (#13015)

* zobmienet tests are not supposed to fail

* Update scripts/ci/gitlab/pipeline/zombienet.yml

Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>

Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>

* [contracts] Add integrity checks by pallet hook (#12993)

* integrity test for MaxCodeLen and CallStack::len()

* integrity test for MaxDebugBufferLen

* addressed review comments

* fix append_debug_buffer()

* ci fix

* updated code_len_limit formula after further discussion

* enlarged mem safe margin after discussion

* +doc to Config trait associated types

* Apply suggestions from code review

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* more lil fixes from code review feedback

* lowered max call depth to satisfy mem limits

* fix node runtime pallet params to satisfy integrity check

* fix max call depth value calc

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* Expose `UnknownBlock` error via `ApiError` (#12707)

* Expose `UnknownBlock` error via `ApiError`

In [certain cases](https://github.com/paritytech/polkadot/issues/5885) a
runtime api is called for an unknown block. For example a block which is
already pruned or on an abandon fork.

In such cases the correct error is returned but it is wrapped in
`ApiError::Application` and the only way to figure out what is the
problem is to inspect the actual message in the error. In polkadot for
example this usually happens when the runtime api version is being
queried. It's beneficial to be able to clearly separate such errors so i
that when they occur the client side can handle them more gracefully.
E.g. log less stressful error message than `State already discarded for
BlockId` or cancel any pending work related on this block.

* Update primitives/api/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

Co-authored-by: Bastian Köcher <git@kchr.de>

* Notification-based block pinning (#13157)

* Worker

* Reorganize and unpin onnotification drop

* Pin in state-db, pass block number

* Pin blocks in blockchain db

* Switch to reference counted LRU

* Disable pinning when we keep all blocks

* Fix pinning hint for state-db

* Remove pinning from backend layer

* Improve readability

* Add justifications to test

* Fix justification behaviour

* Remove debug prints

* Convert channels to tracing_unbounded

* Add comments to the test

* Documentation and Cleanup

* Move task start to client

* Simplify cache

* Improve test, remove unwanted log

* Add tracing logs, remove expect for block number

* Cleanup

* Add conversion method for unpin handle to Finalitynotification

* Revert unwanted changes

* Improve naming

* Make clippy happy

* Fix docs

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* Use `NumberFor` instead of u64 in API

* Hand over weak reference to unpin worker task

* Unwanted

* &Hash -> Hash

* Remove number from interface, rename `_unpin_handle`, LOG_TARGET

* Move RwLock one layer up

* Apply code style suggestions

* Improve comments

* Replace lru crate by schnellru

* Only insert values for pinned items + better docs

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* Improve comments, log target and test

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Make DispatchError impl MEL (#13169)

* Make DispatchError impl MEL

* Upgrade SCALE codec to support `codec(skip)` for MEL

Co-authored-by: Bastian Köcher <info@kchr.de>

* Remove fixtures from crate (#13181)

* txpool: LOG_TARGET const added (#13180)

* txpool: LOG_TARGET const added

part of: #12873

* LOG_TARGET added to tests mod

* txpool::api for api

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>

* Fix potential huge allocation as a result of `validate_block` output (#13183)

* Fix potential huge allocation as a result of `validate_block` output

* Address review comments; add more tests

* Update client/executor/wasmtime/src/runtime.rs

* Remove unnecessary comments

Co-authored-by: Bastian Köcher <git@kchr.de>

* sc-network: Ensure private addresses are disabled if requested (#13185)

When running with `--no-private-ipv4` the node should not trying to connect to any private ip
addresses. With the switch to libp2p this behavior was broken. Part of this version upgrade was the
following pr: https://github.com/libp2p/rust-libp2p/pull/2995. This pr changed the default cache
size of `libp2p-identity` from `0` aka disabled to `100`. Together with our implementation that was
calling into `identity` to request addresses for a given peer. Before the switch to libp2p 0.50.0
this was returning zero addresses, but now with the cache enabled it started to return addresses.
This pr fixes this by only letting discovery return addresses for a peer. It also ensures that we
filter private addresses if requested. The cache is also disabled to restore the previous caching
behavior, but it will actually not be called anymore.

* Warn validators with slow hardware (#12620)

* move Metric

* run hardware bench if validiator flag is being used

* fix rustdoc & update node-template

* fix

* unused improt

* warn

* move Requirement

* bench_result

* ensure_requirements

* make the code compile

* check if authority

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* nit fixes

* warning signs

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use year 2023 in the License headers (#13193)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Move slow hardware warning print logic to CLI (#13198)

* Move slow hardware warning print logic to CLI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>

* Fix flaky BABE test (#13199)

The `authoring_blocks` test of BABE was calculating the slot based on the timestamp it sometimes
failed in CI. The problem is that we combine all the notifications and authoring futures in one big
future. This one big future may first polls one authoring future to build a block. Then it polls all
notification futures again to import the block. Then some other authoring future is polled and
builds on the imported block using the same slot and making the import fail. The solution is that we
just artificially increase the slot to make the test work.

* Add debug info in assert_has_event and assert_last_event (#12979)

* improve debug info in assert_has_event and assert_last_event

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

Co-authored-by: Bastian Köcher <git@kchr.de>

* new proc-macro-based benchmarking syntax (#12924)

* add stub for new benchmark macro

* benchmark syntax

* add #[extrinsic call] separator

* parse #[benchmark] item as a function

* proper emission of error when #[extrinsic_call] annotation is missing

* clean up

* enclosing module via benchmarks! { } working

* use an attribute macro on the module instead of benchmarks! { }

* cargo fmt

* working component implementation

* WIP

* working

* add syntax for Linear<A, B>

* parsing of param ranges (still need to build tuple though)

* params parsing WIP

* clean up (don't need extrinsic call name)

* use proper Result syntax for BenchmarkDef parsing

* proper parsing of Linear<0, 1> style args

* successfully parse and make use of linear component ranges :boom:

* rename support variable => home because eventually will be moved

* compile-time check that param range types implement ParamRange

* switch to using balances as example, failing on instance pallet

* successfully set up __origin and __call with balances :boom:

* clean up

* use a module

* don't need a variable for transfer

* rename benchmark_transfer -> transfer because no longer conflicts

* clean up

* working with transfer_increasing_users as well :boom:

* re-add BareBlock

* add comments for undocumented structs+functions+traits

* refactor in preparation for removing module requirements

* switch to a block instead of a module

* use the outer macro pattern to to enable #[benchmarks] aggregation

* successfully generate SelectedBenchmark :boom:

* implement components for SelectedBenchmark

* implement instance for SelectedBenchmark

* properly track #[extra]

* working impl for fn benchmarks()

* run_benchmarks WIP

* finish run_benchmark! impl :boom:

* import balances transfer_best_case benchmark

* import transfer_keep_alive balances pallet benchmark

* import set_balance_creating balances pallet benchmark

* import set_balance_killing balances pallet benchmark

* import force_transfer balances pallet benchmark

* add #[extra] annotation and docs to transfer_increasing_users

* import transfer_all balances pallet benchmark

* import force_unreserve balances pallet benchmark

* prepare to implement impl_benchmark_test_suite!

* ensure tests cover #[extra] before and after #[benchmark] tag

* refactor

* clean up

* fix

* move to outer

* switch to benchmarks/instance_benchmarks

* test impl almost done, strange compiler error

* benchmark test suites working :boom:

* clean up

* add stub and basic parsing for where_clause

* working except where clause and extrinsic calls containing method chains

* assume option (2) for now wrt https://github.com/paritytech/substrate/pull/12924#issuecomment-1372938718

* clean up

* switch to attribute-style

* properly handle where clauses

* fix subtle missing where clause, now just MessageQueue issues

* fix block formatting in message-queue pallet

* switch to block vs non-block parsing of extrinsic call

* working now but some benchmark tests failing

* message-queue tests working (run order issue fixed) :tada:

* add comments and internal docs for fame_support_procedural::benchmark

* fix license years

* docs for lib.rs

* add docs to new support procedural macros

* don't allow #[benchmark] outside of benchmarking module

* add docs

* use benchmark(extra, skip_meta) style args

* update docs accordingly

* appease clippy

* bump ci

* add notes about `extra` and `skip_meta`

* fix doc tests

* re-run CI

* use `ignore` instead of `no_run` on doc examples

* bump CI

* replace some if-lets with if-elses

* more refactoring of if-let statements

* fix remaining if-lets in BenchmarkDef::from()

* fix if-lets in benchmarks()

* fix remaining if-lets, use nested find_map for extrinsic call

* switch to use #[extrinsic_call] or #[block] situationally

* refactor ExtrinsicCallDef => BenchmarkCallDef

* update docs with info about #[block]

* add macro stub for #[extrinsic_call]

* fix docs and add stub for #[block] as well

* remove unused extern crate line

* fix clippy nits

* Use V2 bench syntax in pallet-example-basic

Just testing the dev-ex...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* carry over comment

* use curly-brace style for impl_benchmark_test_suite!

* remove unneeded parenthesis

* proper handling of _() extrinsic call style

* add docs for _() syntax

* fix crate access

* simplify keyword access

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* simplify module content destructuring

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix crate access "frame_benchmarking" => "frame-benchmarking", compiles

* use _() extrinsic call syntax where possible in balances

* simplify attr.path.segments.last()

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix compile error being suppressed

* simplify extrinsic call keyword parsing

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use ? operator instead of return None

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* rename generics => type_use_generics
rename full_generics => type_impl_generics

* simplify extrinsic call extraction with transpose

* bump CI

* nit

* proper handling of too many + too few block/extrinsic call annotations

* change to B >= A

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove unneeded ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* remove another ignore

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add ui tests

* use _() style extrinsic call on accumulate_dummy

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* add range check to ParamRange

* ui test for bad param ranges

* fix failing example

* add ignore back to other failing example

* tweak expr_call span

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fix typo

* eliminate a match

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* change pub fn benchmarks to return Result<TokenStream>

* fix origin error span

* more informative error for invalid benchmark parameter name

* fix spans on a few benchmark errors

* remove unneeded clone

* refactor inner loop of benchmark function parsing

* preserve mod attributes

* refactor outer loop of benchmark def parsing code, greatly simplified

* simplify to use a ? operator when parsing benchmark attr path

* fix another ? operator

* further simplify benchmark function attr parsing with more ? ops

* refactor extrinsic call handling to use if let rather than match

* replace is_ok => is_err

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* re-use name during expansion of benchmark def

* remove unneeded clone

* fix span for origin missing error

* fix missing semi

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: parity-processbot <>

* Rename `*-private-ipv4` to `*-private-ip` CLI args (#13208)

* Rename `*-private-ipv4` to `*-private-ip` CLI args

Renames the `*-private-ipv4` to `*-private-ip` in the CLI interface. The old names are staying as
alias, thus it will not break for anyone. Besides that it also fixes the naming in the rest of the code.

* FMT

* Remove dead code (#13213)

* [Fix] CountedMap::set now takes Counter into account (#13214)

* [Fix] CountedMap::set now takes Counter into account

* introduce tests for StorageMap

* debug assert events at genesis (#13217)

* BlockId removal: refactor: CallExecutor trait (#13173)

* BlockId removal: refactor: CallExecutor trait

It changes the arguments of CallExecutor methods:
-  `call`, 'contextual_call', 'runtime_version', 'prove_execution'

from: `BlockId<Block>` to: `Block::Hash`

This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292)

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* ".git/.scripts/commands/fmt/fmt.sh"

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: command-bot <>

* service: storage monitor added (#13082)

* service: storage monitor added

Storage monitor added. It uses `notify` create to get notifications
about any changes to monitored path (which is database path).
Notifications are consumed in essential task which terminates when
available storage space drops below given threshold.

Closes: #12399

* Cargo.lock updated

* misspell

* fs events throttling added

* minor updates

* filter out non mutating events

* misspell

* ".git/.scripts/commands/fmt/fmt.sh"

* Update client/service/src/storage_monitor.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* storage-monitor crate added

* cleanup: configuration + service builder

* storage_monitor in custom service (wip)

* copy-paste bad desc fixed

* notify removed

* storage_monitor added to node

* fix for clippy

* publish = false

* Update bin/node/cli/src/command.rs

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* crate name: storage-monitor -> sc-storage-monitor

* error handling improved

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* publish=false removed

Co-authored-by: command-bot <>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Co-authored-by: Bastian Köcher <git@kchr.de>

* beefy: Add LOG_TARGET constant (#13222)

* LOG_TARGET const
* fmt

* Upgrade wasm-opt to 0.111.0 (#13038)

* storage-monitor: statvfs arithmetic bug fixed (#13234)

* Bump parity-db (#13226)

* pallet-assets: Rename `total_supply` to `amount` (#13229)

* pallet-assets: Rename `total_supply` to `amount`

We are actually passing the `amount` on assets being minted and not the total supply.

Closes: https://github.com/paritytech/substrate/issues/13210

* ".git/.scripts/commands/fmt/fmt.sh"

* Fix compilation

* FMT

Co-authored-by: command-bot <>

* Babe: bad epoch index with skipped epochs and warp sync (#13135)

* Detect and correct epoch-index for skipped epochs

* Code refactory

* Epoch index should be also be fixed for secondary claims with VRF

* Fix typo

* Make clippy happy

* Fix typo

* Trigger pipeline

* contracts: Deprecate random interface (#13204)

* Deprecate random interface

* Revert change to runtime file

* Fix docs

* Fix tests

* Rename to not_deprecated

* Apply suggestions from code review

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* Deprecate `set_rent_allowance`

Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>

* [contracts] Add upfront weight of merkle trie proofs for storage reading functions (#13236)

* Add upfront weight of merkle trie proofs for storage reading functions

* drive-by fixes

* CI: Rewrite `check-each-crate` in python (#13238)

* CI: Rewrite `check-each-crate` in python

This is a much better readable version of the script and it should also work on Macos and not
siltently fail ;)

* Fix dumb bugs and print everything to stderr

* Don't buffer Python output

* :facepalm:

* :facepalm: :facepalm:

* Use check all until we have more macos runners

* Update scripts/ci/gitlab/check-each-crate.py

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update scripts/ci/gitlab/pipeline/test.yml

Co-authored-by: Vladimir Istyufeev <vladimir@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix try-runtime with create-snapshot (#13223)

* Fix try-runtime with create-snapshot

* Apply review suggestions

* reduce exec time of fast-unstake benchmarks (#13120)

* reduce exec time of fast-unstake benchmarks

* fix test

* fmt

* fix patch the tests

* fix patch the tests

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* add batch size as well

* update some benches to be better

* fix one last test

* fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* reduce time even more

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* fix tests

* nit

* remove

* improve the weight calc further

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* fix benchmarks

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* update

* fix

* fix

* fmt

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* lots of changes again...

* smaller input

* update

* fmt

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* cleanup

* small simplification

* fmt

* reduce exec time a bit

* fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* test

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* increase again

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

* review comments

* fmt

* fix

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_fast_unstake

Co-authored-by: command-bot <>

* Rework the trie cache (#12982)

* Rework the trie cache

* Align `state-machine` tests

* Bump `schnellru` to 0.1.1

* Fix off-by-one

* Align to review comments

* Bump `ahash` to 0.8.2

* Bump `schnellru` to 0.2.0

* Bump `schnellru` to 0.2.1

* Remove unnecessary bound

* Remove unnecessary loop when calculating maximum memory usage

* Remove unnecessary `mut`s

* Add task type label to metrics (#13240)

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* upgrade nix to 0.26.1 (#13230)

* Add WeightToFee and LengthToFee impls to transaction-payment Runtime API (#13110)

* Add WeightToFee and LengthToFee impls to RPC

* Remove RPC additions

* Update frame/transaction-payment/rpc/runtime-api/src/lib.rs

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* Add comments to length_to_fee and weight_to_fee

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Correct arithmetical semantic of `PerDispatchClass` (#13194)

* Fix PerDispatchClass arithmetic

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Test PerDispatchClass arithmetic

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add helpers for Weight

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove stale doc

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Dont mention Polkadot in Substrate

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Remove saturating_ prefix

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix usage

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Aura: Fix warp syncing (#13221)

* Aura: Fix warp syncing

We need to set the fork choice rule! When using Cumulus this is done by the `ParachainsBlockImport`,
but for standalone chains we still need this!

Closes: https://github.com/paritytech/substrate/issues/13220

* Improve fork choice

* Add Proof Size to Weight Output (#11637)

* initial impl

* add template test

* linear fit proof size

* always record proof when tracking storage

* calculate worst case pov

* remove duplicate worst case

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* more comment output

* add cli for worst case map size

* update name

* clap does not support underscores

* rename

* expose worst case map values

* improve some comments

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* update template

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* fix fmt

* more fmt

* more fmt

* Dont panic when there is no proof

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix test features

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Whitelist :extrinsic_index

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use whitelist when recording proof

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add logs

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add PoV testing pallet

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Deploy PoV testing pallet

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Storage benches reside in the PoV pallet

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Linear regress PoV per component

Splits the PoV calculation into "measured" and "estimated".
The measured part is reported by the Proof recorder and linear
regressed over all components at once.
The estimated part is calculated as worst-case by using the max
PoV size per storage access and calculating one linear regress per
component. This gives each component a (possibly) independent PoV.
For now the measured size will always be lower than the PoV on
Polkadot since it is measured on an empty snapshot. The measured
part is therefor only used as diagnostic for debugging.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Put PoV into the weight templates

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Extra alanysis choise for PoV

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add+Fix tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make benches faster

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Cleanup

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use same template comments

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/bench-bot.sh" pallet dev pallet_balances

* ".git/.scripts/bench-bot.sh" pallet dev pallet_democracy

* Update referenda mock BlockWeights

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Take measured value size into account

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* clippy

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/bench-bot.sh" pallet dev pallet_scheduler

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* proof_size: None

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ugly, but works

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* wup

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* WIP

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add pov_mode attribute to the benchmarks! macro

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use pov_mode attribute in PoV benchmarking

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Scheduler, Whitelist: Add pov_mode attr

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update PoV weights

* Add CLI arg: default-pov-mode

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fix

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Revert "Update PoV weights"

This reverts commit 2f3ac2387396470b118122a6ff8fa4ee12216f4b.

* Revert "WIP"

This reverts commit c34b538cd2bc45da4544e887180184e30957904a.

* Revert first approach

This reverts commit range 8ddaa2fffe5930f225a30bee314d0b7c94c344dd^..4c84f8748e5395852a9e0e25b0404953fee1a59e

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Clippy

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add extra benchmarks

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_alliance

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_whitelist

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_scheduler

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Clippy

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Clippy 🤦

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add reference benchmarks

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix doc comments

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Undo logging

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add 'Ignored' pov_mode

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Allow multiple attributes per benchmark

Turns out that the current benchmarking syntax does not support
multiple attributes per bench 🤦. Changing it to support that
since otherwise the `pov_mode` would conflict with the others.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Validate pov_mode syntax

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Ignore PoV for all contract benchmarks

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Bump macro recursion limit

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update contract weights

They dont have a PoV component anymore.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fix test ffs

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* pov_mode is unsupported in V2 syntax

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix pallet ui tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* update pallet ui

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix pallet ui tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update weights

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
Co-authored-by: Your Name <you@example.com>

* Use non-binary pronouns in comments. (#13209)

* use non binary pronouns in comments

* cargo fmt

* fix the use of "it" with "they" when dealing about an opperations identity

* migrate new benchmarking syntax from `frame_support::benchmarking` to `frame_benchmarking::v2` (#13235)

* * re-export frame_support::benchmarking in frame_benchmarking::
* prefer use frame_benchmarking::*; in examples, etc

* switch to frame_benchmarking::v2

* completely migrate new benchmarking code out of frame_support

* fix doc links

* remove unneeded return

Co-authored-by: Bastian Köcher <git@kchr.de>

* remove another unneeded return

Co-authored-by: Bastian Köcher <git@kchr.de>

* properly export all macros in v1

* refactor existing frame_benchmarking imports to use ::v1

---------

Co-authored-by: Bastian Köcher <git@kchr.de>

* mutate_exists for StorageValue with ValueQuery (#13245)

* mutate_exists for StorageValue with ValueQuery

Signed-off-by: muraca <mmuraca247@gmail.com>

* added `#[crate::storage_alias]` to tests

Signed-off-by: muraca <mmuraca247@gmail.com>

* added StorageEntryMetadata

Signed-off-by: muraca <mmuraca247@gmail.com>

* Update frame/support/src/lib.rs

---------

Signed-off-by: muraca <mmuraca247@gmail.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Fix derive PassByInner with generics (#13247)

* Fix derive PassByInner with generics

* Update primitives/runtime-interface/proc-macro/src/pass_by/inner.rs

---------

Co-authored-by: Bastian Köcher <git@kchr.de>

* docs: Fix broken documentation links for pallets (#13241)

Fixes broken links to `Config` and `Call`, for READMEs the link has
been fixed by adding the missing "/pallet" path, and for rust docs we
let the compiler figure out the type's link by itself

Signed-off-by: Jonathas-Conceicao <jonathasaoc@gmail.com>

* sc-finality-grandpa: Warp proof generation can not expect justifications (#13249)

When a node is running with `--blocks-pruning` it will also prunes justifications. So, the warp
proof generation can not use `expect` for unwrapping the justification.

* update criterion to v0.4.0 (#13142)

* fix up template (#13205)

* Remove `uncles` related code (#13216)

The code was added without any clear usage. The inherent for example is not benchmarked and not used.

* Implement RIType traits for u8 array with an arbitrary size (#13256)

* grandpa: cleanup stale entries in set id session mapping (#13237)

* grandpa: cleanup stale entries in set id session mapping

* Update frame/grandpa/src/migrations.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* grandpa: remove unused import

* grandpa: migration off-by-one

* Update frame/grandpa/src/lib.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Update frame/grandpa/src/lib.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* grandpa: MaxSetIdSessionEntries as u64

* node-template: fix MaxSetIdSessionEntries type

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Benchmark's successful origin api update (#13146)

* try successful origin unimplemented by default

* error as a default impl for try_successful_origin

* remove successful_origin func of EnsureOrigin trait

* default impl -> unimplemented!()

* update EnsureOriginWithArg

* fix EnsureOriginWithArg

* prefix unused arg with underscore

* use try_successful_origin instead successful_origin, map err to Weightless

* fix tests

* remove default impl

* unwrap for indirect origin dep

* replace unwrap by expect with a message

---------

Co-authored-by: parity-processbot <>

* hooks default impl missing where clause (#13264)

* hooks default impl missing where clause

* add tests

* Update frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs

---------

Co-authored-by: parity-processbot <>

* implemented `contains_prefix` for StorageDoubleMap and StorageNMap (#13232)

* implemented `contains_prefix` for StorageDoubleMap and StorageNMap

Signed-off-by: muraca <mmuraca247@gmail.com>

* match prefix to next_key

Signed-off-by: muraca <mmuraca247@gmail.com>

* warning unexpected behaviour with empty keys

Signed-off-by: muraca <mmuraca247@gmail.com>

* clarifications for unhashed::contains_prefixed_key

Signed-off-by: muraca <mmuraca247@gmail.com>

* added tests for StorageNMap

Signed-off-by: muraca <mmuraca247@gmail.com>

---------

Signed-off-by: muraca <mmuraca247@gmail.com>

* Calling proxy doesn't remove announcement (#13267)

* Calling proxy doesn't remove announcement

* Update frame/proxy/src/tests.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* fmt

---------

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Fee and tip represented as asset ID inside `AssetTxFeePaid` (#13083)

* fee & tip in the asset ID Balance type

* docs

* rewrite

* update runtime config

* docs

* Move beefy-merkle-tree to utils/binary-merkle-tree and make it generic (#13076)

* move BeefyMmrApi to pallet-beefy-mmr

* fix test_utils use pallet-beefy-mmr BeefyMmrApi

* Move beefy-merkle-tree to utils and Rename to Merkle-tree

* fix fmt and test

* Update merkle-tree to binary-merkle-tree and Remove Keccak256 mod from merkle-tree

* change merkle-tree name to binary-merkle-tree

* mirr fix

* Metadata V15: Derive `TypeInfo` for describing runtime types (#13272)

* scale_info: Derive TypeInfo for types present in runtime API

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* cargo: Update Cargo.lock

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* benchmarks: EnsureRankedMember must add ranked members (#13297)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Minor: Update output validity tests (#13190)

* Minor: Update output validity tests

Quick follow-up to https://github.com/paritytech/substrate/pull/13183.

Mainly, I wanted to double check that the `test_return_max_memory_offset` test doesn't pass just
because the output length is 0.

I also:

- Organized these tests into a module.
- Added a comment explaining why we don't use the `wasm_export_functions` macro.

* Update test based on review comment

* BEEFY: define on-chain beefy-genesis and use it to coordinate voter initialization (#13215)

* beefy: add support to configure BEEFY genesis

* client/beefy: more flexible test runtime api

* client/beefy: add tests for custom BEEFY genesis

* client/beefy: ignore old state that didn't account for pallet genesis

* client/beefy: fix clippy

* frame/beefy: default BEEFY-genesis is block One::one()

* frame/beefy: add extra doc comments

---------

Co-authored-by: parity-processbot <>

* feat: add event SkepticsChosen event in society (#13291)

* feat: add event SkepticsChosen event in society

* feat: add test for SkepticsChosen event

* feat(client): significantly increase wasm instance limits (#13298)

Following https://github.com/paritytech/substrate/issues/11949, this PR will allow parachains with runtimes bigger than Kusama to use the pooling strategy.

* Remove in-tree bounded types and use bounded-collections crate (#13243)

* Remove in-tree bounded types and use bounded-collections crate

* Fixes

* Bump bounded-collections version

* cargo fmt

* Bump bounded-collections

* Only export non-bounded types at the top level

* Fixes

* Bump bounded-collections

* update linregress in frame-benchmarking to 0.5.1 (#13310)

* update nalgebra in frame-benchmarking to 0.5.0

* upgrade to 0.5.1 to incorporate upstream fix in linregress

* [client/network] remove peer entry from `ephemeral_addresses` (#13084)

* [client/network] remove peer entry from `ephemeral_addresses`

if there are no addresses associated with that peer

* refactor as per @bkchr suggestion

https://github.com/paritytech/substrate/pull/13084#discussion_r1068028534

* add missing import

* fix error

* rpc-spec-v2/tx: Fix error typo (#13307)

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

* BEEFY: client support for detecting equivocated votes (#13285)

* client/beefy: detect equivocated votes

* client/beefy: make sure to persist state after voting

* client/beefy: drop never-used aux-schema v2 migration

* impl review suggestion

---------

Signed-off-by: Adrian Catangiu <adrian@parity.io>

* Bump `wasmtime` to 5.0.0 (and a few other deps) (#13160)

* Bump `wasmtime` to 4.0.0 (and a few other deps)

* Use `Error::msg` instead of `anyhow!`

* Bump `wasmtime` to 5.0.0

* Update `Cargo.lock`

* Add `wasmtime` feature to `sp-wasm-interface` dependency

* Fix: Off-chain-worker example (#13300)

* fix: divider

* update comment

* Rename `pallet-random-collective-flip` to Insecure... (#13301)

* Rename pallet-random-collective-flip to Insecure...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* `zombienet`: warp-sync tests for validators  (#13078)

* zombienet validators warp sync draft

Sketch of warp-sync test for validators.
Not tested.

Follow-up of: #12769

* yet another warp-sync scenario added

- all validators are synced from DB,
- some full nodes are synced from DB,
- full-node is warp-synced

* fixes

* fixes

* missing files

* path fixed

---------

Co-authored-by: parity-processbot <>

* Disable default features for `strum` (#13326)

* Fix block pruning (#13323)

* Fix block pruning (#13323)

* Referendum proposal's metadata (#12568)

* referenda metadata

* todo comment

* remove TODO, update rustdocs

* referenda clear_metadata origin signed or root

* referenda metadata unit tests

* drop schema type for referenda metadata

* remove metadata type

* referenda metadata benches

* note different preimages

* metadata for democracy pallet

* metadata democracy pallet tests and benches

* fix cargo clippy

* update docs

* ".git/.scripts/bench-bot.sh" pallet dev pallet_democracy

* ".git/.scripts/bench-bot.sh" pallet dev pallet_referenda

* Update the doc frame/democracy/src/lib.rs

Co-authored-by: Roman Useinov <roman.useinov@gmail.com>

* Update the doc frame/democracy/src/lib.rs

Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

* reference instead clone for take

Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

* error rename BadMetadata to PreimageNotExist

* clear metadata within internal_cancel_referendum fn

* remove redundant clone

* collapse metadata api into one set_metadata method

* fmt

* review fixes

* not request preimage on set_metadata

* rename events and update docs

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_democracy

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_referenda

* rename reset_metadata to transfer_metadata

---------

Co-authored-by: command-bot <>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

* Improve test coverage of the `Notifications` protocol (#13033)

* Add handler and upgrade tests

* Add tests for `behaviour.rs`

* Apply review comments

* Update dependencies

* Apply suggestions from code review

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* Apply review comments

* Fix clippy

* Update mockall

* Apply review comment

---------

Co-authored-by: Dmitry Markin <dmitry@markin.tech>

* Configurable voting-degree in council elections pallet (#13305)

* configurable council elections pallet

* configurable council elections pallet

* add warning

* reduce sizes

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_elections_phragmen

* fix stuff

* make assert

* fix docs

* fix docs again

* fix docs again

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Update frame/elections-phragmen/src/lib.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* fix docs

---------

Co-authored-by: command-bot <>
Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* Rework generated API docs (#13178)

* pallet-scheduler: Ensure we request a preimage (#13340)

* pallet-scheduler: Ensure we request a preimage

The scheduler was not requesting a preimage. When a preimage is requested, a user can deposit it
without paying any fees.

* Review changes

* [Fix] Try-state feature-gated for BagsList (#13296)

* [Fix] Try-state feature-gated for BagsList

* fix comment

* fix try_state remote-tests

* feature-gate try-state remote test for bags-list

* remove try-state from a migration

* more SortedListProvider fixes

* more fixes

* more fixes to allow do_try_state usage in other crates

* do-try-state for fuzz

* more fixes

* more fixes

* remove feature-flag

* do-try-state

* fix review comments

* Update frame/bags-list/src/mock.rs

Co-authored-by: Anton <anton.kalyaev@gmail.com>

---------

Co-authored-by: parity-processbot <>
Co-authored-by: Anton <anton.kalyaev@gmail.com>

* bump version of zombienet and update snaps links (#13359)

* Fix longest chain finalization target lookup (#13289)

* Finalization target should be chosed as some ancestor of SelectChain::best_chain

* More test assertions

* Improve docs

* Removed stale docs

* Rename 'target' to 'base' in lookup method

* Fix typo

* Apply suggestions from code review

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Rename 'target_hash' to 'base_hash' in 'SelectChain::finality_target()'

* Apply suggestions from code review

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Docs improvement

* Doc fix

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* Apply more code suggestions

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>

* SetMembers configurable origin (#13159)

* SetMembers configurable origin

* root origin comment replaced

* fmt

* grandpa: don't error if best block and finality target are inconsistent (#13364)

* grandpa: don't error if best block and finality target are inconsistent

* grandpa: add test for best block override

* grandpa: make clippy happy

* grandpa: log selectchain override as debug instead of warn

* grandpa: don't error if best block and finality target are inconsistent (#13364)

* grandpa: don't error if best block and finality target are inconsistent

* grandpa: add test for best block override

* grandpa: make clippy happy

* grandpa: log selectchain override as debug instead of warn

* Improve Weight Template and API (#13355)

* improve weights template and api

* follow template

* [ci] Change label checker (#13360)

* [ci] Change label checker

* rm pr autolabel

* fix specs file name to substrate

* client/beefy: request justifs from peers further in consensus (#13343)

For on-demand justifications, peer selection is based on witnessed
gossip votes. This commit changes the condition for selecting a peer
to request justification for `block` from
"last voted on >= `block`" to "peer last voted on strict > `block`".

When allowing `>=` we see nodes continuously spamming unsuccessful
on-demand requests to nodes which are still voting on a block without
having a justification available.

One way to fix the spam would be to add some rate-limiting or backoff
period when requesting justifications.

The other solution (present in this commit) is to simply request
justifications from peers that are voting on future blocks so we know
they're _guaranteed_ to have the wanted mandatory justification
available to send back.

Signed-off-by: acatangiu <adrian@parity.io>

* [ci] Change GHA to add J2 labels instead Z0 (#13375)

* sc-client-db: Fix `PruningMode::ArchiveCanonical` (#13361)

* sc-client-db: Fix `PruningMode::ArchiveCanonical`

When running a node with `--state-pruning archive-canonical` it was directly failing on genesis.
There was an issue in the state-db `pin` implementation. It was not checking the state of a block
correctly when running with archive canonical (and also not for every other block after they are canonicalized).

* FMT

* benchmarks: EnsureRankedMember must add ranked members (#13297) (#13348)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* subkey: only decode hex if requested, CLI `0x` prefixed hex for all `stdout` (#13258)

* Only decode hex if requested

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Cleanup code

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add some tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add license

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Docs

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Clippy

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* bump version, breaking (tiny) change in output.

* Move integration tests to own folder

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Dan Shields <nukemandan@protonmail.com>

* [Feature] Introduce storage_alias for CountedStorageMap (#13366)

* [Feature] Introduce storagage_alias for CountedStorageMap

* bit more dry

* bit more dry

* address review comments

* some tests and fixes

* fix ui tests

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* compare metadata

---------

Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <git@kchr.de>

* [NFTs] Offchain mint (#13158)

* Allow to mint with the pre-signed signatures

* Another try

* WIP: test encoder

* Fix the deposits

* Refactoring + tests + benchmarks

* Add sp-core/runtime-benchmarks

* Remove sp-core from dev deps

* Enable full_crypto for benchmarks

* Typo

* Fix

* Update frame/nfts/src/mock.rs

Co-authored-by: Squirrel <gilescope@gmail.com>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_nfts

* Add docs

* Add attributes into the pre-signed object & track the deposit owner for attributes

* Update docs

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_nfts

* Add the number of attributes provided to weights

* Apply suggestions

* Remove dead code

* Remove Copy

* Fix docs

* Update frame/nfts/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update frame/nfts/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Co-authored-by: Squirrel <gilescope@gmail.com>
Co-authored-by: command-bot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* feat: improve FinalityProofProvider api (#13374)

* feat: improve prove_finality api and export it

* fmt

* fix

* improve prove_finality and kept private

* Update client/finality-grandpa/src/finality_proof.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* add `prove_finality_proof` to `FinalityProofProvider`

* fix some and impl Clone for FinalityProofProvider

* improve by suggestions

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* cleanup `<weight></weight>` from docs comments (#13350)

* cleanup <weight></weight> from docs comments

* Changes to address review commnets

* Fix CI cargo test --docs

---------

Co-authored-by: parity-processbot <>

* zombienet: is up timtout increased to 30s (#13386)

* pallet-timestamp: Remove `ValidAtTimestamp` error variant (#13346)

* pallet-timestamp: Remove `ValidAtTimestamp` error variant

The error variant wasn't that useful and it was also used wrongly in the code. In the code we
returned this variant when the `timestamp < minimum`. The problem of this is that we waited on the
node side some time, but then `set` function rejects the timestamp because of the same check (the
timestamp in the block stays the same). We ensure that the timestamp isn't drifting too much in the
future, but waiting for the timestamp to be "valid" would open some attack vector. The consensus
protocols also compare the slots in the blocks to ensure that there isn't a block from the future
and in the runtime we then ensure that `slot = timestamp / slot_duration`. So, we can just remove
this variant and replace it with a new variant `TimeBetweenBlocksTooShort` to not even try importing
a block which uses a too short delay since the last block.

* Update primitives/timestamp/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Rename to `TooEarly`

* FMT

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* add warp to target block for parachains (#12761)

* add warp to target block for parachains

* fix for failing tests

* format using  `Cargo +nightly fmt`

* Remove blocking based on PR comments and create new `WarpSync` on poll

* remove method from trait

* add tests for wait for target

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* code refactor based on pr comments

* Second round of PR comments

* Third round of pr comments

* add comments to explain logic

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* code refactor based on last PR comments

* move warp sync polling before `process_outbound_requests`

Add error message if target block fails to be retreived

* Update client/network/sync/src/warp.rs

Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>

* Update client/network/sync/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fmt after code suggestions

* rebase changes

* Bring down the node if the target block fails to return

* Revert "Bring down the node if the target block fails to return"

This reverts commit c0ecb220d66dd8e7b1a5ee29831b776f4f18d024.

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* Update client/network/common/src/sync/warp.rs

Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>

* use matching on polling to avoid calling poll more than once

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/sync/src/warp.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fix typo on comment

* update snapshot with new folder structure

* Upload snapshot

* Bump zombienet

* bump zombienet again

* Improve test

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update client/network/test/src/sync.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fix tests

* dummy commit to restart builds

* Converted the target block to an optional value that is set to `None` when an error occurs

* dummy commit to restart builds

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>

* [contracts] make `debug_message` execution outcome invariant to node debug logging setting (#13197)

* update benchmark for seal_debug_message

* add seal_debug_message_per_kb benchmark

* un-fallable debug buffer: silently drops excessive and wrong utf-8 encoded messages

* charge debug_message per byte of the message

* impr…
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B1-note_worthy Changes should be noted in the release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit T2-API This PR/Issue is related to APIs.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Migrate existing benchmarks! macro to attribute macros
7 participants