Commit Graph

5361 Commits

Author SHA1 Message Date
Parth 77eba1351a add ExternalitiesExt for TestExternalities (#8877) 2021-05-21 10:21:12 +00:00
Alexander Theißen 637281556c Update README.md (#8871) 2021-05-21 10:00:25 +00:00
Guillaume Thiolliere 25625a0f0c Introduce WeakBoundedVec, StorageTryAppend, and improve BoundedVec API (#8842)
* fix bounded vec doc and unsafe

* fix btree map and set and tests

* introduce weak_bounded_vec and StorageTryAppend

* fix tests and reorganize tests

* improve doc

* add doc

* Update frame/support/src/storage/weak_bounded_vec.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* fix inner doc

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
2021-05-21 09:07:00 +00:00
Andreas Doerr a183031eef Fix doc for CryptoStore::ecdsa_sign_prehashed() (#8876)
* fix ecdsa_sign_prehashed() doc

* document both instances
2021-05-21 09:52:20 +02:00
ferrell-code 39a7decd1c Pallet-Multisig to framev2 (#8741)
* the great migration

* benchmarks to work

* unnecessary T: Config

* Update frame/multisig/src/lib.rs

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

* Update frame/multisig/src/lib.rs

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

* Update frame/multisig/src/lib.rs

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

* Update frame/multisig/src/lib.rs

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

* Update frame/multisig/src/lib.rs

* line width

* get to compile

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-05-21 06:40:19 +00:00
Alexander Theißen 06d87ba464 The code generated by the interface macro did compare to the wrong module (#8872) 2021-05-20 20:42:44 +00:00
Keith Yeung e5954cf863 Make hooks and call attributes optional in pallet macro (#8853)
* Make #[pallet::hooks] optional

* Make #[pallet::call] optional

* Remove unused imports

* Update UI test expectations

* Update UI test expectations

* Remove unnecessary HooksDef::empty method

* Remove unnecessary CallDef::empty method

* Clarify what would happen when no call or hooks are specified in a pallet
2021-05-20 19:31:56 +00:00
arshamparity 029b8a1d07 add trigger for monitoring job in cloud-infra repository (#8831)
* add trigger for monitoring job in cloud-infra repository

* remove substrate-alerting-rules.env file for artifact:reports:dotenv

* add allow failure to trigger-cloud-infra-monitoring job

* remove strategy=depend from the trigger pipeline

Co-authored-by: Arsham <arsham@parity.io>
2021-05-20 16:27:16 +03:00
Alexander Theißen 0057c0b53f contracts: Add seal_rent_status (#8780)
* Move public functions up in rent.rs

* Added RentStatus

* Fix test name for consistency

Co-authored-by: Michael Müller <michi@parity.io>

* Mark rent functions as unstable

* Add unstable interfaces to README

* Fix doc typos

Co-authored-by: Andrew Jones <ascjones@gmail.com>

* Use DefaultNoBound

* Simplify calc_share(1)

* Don't output empty debug messages

* Make `seal_debug_message` unstable

Co-authored-by: Michael Müller <michi@parity.io>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
2021-05-20 12:01:43 +00:00
Xiliang Chen f29a6fdad3 Update decimals & website for Karura (#8863) 2021-05-20 10:11:07 +00:00
Pierre Krieger ff60db4c41 Update the Grafana dashboards (#8832)
* Update the Grafana dashboards

* Remove the panels on top
2021-05-20 08:34:52 +00:00
Guillaume Thiolliere 693529df63 Fix transaction payment fee/tip unbalanceds (#8860)
* fix and test

* fmt
2021-05-19 18:44:50 +02:00
Guillaume Thiolliere c48b460b2e Improve pallet macro error message by deriving codec with no bound for Call enum (#8851)
* improve span for call

* fix stderr file paths
2021-05-19 09:23:06 +00:00
Bastian Köcher ee726ed55d Improve impl_opaque_keys! (#8856)
The macro should assume less about the scope where it is being used in.
In this case it is about not assuming that the crate where the macro is
called in provides a `std` feature.
2021-05-19 08:37:42 +00:00
Bastian Köcher 6a6f330412 Make wasmtime the default when the feature is enabled (#8855)
* Make wasmtime the default when the feature is enabled

* Update client/cli/src/arg_enums.rs

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

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-05-19 08:29:32 +00:00
Guillaume Thiolliere 0b30049417 Allow to name the generic for storages in #[pallet::storage] (#8751)
* implement named generic for storages

* fix error message on unexpected name for generic
2021-05-19 07:11:11 +00:00
Andreas Doerr ed39290f91 Add CryptoStore::ecdsa_sign_prehashed() (#8838)
* Pair::sign_prehashed()

* add CryptoStore::ecdsa_sign_prehashed()

* add test for testing keystore

* address review comments
2021-05-18 16:07:45 +02:00
Kian Paimani b5f23bfd1c Ensure election offchain workers don't overlap (#8828)
* Initial version, well tested, should work fine.

* Add one last log line

* Update frame/election-provider-multi-phase/src/unsigned.rs

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

* Update frame/election-provider-multi-phase/src/unsigned.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Update frame/election-provider-multi-phase/src/unsigned.rs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>

* Fix a few more things

* fix build

* rewrite the whole thing with a proper lock

* clean

* clean some nits

* Add unit tests.

* Update primitives/runtime/src/offchain/storage_lock.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* Apply suggestions from code review

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

* Fix test

* Fix tests

Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-05-18 12:22:06 +00:00
Sergei Shulepov bee5c2dd71 Emit wasm sections only when compiling to wasm (#8845) 2021-05-18 12:06:35 +00:00
stanly-johnson 2b8be8cf1e Migrate pallet-scheduler to pallet attribute macro (#8769)
* migrate to pallet!

* fixes

* fix genesis

* code review fixes

* Update frame/scheduler/src/lib.rs

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

* Update frame/scheduler/src/lib.rs

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

* Update frame/scheduler/src/lib.rs

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

* Update frame/scheduler/src/lib.rs

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

* Update frame/scheduler/src/lib.rs

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

* fix metadata

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
2021-05-18 08:52:17 +00:00
Andreas Doerr a68ed7c3d8 [clippy] Fix clippy issues for crate sp-core (#8809)
* Fix clippy issues for crate sp-core

* Update primitives/core/benches/bench.rs

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

* Update primitives/core/src/ed25519.rs

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

* Remove clippy attributes

* Missed a clippy attribute

* remove clippy attributes for bechmarks as well

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-05-18 09:38:56 +02:00
KingFishDev 72a2ad4f4f fix: add Debug to token traits (#8830) 2021-05-17 17:55:19 +00:00
Guillaume Thiolliere 9bf62ef65d Allow to specify some max number of values for storages in pallet macro. (#8735)
* implement max_values + storages info

* some formatting + doc

* rename StoragesInfo -> PalletStorageInfo

* merge both StorageInfoTrait and PalletStorageInfo

I think it is more future proof. In the future some storage could make
use of multiple prefix. Like one to store how much value has been
inserted, etc...

* Update frame/support/procedural/src/storage/parse.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* Update frame/support/procedural/src/storage/storage_struct.rs

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>

* Fix max_size using hasher information

hasher now expose `max_len` which allows to computes their maximum len.
For hasher without concatenation, it is the size of the hash part,
for hasher with concatenation, it is the size of the hash part + max
encoded len of the key.

* fix tests

* fix ui tests

Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
2021-05-17 13:44:24 +00:00
Frederik Schulz 59f34ab8bc Extends ChildStateBackend and ChildStateAPI with ReadProofs (#8812)
* Extends ChildStateBackend and ChildStateAPI with ReadProofs

The following changes integrate the existing `read_child_proof`
from the `ProofProvider` into the ChildStateBackend, so that a
read proof can be generated from a full client via an rpc call.

* Cleanup formatting
2021-05-17 09:59:10 +00:00
Keith Yeung fcf83c0278 Use StorageNMap for Approvals in assets pallet (#8816)
* Use StorageNMap for Approvals in assets pallet

* Use EncodeLike on HashKeyPrefix trait bounds

* Add comments clarifying AccountId roles

* Properly document the keys in the Approvals storage

* Fix line width
2021-05-17 06:27:06 +00:00
Ayush Mishra c28ab1fcac Improve match statement (#8817) 2021-05-15 21:43:58 +02:00
Pierre Krieger eaccde2ddc Add names to offchain worker threads (#8820)
* Add names to offchain worker threads

* Compilation
2021-05-15 12:21:16 +00:00
Andronik Ordian 22c60a63d6 frame/session/benchmarking: fix invalid feature declaration (#8818) 2021-05-15 14:08:52 +02:00
Pierre Krieger d849110c6b Small improvement to network log line (#8811)
* Small improvement to network log line

* Use {:?} for the set_id
2021-05-14 14:31:03 +00:00
Pierre Krieger 3b1b339b80 Add more debug_assert to networking (#8807)
* Add more debug_assertsudo dnf update to networking

* Swap the lines
2021-05-14 14:17:10 +00:00
Keith Yeung 033d8289f0 Implement StorageNMap (#8635)
* Implement StorageNMap

* Change copyright date to 2021

* Rewrite keys to use impl_for_tuples instead of recursion

* Implement prefix iteration on StorageNMap

* Implement EncodeLike for key arguments

* Rename KeyGenerator::Arg to KeyGenerator::KArg

* Support StorageNMap in decl_storage and #[pallet::storage] macros

* Use StorageNMap in assets pallet

* Support migrate_keys in StorageNMap

* Reduce line characters on select files

* Refactor crate imports in decl_storage macros

* Some more line char reductions and doc comment update

* Update UI test expectations

* Revert whitespace changes to untouched files

* Generate Key struct instead of a 1-tuple when only 1 pair of key and hasher is provided

* Revert formatting changes to unrelated files

* Introduce KeyGeneratorInner

* Add tests for StorageNMap in FRAMEv2 pallet macro

* Small fixes to unit tests for StorageNMap

* Bump runtime metadata version

* Remove unused import

* Update tests to use runtime metadata v13

* Introduce and use EncodeLikeTuple as a trait bound for KArg

* Add some rustdocs

* Revert usage of StorageNMap in assets pallet

* Make use of ext::PunctuatedTrailing

* Add rustdoc for final_hash

* Fix StorageNMap proc macro expansions for single key cases

* Create associated const in KeyGenerator for hasher metadata

* Refactor code according to comments from Basti

* Add module docs for generator/nmap.rs

* Re-export storage::Key as NMapKey in pallet prelude

* Seal the EncodeLikeTuple trait

* Extract sealing code out of key.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2021-05-14 09:44:29 +00:00
Roman Proskuryakov c6b1240e51 Fix warning: trait objects without an explicit dyn are deprecated (#8798) 2021-05-13 22:16:32 +02:00
Alexander Theißen 1ac95b6ba6 contracts: Move Schedule from Storage to Config (#8773)
* Move `Schedule` from Storage to Config

* Updated CHANGELOG

* Fix nits from review

* Fix migration

* Print the debug buffer as tracing message

* Use `debug` instead of `trace` and update README

* Add additional assert to test

* Rename `schedule_version` to `instruction_weights_version`

* Fixed typo

* Added more comments to wat fixtures

* Add clarification for the `debug_message` field
2021-05-13 19:56:11 +00:00
Arkadiy Paronyan 3c0270fe57 Maintain fork_targets (#8791)
* Maintain fork_targets

* Added a test
2021-05-13 13:53:30 +00:00
stanly-johnson d48243344c Migrate pallet-offences to pallet attribute macro (#8763)
* update to pallet macro

* fixes

* fix tests

* remove unwanted generic

* fix conflict

* Fix storage and tabs

Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
2021-05-12 16:38:46 +00:00
Andrew Jones 8e2b7b7c25 Remove grandpa StoredPendingChange shim (#8788)
* Remove grandpa StoredPendingChange shim

* Unused import
2021-05-12 16:35:33 +00:00
Sergei Shulepov 0849bcce0e Embed runtime version as a custom section (#8688)
* emit a custom section from impl_runtime_apis!

This change emits a custom section from the impl_runtime_apis! proc macro.

Each implemented API will result to emitting a link section `runtime_apis`.
During linking all sections with this name will be concatenated and
placed into the final wasm binary under the same name.

* Introduce `runtime_version` proc macro

This macro takes an existing `RuntimeVersion` const declaration, parses
it and emits the version information in form of a linking section.
Ultimately such a linking section will result into a custom wasm
section.

* Parse custom wasm section for runtime version

* Apply suggestions from code review

Co-authored-by: David <dvdplm@gmail.com>

* Fix sc-executor integration tests

* Nits

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

* Refactor apis section deserialization

* Fix version decoding

* Reuse uncompressed value for CallInWasm

* Log on decompression error

* Simplify if

* Reexport proc-macro from sp_version

* Merge ReadRuntimeVersionExt

* Export `read_embedded_version`

* Fix test

* Simplify searching for custom section

Co-authored-by: David <dvdplm@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2021-05-12 13:39:08 +00:00
Shaun Wang 4f7c1df31e Migrate pallet-recovery to pallet attribute macro (#8761)
* Migrate pallet-recovery to pallet attribute macro.

* Fix metadata inconsistency.

* Use DispatchResult as call returns.

* Apply review suggestions.
2021-05-12 12:50:22 +00:00
Nikolay Volf 31c5ddc1ce update environmental (#8789) 2021-05-12 14:48:01 +02:00
Shaun Wang 6e11dd18fb Migrate pallet-lottery to pallet attribute macro (#8762)
* Migrate pallet-lottery to pallet attribute macro.

* Fix metadata inconsistency.

* fix

* Use DispatchResult in call returns.
2021-05-12 12:44:19 +00:00
Shaun Wang ad584733e9 frame system: add event util functions for tests. (#8734)
* frame system: add event util functions for tests.

* URemove unused fn.

* Apply review suggestions.
2021-05-12 12:17:03 +00:00
Dan Shields d89a01cd96 revert changes: InspectKeyCmd back to InspectCmd where appropriate (#8787) 2021-05-12 07:47:10 +02:00
Wei Tang a5b2e7786e pow: fix docs on mining worker (#8759)
* pow: fix docs on mining worker

* typo: miner -> mining

* Switch to proper Rust intra-doc link
2021-05-11 11:25:50 +00:00
Pierre Krieger d443a0b929 Don't remove addresses from known_external_addresses (#8778)
* Don't remove addresses from known_external_addresses

* Remove `remove`
2021-05-11 10:34:35 +00:00
Sergei Shulepov 6f9bc19972 Make Allocator trait pub (#8777)
We need this in order to be able to assemble more fine grained host
function sets.

E.g. we don't want to use `SubstrateHostFunctions` for PVF. We would
better whitelist certain host functions. However, we cannot do that
because we cannot refer to the `Allocator` runtime interface.

I have not been able to find the reason why it wasn't made `pub` in the
first place, but do not see any reason why not to.
2021-05-10 17:42:55 +00:00
Shaun Wang 9ae9267e9a Update pallet macro migrations. (#8766)
* Update pallet macro migrations.

* Revert dispatchable call visibility changes.

* fmt
2021-05-10 15:55:25 +02:00
Pierre Krieger f16f8def08 Increase the number of external IPs in cache (#8771) 2021-05-10 10:18:21 +00:00
Shaun Wang 2a38b23062 Add arithmetic dispatch errors. (#8726)
* Add arithmetic dispatch errors.

* Replace custom overflow errors.

* Replace custom underflow and division by zero errors.

* Replace overflow/underflow in token error.

* Add token and arithmetic errors in dispatch error equality test.

* Trigger CI.
2021-05-10 10:14:02 +02:00
Peter Goodspeed-Niklaus 655ebc95fb Add BoundedBTreeSet (#8750)
* Add `BoundedBTreeSet`

Part of https://github.com/paritytech/substrate/issues/8719

* fix copy-pasta errors

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

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2021-05-10 07:49:45 +00:00
Pierre Krieger efe2267ec7 Two bugfixes to authority-discovery (#8768) 2021-05-09 21:37:41 +02:00