* 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>
* 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>
* 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>
* Fix incorrect use of syn::exports
Instead of using `syn::exports` we should import the trait from the
quote crate directly.
* Use own macro for test cases to fix compilation with latest syn
* Fix test
* upgrade a few dependencies
* make it compile at the expense of duplicate deps
* fix web-wasm and a warning
* introduce activate-wasm-bindgen-features crate
* Revert "introduce activate-wasm-bindgen-features crate"
This reverts commit 5a6e41e683f8a4844c0a735dcd08caabb2313f11.
* add getrandom feature to sc-consensus-aura
* babe: expose next epoch data
* babe: add runtime api for next_epoch
* babe: avoid reading next authorities from storage unnecessarily
* babe: add notes about epoch duration constraints
* babe: guard against overflow
* babe: add test for fetching current and next epoch data
* Switch back to the crates.io release of trybuild
My fix was merged on upstream and this release contains it. So, no
more reason to keep the git dependency.
* The lock file...
* Build every wasm crate in its own project with wasm-builder
Building all wasm crates in one workspace was a nice idea, however it
just introduced problems:
1. We needed to prune old members, but this didn't worked for old git
deps.
2. We locked the whole wasm workspace while building one crate. This
could lead to infinitely locking the workspace on a crash.
Now we just build every crate in its own project, this means we will
build the dependencies multiple times. While building the dependencies
multiple times, we still decrease the build time by around 30 seconds
for Polkadot and Substrate because of the new parallelism ;)
* Remove the requirement on wasm-builder-runner
This removes the requirement on wasm-builder-runner by using the new
`build_dep` feature of cargo. We use nightly anyway and that enables us
to use this feature. This solves the problem of not mixing
build/proc-macro deps with normal deps. By doing this we get rid off
this complicated project structure and can depend directly on
`wasm-builder`. This also removes all the code from wasm-builder-runner
and mentions that it is deprecated.
* Copy the `Cargo.lock` to the correct folder
* Remove wasm-builder-runner
* Update docs
* Fix deterministic check
Modified-by: Bastian Köcher <git@kchr.de>
* Try to make the ui test happy
* Switch to `SKIP_WASM_BUILD`
* Rename `SKIP_WASM_BINARY` to the correct name...
* Update utils/wasm-builder/src/builder.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Update utils/wasm-builder/src/builder.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Provide WASM overwrite functionality in LocalCallExecutor
- add a new module `wasm_overwrite.rs` in client
- scrapes given folder for runtimes
- add two new CLI Options `wasm-overwrite` and `wasm_overwrite_path`
* formatting
* Make comment clearer
remove sc-runtime-test from dev-dependencies
* comments
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Fix spaces, remove call into backend for 'heap_pages' in 'try_replace'
* Error if path is not a directory, Comments,
Doc Comment for WasmOverwrite
* make WasmOverwrite Option<>
* Change to one CLI argument for overwrites
- move getting runtime version into LocalCallExecutor
* change unwrap() to expect()
* comment
* Remove `check_overwrites`
* Encapsulate checking for overwrites in LocalCallExecutor
* move duplicate code into function
* Update client/cli/src/params/import_params.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* comma
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* cache hash in WasmBlob
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/service/src/client/client.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* move getting overwrite into its own function
* fix error when directory is not a directory
* Error on duplicate WASM runtimes
* better comment, grammar
* docs
* Revert StateBackend back to _
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/service/src/client/call_executor.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Add two tests, fix doc comments
Add a test for the runtime_version method of WasmOverwrite
Add a test for check_overwrite method of LocalCallExecutor
* remove redundant `Return` from expect msg
* Update client/cli/src/params/import_params.rs
Co-authored-by: David <dvdplm@gmail.com>
* Update client/service/src/client/call_executor.rs
Co-authored-by: David <dvdplm@gmail.com>
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: David <dvdplm@gmail.com>
* Update client/service/src/config.rs
Co-authored-by: David <dvdplm@gmail.com>
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: David <dvdplm@gmail.com>
* Add Module Documentation, match on '.wasm' extension
* Add test for scraping WASM blob
* fix expect
* remove creating another block in LocalCallExecutor test
* remove unused import
* add tests for duplicates and scraping wasm
* make tests a bit nicer
* add test for ignoring non-.wasm files
* check error message in test
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* remove println
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* make tests prettier
* Update client/service/src/client/wasm_overwrite.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* comment for seemingly random client
* locally-built -> custom
* remove unused import
* fix comment
* rename all references to overwrite with override
* fix cli flag in module documentation
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com>
* Fix logging from inside the WASM runtime
When using `RuntimeLogger` to log something from the runtime, we didn't
set any logging level. So, we actually did not log anything from the
runtime as logging is disabled by default. This pr fixes that by setting
the logging level to `TRACE`. It also adds a test to ensure this does
not break again ;)
* Update frame/support/src/debug.rs
* Fixes bug in wasm-builder with cargo publish
There was a bug in wasm-builder which resulted in generating a
`Cargo.lock` in the project directory because of running `cargo
metadata`. This resulted in commands like `cargo publish` to fail (if
there was no `Cargo.lock` before building), because it checks that the
project directory isn't modified.
* Update utils/wasm-builder/src/wasm_project.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Release new version of wasm-builder-runner
Besides the new version this merges `SKIP_WASM_BUILD` and
`BUILD_DUMMY_WASM_BINARY`, this means a file is generated with
`SKIP_WASM_BUILD` if no file existed before.
* Update utils/wasm-builder-runner/Cargo.toml
* Update utils/wasm-builder-runner/src/lib.rs
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Update versions
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
* Asyncify sign_with
* Asyncify generate/get keys
* Complete BareCryptoStore asyncification
* Cleanup
* Rebase
* Add Proxy
* Inject keystore proxy into extensions
* Implement some methods
* Await on send
* Cleanup
* Send result over the oneshot channel sender
* Process one future at a time
* Fix cargo stuff
* Asyncify sr25519_vrf_sign
* Cherry-pick and fix changes
* Introduce SyncCryptoStore
* SQUASH ME WITH THE first commit
* Implement into SyncCryptoStore
* Implement BareCryptoStore for KeystoreProxyAdapter
* authority-discovery
* AURA
* BABE
* finality-grandpa
* offchain-workers
* benchmarking-cli
* sp_io
* test-utils
* application-crypto
* Extensions and RPC
* Client Service
* bin
* Update cargo.lock
* Implement BareCryptoStore on proxy directly
* Simplify proxy setup
* Fix authority-discover
* Pass async keystore to authority-discovery
* Fix tests
* Use async keystore in authority-discovery
* Rename BareCryptoStore to CryptoStore
* WIP
* Remote mutable borrow in CryptoStore trait
* Implement Keystore with backends
* Remove Proxy implementation
* Fix service builder and keystore user-crates
* Fix tests
* Rework authority-discovery after refactoring
* futures::select!
* Fix multiple mut borrows in authority-discovery
* Merge fixes
* Require sync
* Restore Cargo.lock
* PR feedback - round 1
* Remove Keystore and use LocalKeystore directly
Also renamed KeystoreParams to KeystoreContainer
* Join
* Remove sync requirement
* Fix keystore tests
* Fix tests
* client/authority-discovery: Remove event stream dynamic dispatching
With authority-discovery moving from a poll based future to an `async`
future Rust has difficulties propagating the `Sync` trade through the
generated state machine.
Instead of using dynamic dispatching, use a trait parameter to specify
the DHT event stream.
* Make it compile
* Fix submit_transaction
* Fix block_on issue
* Use await in async context
* Fix manual seal keystore
* Fix authoring_blocks test
* fix aura authoring_blocks
* Try to fix tests for auth-discovery
* client/authority-discovery: Fix lookup_throttling test
* client/authority-discovery: Fix triggers_dht_get_query test
* Fix epoch_authorship_works
* client/authority-discovery: Remove timing assumption in unit test
* client/authority-discovery: Revert changes to termination test
* PR feedback
* Remove deadcode and mark test code
* Fix test_sync
* Use the correct keyring type
* Return when from_service stream is closed
* Convert SyncCryptoStore to a trait
* Fix line width
* Fix line width - take 2
* Remove unused import
* Fix keystore instantiation
* PR feedback
* Remove KeystoreContainer
* Revert "Remove KeystoreContainer"
This reverts commit ea4a37c7d74f9772b93d974e05e4498af6192730.
* Take a ref of keystore
* Move keystore to dev-dependencies
* Address some PR feedback
* Missed one
* Pass keystore reference - take 2
* client/finality-grandpa: Use `Arc<dyn CryptoStore>` instead of SyncXXX
Instead of using `SyncCryptoStorePtr` within `client/finality-grandpa`,
which is a type alias for `Arc<dyn SyncCryptoStore>`, use `Arc<dyn
CryptoStore>`. Benefits are:
1. No additional mental overhead of a `SyncCryptoStorePtr`.
2. Ability for new code to use the asynchronous methods of `CryptoStore`
instead of the synchronous `SyncCryptoStore` methods within
`client/finality-granpa` without the need for larger refactorings.
Note: This commit uses `Arc<dyn CryptoStore>` instead of
`CryptoStorePtr`, as I find the type signature more descriptive. This is
subjective and in no way required.
* Remove SyncCryptoStorePtr
* Remove KeystoreContainer & SyncCryptoStorePtr
* PR feedback
* *: Use CryptoStorePtr whereever possible
* *: Define SyncCryptoStore as a pure extension trait of CryptoStore
* Follow up to SyncCryptoStore extension trait
* Adjust docs for SyncCryptoStore as Ben suggested
* Cleanup unnecessary requirements
* sp-keystore
* Use async_std::task::block_on in keystore
* Fix block_on std requirement
* Update primitives/keystore/src/lib.rs
Co-authored-by: Max Inden <mail@max-inden.de>
* Fix wasm build
* Remove unused var
* Fix wasm compilation - take 2
* Revert async-std in keystore
* Fix indent
* Fix version and copyright
* Cleanup feature = "std"
* Auth Discovery: Ignore if from_service is cloed
* Max's suggestion
* Revert async-std usage for block_on
* Address PR feedback
* Fix example offchain worker build
* Address PR feedback
* Update Cargo.lock
* Move unused methods to test helper functions
* Restore accidentally deleted cargo.lock files
* Fix unused imports
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
* Rename `ModuleToIndex` to `PalletRuntimeSetup`
Besides the renaming it also adds support getting the name of a pallet
as configured in the runtime.
* Rename it to `PalletInfo`
* Remove accidentally added files
* Fix `storage::read`
It should return the length of the storage item after the given offset.
Before it returned always the length of the full storage item.
* Fix tests
* checkpoint before removing CT from change trie
* before trie backend without tx
* undo
* Started no transaction, but would need using a different root
calculation method, out of the scope of this pr, will roll back.
* Remove NoTransaction.
* partially address review.
dummy stats implementation for no_std.
* Remove ChangeTrieOverlay.
* modified function
* Remove witness_ext
* need noops changes root
* update from cumulus branch
* line break
* remove warning
* line break
* From review: renamings and stats active in no std (except time).
* include cache, exclude change trie cache with individual temporary bad looking
no_std check
* little test
* fuse imports and filter_map prepare_extrinsics_input_inner fold.
* put back ExtInner into Ext, awkward double proto for new function.
* Apply suggestions from code review
* Update primitives/state-machine/Cargo.toml
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Bump version
* update test-utils crates to be ready for publishing
* adding changelog
* Adding automaticly generated READMEs
* fixing versions
* another version mishap
* draft
* revert
* WIP
* all that remains is tests
* update Cargo.lock
* tests WIP
* WIP refactor node-template-runtime and node-runtime
* implments sc_cli::RuntimeAdapter for node_template_runtime::Runtime
* final draft
* fix update_config for subcommands
* proper AccountId decoding
* test-runtime tests
* revert
* move RuntimeAdapter to cli-utils
* use &'static str for TryFrom::<&'a str>::Error for Ss58AddressFormat
* tests
* add frame-system to sc-cli dev-dependencies
* add frame-system to sc-cli dev-dependencies
* fix ui test
* wip
* fixed inspect test
* bump impl version
* bump impl version, fixx spaces remove todos
* pallet-balances-cli, rustc for some reason cannot resolve pallet_balances_cli in node-cli 😩
* wip
* Subcommand::run takes &self
* can't believe i missed that 🤦🏾♂️
* bump wasm-bindgen for some reason
* adds key subcommand, rename generate-node-key to generate-node-id
* cargo update and crossed fingers 🤞🏽
* update ui test
* update more ui tests
* should be all good now
* revert subkey change
* revert subkey change
* adds frame-utilities-cli
* Apply suggestions from code review
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
* removes frame from sc-cli, fix license
* my editor and ci disagrees on line width
* bump spec version
* turn off default features for parity-scale-codec
* enable full_crypto feature for sp-core in cli-utils
* merge frame-utilities-cli with pallet-balances-cli
* remove full_crypto feature from sp_core in cli-utils
* bump Cargo.lock
* cli-utils -> frame-utils
* rename BlockNumber to GenericNumber, fix spaces
* fix spaces
* construct additional_signed manually
* sign test
* remove unused vars
* implement subkey with frame-utilities-cli and sc_cli
* fix moduleid test
* CI and clion disagree on line widths
* adds associated Params type to SignedExtensionProvider
* Apply suggestions from code review
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
* move some code around
* removes unneccesary generic params
* moves module_id back to frame_utilities_cli
* Apply suggestions from code review
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* remove print_ext
* remove MaybeDisplay from pallet_balances::Trait::Balance
* a lot of stuff tbh
* adds ExtrasParamsBuilder
* remove tests for ModuleIdCmd
* address comments from PR
* bump Cargo.lock
* manually insert key into keystore
* remove unnecessary SharedParams
* add validation to vanity pattern, remove unused arg
* remove SharedParams from Sign, Vanity, Verify
* remove SharedParams from ModuleIdCmd, remove expect from Verify, new line to Cargo.toml
* remove SharedParams from InsertCmd
* 🤦🏾♂️
* deleted prometheus.yml
* move a few things around
* fix vanity test
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Benjamin Kampmann <ben@parity.io>
* Revalidate transactions only on latest best block
We should revalidate transactions only on the latest best block and not
on any arbitrary block. The revalidation before failed when there were
multiple blocks on the height given to the revalidation function, but no
block was imported as best block.
* Update test-utils/runtime/transaction-pool/src/lib.rs
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
* Fix tests
* Only process best blocks in the transaction pool
Co-authored-by: Jaco Greeff <jacogr@gmail.com>
* Upgrade `kvdb-*`, `trie-db` and `memory-db`
The updates of `trie-db` and `memory-db` are important, as they fix the
non-deterministic build of Polkadot/Substrate.
* Change `trie-db` version
* Update test-utils/runtime/Cargo.toml
Co-authored-by: Andronik Ordian <write@reusable.software>
* Update primitives/trie/Cargo.toml
Co-authored-by: Andronik Ordian <write@reusable.software>
* Update `Cargo.lock` and `trie-bench`
* Fix UI tests
* Switch to fixed version of memory-db
Co-authored-by: Andronik Ordian <write@reusable.software>