* Init `RuntimeLogger` automatically for each runtime api call
This pr change the runtime api in such a way to always and automatically
enable the `RuntimeLogger`. This enables the user to use `log` or
`tracing` from inside the runtime to create log messages. As logging
introduces some extra code and especially increases the size of the wasm
blob. It is advised to disable all logging completely with
`sp-api/disable-logging` when doing the wasm builds for the on-chain
wasm runtime.
Besides these changes, the pr also brings most of the logging found in
frame to the same format "runtime::*".
* Update frame/im-online/src/lib.rs
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
* Update test-utils/runtime/Cargo.toml
* Fix test
* Don't use tracing in the runtime, as we don't support it :D
* Fixes
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
* A clean new attempt
* Checkpoint to move remote.
* A lot of dependency wiring to make it feature gated.
* bad macro, bad macro.
* Undo the DB mess.
* Update frame/support/src/traits.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Apply suggestions from code review
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* unbreak the build
* Better logging and ids for migrations
* Fix doc.
* Test
* Update frame/try-runtime/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update utils/frame/try-runtime/cli/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/try-runtime/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Address most review grumbles.
* Fix build
* Add some comments
* Remove allowing one pallet at a time.
* Rework the PR
* nit
* Slightly better error handling.
* Remove files
* Update utils/frame/remote-externalities/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update frame/support/src/dispatch.rs
* Update frame/support/src/dispatch.rs
* Fix test
* Make extension trait.
* Bring back try-runtime/std
* remove bincode
* Remove warning
* Change test features
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* contracts: Update README
* contracts: Add CHANGELOG.md
* contracts: Bump version to v3.0.0 and allow publish
* Typos
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* Improve wording in the changelog
* contracts: Add reserved field to ContractInfoOf for future proofing
* also bump frame-benchmarking
* update lockfile
Co-authored-by: Andrew Jones <ascjones@gmail.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
* A clean new attempt
* Checkpoint to move remote.
* A lot of dependency wiring to make it feature gated.
* bad macro, bad macro.
* Undo the DB mess.
* Update frame/support/src/traits.rs
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* Apply suggestions from code review
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
* unbreak the build
* Update frame/try-runtime/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update utils/frame/try-runtime/cli/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Update frame/try-runtime/Cargo.toml
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Address most review grumbles.
* Fix build
* Add some comments
* Remove allowing one pallet at a time.
* More grumbles.
* relocate remote-ext
* Fix build
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Fix tracing tests (#8022)
* Fix tracing tests
The tests were not working properly.
1. Some test was setting a global subscriber, this could lead to racy
conditions with other tests.
2. A logging test called `process::exit` which is completly wrong.
* Update client/tracing/src/lib.rs
Co-authored-by: David <dvdplm@gmail.com>
* Review comments
Co-authored-by: David <dvdplm@gmail.com>
* Fix tracing spans are not being forwarded to spawned task (#8009)
* Fix tracing spans are not being forwarded to spawned task
There is a bug that tracing spans are not forwarded to spawned task. The
problem was that only the telemetry span was forwarded. The solution to
this is to use the tracing provided `in_current_span` to capture the
current active span and pass the telemetry span explictely. We will now
always enter the span when the future is polled. This is essentially the
same strategy as tracing is doing with its `Instrumented`, but now
extended for our use case with having multiple spans active.
* More tests
* Proper test for telemetry and prefix span
* WIP
* Fix test (need to create & enter the span at the same time)
* WIP
* Remove telemtry_span from sc_service config
* CLEANUP
* Update comment
* Incorrect indent
* More meaningful name
* Dedent
* Naming XD
* Attempt to make a more complete test
* lint
* Missing licenses
* Remove user data
* CLEANUP
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* CLEANUP
* Apply suggestion
* Update bin/node/cli/tests/telemetry.rs
Co-authored-by: David <dvdplm@gmail.com>
* Wrapping lines
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com>
* Convert AURA to new pallet macro
* AURA: Switch to `CurrentSlot` instead of `LastTimestamp`
This switches AURA to use `CurrentSlot` instead of `LastTimestamp`.
* Add missing file
* Update frame/aura/src/migrations.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Remove the runtime side provide inherent code
* Use correct weight
* Add TODO
* Remove the Inherent from AURA
* 🤦
* Remove unused stuff
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Decouple the session validators from im-online
* .
* Add SessionInterface trait in im-online
Add ValidatorId in im-online Trait
Make im-online compile
Make substrate binary compile
* Fix merging issue
* Make all compile
* Fix tests
* Avoid using frame dep in primitives via pallet-session-common
* Merge ValidatorSet into SessionInterface trait
Wrap a few too long lines
Add some docs
* Move pallet-sesion-common into pallet-session
* Move SessionInterface to sp-session and impl it in session pallet
Ref https://github.com/paritytech/substrate/pull/7127#discussion_r494892472
* Split put historical::FullValidatorIdentification trait
* Fix line width
* Fix staking mock
* Fix session doc test
* Simplify <T as ValidatorIdentification<AccountId>>::ValidatorId as ValidatorId<T>
* Nits
* Clean up.
* Make it compile by commenting out report_offence_im_online bench
* Tests
* Nits
* Move OneSessionHandler to sp-session
* Fix tests
* Add some docs
* .
* Fix typo
* Rename to ValidatorSet::session_index()
* Add some more docs
* .
* Remove extra empty line
* Fix line width check
.
* Apply suggestions from code review
* Cleaup Cargo.toml
* Aura has migrated to Pallet now
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
* Fix tracing spans are not being forwarded to spawned task
There is a bug that tracing spans are not forwarded to spawned task. The
problem was that only the telemetry span was forwarded. The solution to
this is to use the tracing provided `in_current_span` to capture the
current active span and pass the telemetry span explictely. We will now
always enter the span when the future is polled. This is essentially the
same strategy as tracing is doing with its `Instrumented`, but now
extended for our use case with having multiple spans active.
* More tests
* Introduce a `Slot` type
Instead of having some type definition that only was used in half of the
code or directly using `u64`, this adds a new unit type wrapper `Slot`.
This makes it especially easy for the outside api to know what type is
expected/returned.
* Change epoch duratioC
* rename all instances of slot number to slot
* Make the constructor private
Co-authored-by: André Silva <andrerfosilva@gmail.com>
* Made a start
* So the proof between authority set is phragmen one, this is crazy big,
or is there some signing of the result : that is the storage key, damn?
* ok getting from header digest seems doable.
* for testing
* get set id from storage directly (should use runtime to handler change).
* move test to init
* correct auth key
* fix iteration
* Correct proof content
* actually update block number.
* actually check last justif against its header
* justification relation to new authorities through header hash check is
needed here. This assumes the hash from header is calculated.
* Few changes
* Connected up cheme's branch
* Clean up
* Move things around a bit so that adding the grandpa warp sync request response protocol happens in the node code
* Nits
* Changes to comments
* Cheme changes
* Remove todos and test compile.
* Rename _authority_ related proof function to _warp_sync_ .
* Update client/grandpa-warp-sync/src/lib.rs
quick fix
* Put the warp sync request response protocol behind a feature flag because we dont' need it on a light client.
* Update client/grandpa-warp-sync/src/lib.rs
Quick fix
* Update Cargo.lock
* Adding test, comment on limitation related to 'delay', this could
be implemented but with a cost.
* Set between a delay override last fragment.
* Check for pending authority set change at start.
* adjust index
* custom cache is not a good idea.
* Use a simple cache instead.
* restore broken indentation
* Address crate rename
* Merge conflict badly resolved, sorry
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
* Make offchain indexing work
This fixes some bugs with offchain indexing to make it actually working ;)
* Fix tests
* Fix browser build
* Update client/db/src/offchain.rs
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
* Remove seperation between prefix and key
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
* Sync: Propagate block announcement data
This pr adds a feature to the sync protocol to propagate the data that
we received alongside a block announcement. This is done by adding a
cache that caches the last X block announcement data where X is set to
the number of `in_peers` (giving every peer the chance to send us a
different block). This will be required by parachains to ensure that
even peers who are not connected to a collator receive the data
alongside the block announcement to properly validate it and request the
block.
* Review comment
* Bring back the code and add new variant to ensure we don't insert block
announce data when something wasn't checked
* Also use out_peers
* make helper error types generics
* avoid From<io::Error> dep in runner helper logic
* slip of the pen, bump futures to 0.3.9
* more generics
* generic var spaces
Co-authored-by: Andronik Ordian <write@reusable.software>
* network-gossip: add metric for number of local messages (#7871)
* network-gossip: add metric for number of local messages
* grandpa: fix GossipEngine missing metrics registry parameter
* network-gossip: increase known messages cache size
* network-gossip: fix tests
* grandpa: remove unnecessary clone
Co-authored-by: Max Inden <mail@max-inden.de>
* network-gossip: count registered and expired messages separately
* network-gossip: add comment on known messages cache size
* network-gossip: extend comment with cache size in memory
Co-authored-by: Max Inden <mail@max-inden.de>
* Clean-up pass in network/src/protocol.rs (#7889)
* Remove statistics system
* Remove ContextData struct
* Remove next_request_id
* Some TryFrom nit-picking
* Use constants for peer sets
* contracts: Don't read the previous value when overwriting a storage item (#7879)
* Add `len` function that can return the length of a storage item efficiently
* Make use of the new len function in contracts
* Fix benchmarks
* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
* Remove unused imports
Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
* Fix clear prefix check to avoid erasing child trie roots. (#7848)
* Fix clear prefix check to avoid erasing child trie roots.
* Renaming and extend existing test with check.
* last nitpicks.
* use follow paths to std standarad components
* line width
Co-authored-by: Bernhard Schuster <bernhard@parity.io>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
Co-authored-by: cheme <emericchevalier.pro@gmail.com>
* network-gossip: add metric for number of local messages
* grandpa: fix GossipEngine missing metrics registry parameter
* network-gossip: increase known messages cache size
* network-gossip: fix tests
* grandpa: remove unnecessary clone
Co-authored-by: Max Inden <mail@max-inden.de>
* network-gossip: count registered and expired messages separately
* network-gossip: add comment on known messages cache size
* network-gossip: extend comment with cache size in memory
Co-authored-by: Max Inden <mail@max-inden.de>