Commit Graph

6890 Commits

Author SHA1 Message Date
Quentin McGaw c4e063ff02 Fix comment typo SS85 -> SS58 (#12076) 2022-08-20 19:40:43 +00:00
Shawn Tabrizi b4caec7f31 make weightinfo pub (#12074) 2022-08-19 19:08:31 +02:00
Oliver Tale-Yazdi b0ff805740 Revert "Auto-incremental CollectionId (#11796)" (#12059)
This reverts commit 658b179686.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-08-19 13:15:57 +00:00
Bastian Köcher 9d75f3e3e7 Fix benchmarks and adds CI to test them (#12068)
* Fix benchmarks and adds CI to test them

Instead of waiting for benchmarks failing in Polkadot CI, we also can just test them in Substrate :P

* Do not overflow
2022-08-19 13:07:14 +02:00
yjh 13fa566590 chore(executor): make allow_missing_host_functions could be configurable (#12015)
* make `with_instance` pub

* make `allow_missing_host_functions` could be configurable

* add method `allow_missing_host_functions`

* update usage

* update usage

* fix comments

* fix `with_instance`
2022-08-19 08:50:12 +00:00
Jake Edwards f36c3eefc0 Fix broken link to web3 foundation research (#12066) 2022-08-19 10:03:48 +02:00
Bastian Köcher 73d9ae3284 Introduce trie level cache and remove state cache (#11407)
* trie state cache

* Also cache missing access on read.

* fix comp

* bis

* fix

* use has_lru

* remove local storage cache on size 0.

* No cache.

* local cache only

* trie cache and local cache

* storage cache (with local)

* trie cache no local cache

* Add state access benchmark

* Remove warnings etc

* Add trie cache benchmark

* No extra "clone" required

* Change benchmark to use multiple blocks

* Use patches

* Integrate shitty implementation

* More stuff

* Revert "Merge branch 'master' into trie_state_cache"

This reverts commit 947cd8e6d43fced10e21b76d5b92ffa57b57c318, reversing
changes made to 29ff036463.

* Improve benchmark

* Adapt to latest changes

* Adapt to changes in trie

* Add a test that uses iterator

* Start fixing it

* Remove obsolete file

* Make it compile

* Start rewriting the trie node cache

* More work on the cache

* More docs and code etc

* Make data cache an optional

* Tests

* Remove debug stuff

* Recorder

* Some docs and a simple test for the recorder

* Compile fixes

* Make it compile

* More fixes

* More fixes

* Fix fix fix

* Make sure cache and recorder work together for basic stuff

* Test that data caching and recording works

* Test `TrieDBMut` with caching

* Try something

* Fixes, fixes, fixes

* Forward the recorder

* Make it compile

* Use recorder in more places

* Switch to new `with_optional_recorder` fn

* Refactor and cleanups

* Move `ProvingBackend` tests

* Simplify

* Move over all functionality to the essence

* Fix compilation

* Implement estimate encoded size for StorageProof

* Start using the `cache` everywhere

* Use the cache everywhere

* Fix compilation

* Fix tests

* Adds `TrieBackendBuilder` and enhances the tests

* Ensure that recorder drain checks that values are found as expected

* Switch over to `TrieBackendBuilder`

* Start fixing the problem with child tries and recording

* Fix recording of child tries

* Make it compile

* Overwrite `storage_hash` in `TrieBackend`

* Add `storage_cache` to  the benchmarks

* Fix `no_std` build

* Speed up cache lookup

* Extend the state access benchmark to also hash a runtime

* Fix build

* Fix compilation

* Rewrite value cache

* Add lru cache

* Ensure that the cache lru works

* Value cache should not be optional

* Add support for keeping the shared node cache in its bounds

* Make the cache configurable

* Check that the cache respects the bounds

* Adds a new test

* Fixes

* Docs and some renamings

* More docs

* Start using the new recorder

* Fix more code

* Take `self` argument

* Remove warnings

* Fix benchmark

* Fix accounting

* Rip off the state cache

* Start fixing fallout after removing the state cache

* Make it compile after trie changes

* Fix test

* Add some logging

* Some docs

* Some fixups and clean ups

* Fix benchmark

* Remove unneeded file

* Use git for patching

* Make CI happy

* Update primitives/trie/Cargo.toml

Co-authored-by: Koute <koute@users.noreply.github.com>

* Update primitives/state-machine/src/trie_backend.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Introduce new `AsTrieBackend` trait

* Make the LocalTrieCache not clonable

* Make it work in no_std and add docs

* Remove duplicate dependency

* Switch to ahash for better performance

* Speedup value cache merge

* Output errors on underflow

* Ensure the internal LRU map doesn't grow too much

* Use const fn to calculate the value cache element size

* Remove cache configuration

* Fix

* Clear the cache in between for more testing

* Try to come up with a failing test case

* Make the test fail

* Fix the child trie recording

* Make everything compile after the changes to trie

* Adapt to latest trie-db changes

* Fix on stable

* Update primitives/trie/src/cache.rs

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

* Fix wrong merge

* Docs

* Fix warnings

* Cargo.lock

* Bump pin-project

* Fix warnings

* Switch to released crate version

* More fixes

* Make clippy and rustdocs happy

* More clippy

* Print error when using deprecated `--state-cache-size`

* 🤦

* Fixes

* Fix storage_hash linkings

* Update client/rpc/src/dev/mod.rs

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

* Review feedback

* encode bound

* Rework the shared value cache

Instead of using a `u64` to represent the key we now use an `Arc<[u8]>`. This arc is also stored in
some extra `HashSet`. We store the key are in an extra `HashSet` to de-duplicate the keys accross
different storage roots. When the latest key usage is dropped in the lru, we also remove the key
from the `HashSet`.

* Improve of the cache by merging the old and new solution

* FMT

* Please stop coming back all the time :crying:

* Update primitives/trie/src/cache/shared_cache.rs

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

* Fixes

* Make clippy happy

* Ensure we don't deadlock

* Only use one lock to simplify the code

* Do not depend on `Hasher`

* Fix tests

* FMT

* Clippy 🤦

Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
2022-08-18 18:59:22 +00:00
Doordashcon d46f6f0d34 Replace T::AccountId with <T::Lookup as StaticLookup>::Source (#11670)
* initial

* update

* update

* update

* cargo fmt

* update

* update benchmarks

* AccountIdLookupOf<T>

* cargo fmt

* fix conflits

* cargo fmt

* update

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-08-18 09:30:46 +00:00
Alexander Theißen 511e5c9651 Make state types public (#12032) 2022-08-17 18:19:32 +00:00
Davide Galassi 61eeba81f0 Fix leaf block removal in the backend (#12005)
* Fix leaf block removal in the backend

The fix introduced the new 'removal' method for the backend leaves set
and the improvement of the undo features.

* Update docs

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Fix docs typo

* On block block removal the new children list should be persisted.

* Align leaves set removal tests to the new interface

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-08-17 17:36:18 +02:00
Aramik ba2c89e6b5 benchmark-cli: add child tree support (#12021)
* benchmark-cli: add child tree support

* removed extra comments

* addressed pr comments

* clean up

* addressed pr comments
2022-08-17 12:35:56 +00:00
Shawn Tabrizi 2fd028156e Fix Origins Used in Runtime Benchmarks (#12037)
* fix identity benchmark origin

* fix benchmarking macro

* bounties

* democracy

* scheduler

* tips and treasury

* unused

* dunno, this is causing issues
2022-08-16 10:36:34 +00:00
Oliver Tale-Yazdi a467983398 Always wipe DB state after benchmark (#12025)
* Add test

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

* Always wipe the DB state

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

* Silence Clippy

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

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-08-15 22:31:28 +00:00
Squirrel a68a80fbae declone and close the door (#12035)
* declone and close the door

* cargo fmt

* remove brackets
2022-08-15 19:38:36 +00:00
dependabot[bot] 9c2a2495fe Bump rpassword from 5.0.1 to 7.0.0 (#11826)
* Bump rpassword from 5.0.1 to 7.0.0

Bumps [rpassword](https://github.com/conradkleinespel/rpassword) from 5.0.1 to 7.0.0.
- [Release notes](https://github.com/conradkleinespel/rpassword/releases)
- [Commits](https://github.com/conradkleinespel/rpassword/compare/v5.0.1...v7.0.0)

---
updated-dependencies:
- dependency-name: rpassword
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Use new API

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: dependabot[bot] <support@github.com>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-08-15 07:57:15 +00:00
Jake Hemmerle d987d2b413 swap ed25519-dalek for ed25519-zebra (#11781)
* swap ed25519-dalek for ed25519-zebra; no batch verificaiton

fixed batch verificaiton tests

removed additional zero verificaiton tests

removed comments, fixed test bug, added #[derive(Clone)]

Update primitives/core/src/ed25519.rs

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

* modified assertion to allow default ed25519-zebra zero key behavior

* cargo clippy

* Update primitives/core/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update primitives/core/src/ed25519.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update primitives/core/src/ed25519.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update primitives/core/src/ed25519.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Update primitives/core/src/ed25519.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* updated Cargo.lock for sp-core

* fix inaccurate comment

Co-authored-by: Squirrel <gilescope@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Davide Galassi <davxy@datawok.net>
2022-08-15 09:53:39 +02:00
Kian Paimani 2d988e5f60 Proposal: Flatten AllPallets and similar types (#11813)
* flratten AllPallets types

* feature flag it

* fix

* fix

* fmt

* remove todo

* Update frame/support/src/traits/metadata.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update frame/support/src/migrations.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* fix

* mark as deprecated

* add docs

* fix ui test?

* fmt

Co-authored-by: parity-processbot <>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-08-14 19:06:02 +00:00
Shawn Tabrizi 6b0203c8c4 Further Improve Gov V2 Stuff (#12028)
* refactor and improve successful origin

* use appropriate origin for creating referendum

* fmt

* add setup tally feature for benchmarks

* feedback updates

* fmt

* Update frame/referenda/src/benchmarking.rs

Co-authored-by: Gavin Wood <gavin@parity.io>

* feedback on `setup` trait

* fix

Co-authored-by: Gavin Wood <gavin@parity.io>
2022-08-14 18:36:19 +00:00
Sudip Ghimire bc6f7bdda9 make MAX_VOTERS and MAX_CANDIDATES in elections-phragmen configurable. Fix: #11092 (#11908)
* make MAX_VOTERS and MAX_CANDIDATES in elections-phragmen configurable

* Configure election-phragmen in node bin configuring max candidates & voters

* Add document comment for added Config parameter

* Incorporate suggestion

* fix benchmarks

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

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

* fix wrong values

* fix typo

* docs

* more detailed docs

* fmt

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

Co-authored-by: Szegoo <sakacszergej@gmail.com>
Co-authored-by: Sergej Sakac <73715684+Szegoo@users.noreply.github.com>
Co-authored-by: command-bot <>
2022-08-14 18:05:06 +00:00
Shawn Tabrizi e5ed764d39 Add Benchmarking Instance to Pallets (#12026)
* benchmark instance

* add benchmark instance to conviction voting

* instance on bags list

* fmt
2022-08-13 16:07:10 +01:00
Shawn Tabrizi 2950340edc Fix Gov V2 Benchmarks (#12022)
* better benchmark log

* Update lib.rs

* fix gov2 benchmarks

* saturating math + fmt

* add comment
2022-08-13 12:05:39 +00:00
Tsvetomir Dimitrov 2bff2f84e3 Runtime API versioning (#11779)
* Runtime API versioning

Related to issue #11577

Add support for multiple versions of a Runtime API. The purpose is to
have one main version of the API, which is considered stable and
multiple unstable (aka staging) ones.

How it works
===========
Some methods of the API trait can be tagged with `#[api_version(N)]`
attribute where N is version number bigger than the main one. Let's call
them **staging methods** for brevity.

The implementor of the API decides which version to implement.

Example (from https://github.com/paritytech/substrate/issues/11577#issuecomment-1145347025):

```
decl_runtime_apis! {
    #{api_version(10)]
    trait Test {
         fn something() -> Vec<u8>;
         #[api_version(11)]
         fn new_cool_function() -> u32;
    }
}
```

```
impl_runtime_apis! {
    #[api_version(11)]
    impl Test for Runtime {
         fn something() -> Vec<u8> { vec![1, 2, 3] }

         fn new_cool_function() -> u32 {
             10
         }
    }
}
```

Version safety checks (currently not implemented)
=================================================
By default in the API trait all staging methods has got default
implementation calling `unimplemented!()`. This is a problem because if
the developer wants to implement version 11 in the example above and
forgets to add `fn new_cool_function()` in `impl_runtime_apis!` the
runtime will crash when the function is executed.

Ideally a compilation error should be generated in such cases.

TODOs
=====

Things not working well at the moment:
[ ] Version safety check
[ ] Integration tests of `primitives/api` are messed up a bit. More
specifically `primitives/api/test/tests/decl_and_impl.rs`
[ ] Integration test covering the new functionality.
[ ] Some duplicated code

* Update primitives/api/proc-macro/src/impl_runtime_apis.rs

Code review feedback and formatting

Co-authored-by: asynchronous rob <rphmeier@gmail.com>

* Code review feedback

Applying suggestions from @bkchr

* fmt

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Code review feedback

* dummy trait -> versioned trait

* Implement only versioned traits (not compiling)

* Remove native API calls (still not compiling)

* fmt

* Fix compilation

* Comments

* Remove unused code

* Remove native runtime tests

* Remove unused code

* Fix UI tests

* Code review feedback

* Code review feedback

* attribute_names -> common

* Rework `append_api_version`

* Code review feedback

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Code review feedback

* Code review feedback

* Code review feedback

* Use type alias for the default trait - doesn't compile

* Fixes

* Better error for `method_api_ver < trait_api_version`

* fmt

* Rework how we call runtime functions

* Update UI tests

* Fix warnings

* Fix doctests

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Fix formatting and small compilation errors

* Update primitives/api/proc-macro/src/impl_runtime_apis.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: asynchronous rob <rphmeier@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
2022-08-13 13:56:40 +02:00
Oliver Tale-Yazdi 8e927daa77 Add defer (#12013)
* Add defer

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

* Convert to macro + review fixes

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

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Move into new file and add panic unwind tests

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

* Fix doc and Clippy

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 <bkchr@users.noreply.github.com>
2022-08-12 17:18:27 +00:00
Niklas Adolfsson 4c280059ab feat(rpc middleware): use custom time buckets (#11950)
* feat(rpc middleware): use custom time buckets

* cargo fmt

* make it compile again

* fix bad comment
2022-08-12 15:39:05 +00:00
Shawn Tabrizi 187735908f better benchmark log (#12016)
* better benchmark log

* Update lib.rs
2022-08-12 15:34:00 +00:00
Alexander Samusev db2d66e59b [ci] Improve cancel-pipeline job (#12008)
* [WIP][ci] Improve cancel-pipeline job

* fix job name

* test that fail works

* debug cancel-pipeline

* remove artifacts-false from cancel-pipeline jobs

* split cancel pipeline jobs

* fail test-linux-stable 2/3

* fail test-linux-stable 3/3

* fail cargo-check-benches 1/2

* fail cargo-check-benches 2/2

* fail test-linux-stable-int

* fail cargo-check-subkey

* fail check-tracing

* fail check-tracing

* fix pipeline
2022-08-12 11:03:27 +02:00
benluelo 2bda6abae7 Add map and try_map methods to BoundedBTreeMap (#11869)
* Add map and try_map methods to BoundedBTreeMap

* Undo changes to basic_authorship.rs

* Remove unwrap and use unchecked_from instead

* Add iter_mut() method

* Remove map functions and add docs to iter_mut

* fmt

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2022-08-11 18:55:30 +00:00
Bastian Köcher a558442416 Use correct length for Pallet and Storage prefix when calculating KeyLenOf (#11994)
* Use correct length for Pallet and Storage prefix when calculating `KeyLenOf`

* Add tests

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: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-08-11 16:53:40 +02:00
Shawn Tabrizi a6c95cbb13 add decode with depth limit to opaque types (#11947)
Co-authored-by: parity-processbot <>
2022-08-11 14:39:56 +00:00
lucasvanmol 98252cb900 Fix broken links in polkadot --help (#12010)
https://docs.substrate.io/v3/runtime/custom-rpcs/#public-rpcs > https://docs.substrate.io/main-docs/build/custom-rpc/#public-rpcs
2022-08-11 13:13:49 +00:00
yjh 9a7ff9a3a0 chore: improve runtime docs and remove unused error (#12000) 2022-08-11 11:59:38 +02:00
Bastian Köcher aa5f68a827 transactional: Wrap pallet::calls directly in storage layers (#11927)
* transactional: Wrap `pallet::calls` directly in storage layers

Before this pr we only wrapped `pallet::calls` into storage layers when executing the calls with
`dispatch`. This pr is solving that by wrapping each call function inside a storage layer.

* Teach `BasicExternalities` transactions support

* Fix crates

* FMT

* Fix benchmarking tests

* Use correct span

* Support old decl macros

* Fix test

* Apply suggestions from code review

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

* Update frame/state-trie-migration/src/lib.rs

* Update frame/state-trie-migration/src/lib.rs

* Update frame/state-trie-migration/src/lib.rs

* Feedback

* Apply suggestions from code review

Co-authored-by: cheme <emericchevalier.pro@gmail.com>

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
2022-08-10 22:27:01 +02:00
Shawn Tabrizi 043b1697c7 Use #[pallet::unbounded] tag in FRAME System (#11946)
* use unbounded in system

* update ui tests
2022-08-10 13:58:52 +00:00
Muharem Ismailov e41b90910e Transaction payment runtime api: query call info and fee details (#11819)
* Transaction payment RPC calls: query call info

* transaction payment pallet - runtime api - add query_call info and fee_details

* remove unused deps

* separate call runtime api

* undo fmt for unchanged code

* system config call bounded to GetDispatchInfo, drop Call generic for query call info/fee

* impl GetDispatchInfo for Extrinsics within runtime test-utils

* introduced runtime api methods accept encoded Call instead of Call type

* replace Bytes by Vec, docs for for new api, drop len argument, drop GetDispatchInfo bound from system_Config::Call

* clean up toml and extra impl for dropped bound

* panic if Call can not be decoded

* revert to d43ba2f

* fmt and docs

* rustfmt
2022-08-10 10:36:16 +00:00
Oliver Tale-Yazdi 85e2092d8f Add BoundedVec::sort_by_key (#11998)
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-08-10 08:39:24 +00:00
Nazar Mokrynskyi a685582bfd Network sync refactoring (part 6) (#11940)
* Extract `NetworkKVProvider` trait in `sc-authority-discovery` and remove unnecessary dependency

* Extract `NetworkSyncForkRequest` trait in `sc-finality-grandpa`

* Relax requirements on `SyncOracle` trait, remove extra native methods from `NetworkService` that are already provided by trait impls

* Move `NetworkSigner` trait from `sc-authority-discovery` into `sc-network-common` and de-duplicate methods on `NetworkService`

* Move `NetworkKVProvider` trait from `sc-authority-discovery` into `sc-network-common` and de-duplicate methods on `NetworkService`

* Minimize `sc-authority-discovery` dependency on `sc-network`

* Move `NetworkSyncForkRequest` trait from `sc-finality-grandpa` to `sc-network-common` and de-duplicate methods in `NetworkService`

* Extract `NetworkStatusProvider` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkPeers` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkEventStream` trait and de-duplicate methods on `NetworkService`

* Move more methods from `NetworkService` into `NetworkPeers` trait

* Move `NetworkStateInfo` trait into `sc-network-common`

* Extract `NetworkNotification` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkRequest` trait and de-duplicate methods on `NetworkService`

* Remove `NetworkService::local_peer_id()`, it is already provided by `NetworkStateInfo` impl

* Extract `NetworkTransaction` trait and de-duplicate methods on `NetworkService`

* Extract `NetworkBlock` trait and de-duplicate methods on `NetworkService`

* Remove dependencies on `NetworkService` from most of the methods of `sc-service`

* Address simple review comments
2022-08-09 18:28:32 +00:00
Koute 9c56e79c43 Restore wasmtime's default stack size limit to 1MB (#11993)
* Restore `wasmtime`'s default stack size limit to 1MB

* Add extra comments

* Enforce different maximum call depth in release mode

* Split the call depth limit in two
2022-08-09 11:04:28 +00:00
Alexander Theißen d910386081 contracts: Apply depth limit when decoding (#11991) 2022-08-08 14:32:00 +00:00
yjh e945ae6365 chore: fix typos and sort trait impls (#11989) 2022-08-08 09:49:00 +00:00
Kevin Wang 266fa8516a Fix 16bit func_id (#11985) 2022-08-08 09:46:57 +00:00
Nikos Kontakis 20c49b20a7 Rename --pruning and --keep-blocks to be more similar to one another (#11934)
* rename prunning and keep-blocks flags

* Add aliases in keep-blocks and pruning for backward compatibility

* Rename in code variables from  and  to  and
2022-08-08 09:31:26 +00:00
Bastian Köcher a314484865 system_syncState: Always return highest block (#11979)
Before `highestBlock` was an optional that was omitted when it was `None`. We recently changed the
way the `highestBlock` is determined, this resulted in having this value in 99.99% of the time being
`None` when the node is syncing blocks at the tip. Now we always return a block for `highestBlock`.
If sync doesn't return us any best seen block, we return our own local best block as `highestBlock`.
This should mainly reflect the same behavior to before we changed the way the best seen block is determined.
2022-08-05 19:53:56 +02:00
Dmitry Markin a1ee0fca0b sync protocol now can have negotiated fallback name (#11982) 2022-08-05 09:48:05 +00:00
Dmitry Markin 6eda842cf0 Change on-the-wire protocol names to include genesis hash & fork id (#11938)
* Rename transactions protocol to include genesis hash

* Add protocol name generation to sc_network::utils

* Use utils functions for transactions protocol name generation

* Extract protocol name generation into public module

* Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA

* minor: add missing newline at EOF

* Change block-announces protocol name to include genesis_hash & fork_id

* Change protocol names to include genesis hash and fork id

Protocols changed:
    - sync
    - state
    - light
    - sync/warp

* Revert "Use sc_network::protocol_name::standard_protocol_name() for BEEFY and GRANDPA"

This reverts commit cd60a95a3face397e1b67f4bc95dd0f2b581bfae.

* Get rid of `protocol_name` module
2022-08-05 06:50:57 +00:00
Davide Galassi 946f6a2818 Prevent duplicated leaves in the backend (#11941)
* Prevent duplicated leaves in the backend

* Comments...

* Use highest known heaf as a shortcut for not existing header detection

* Apply code review suggestion

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-08-04 20:57:05 +00:00
Bastian Köcher 753907a184 Timestamp: set_timestamp sets DidUpdate (#11960)
* Timestamp: `set_timestamp` sets `DidUpdate`

There exists the `set_timestamp` in the Timestamp pallet for setting the current timestamp. The
problem is that it doesn't set `DidUpdate`. This results in `on_finalize` panicking. There is no
real reason why the function doesn't also set `DidUpdate`.

* Update frame/timestamp/src/lib.rs

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

* Fix Babe tests

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
2022-08-04 11:34:19 +02:00
ZhiYong b8ad45373f Beefy: use VersionedFinalityProof instead of SignedCommitment (#11962)
* beefy: use VersionedFinalityProof instead of SignedCommitment.

* Change the exposed RPC API to support versioned proofs.

Co-authored-by: Adrian Catangiu <adrian@parity.io>
2022-08-04 10:47:52 +03:00
lucasvanmol 97b2a5ee75 Update node-template's docker-compose.yml (#11802)
* Update docker-compose.yml

* Use production image

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

Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
Co-authored-by: parity-processbot <>
2022-08-04 09:16:24 +02:00
Shawn Tabrizi e7e2018203 nit improvements to pallet template (#11968) 2022-08-03 13:35:47 +02:00
Sacha Lansky df07421904 Fix docs urls (#11966)
* Fix docs urls

* Update bin/node-template/README.md

* Update frame/aura/src/lib.rs

* Run cargo +nightly fmt

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2022-08-03 13:34:33 +02:00