Commit Graph

262 Commits

Author SHA1 Message Date
Marcio Diaz fa27c8145d Add trait to get module and call names. (#4854)
* Add trait to get module and call names.


Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-02-10 14:27:40 +01:00
Gavin Wood 78a8d9f3b6 Fix vesting logic (#4864)
* Fix vesting logic

* Bump runtime version

* Docs.
2020-02-10 10:30:42 +01:00
Shawn Tabrizi e5a7fcc8ea Create Benchmarking Setup for Identity Pallet #4695 (#4818)
* Starting

* closer

* Compiles!

* comments

* Create seperate mock

* Remove changes to test env

* Fix step calculation

* Add host function

* Add runtime api

* compiles

* Update to use offchain timestamp

* Gives a result

* added some CLI wip

* make generic

* Update instance

* Remove CLI stuff

* Remove last cli stuff

* undo more changes

* Update benchmarks

* Update Cargo.lock

* remove test

* Move loop out of runtime

* Benchmarking externalities

* Benchmarking state

* Implemented commit

* Make CLI work, move loop back into runtime

* Wipe resets to genesis

* Speedup benchmarks

* Use enum to select extrinsic within pallet

* CLI controls which module and extrinsic to call

* Select a pallet with cli

* Add steps and repeats to cli

* Output as CSV format

* Introduce benchmark pallet

* Append bench

* Use Results

* fix merge

* Clear Identity benchmark

* Bench request judgment and cancel request

* Add final benchmarks

* Fix CSV output

* Start cleaning up for PR

* Bump numbers in `wasmtime` integration tests.

* More docs

* Add rockdb feature to bench

* Fix formatting issues

* Add test feature to bench

* Add test feature to bench

* Add rocksdb feature flag

* Update bench.rs

Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
2020-02-10 10:23:08 +01:00
h4x3rotab 62b60c32de Wrap runtime_print! macro in its own scope (#4867)
* Wrap runtime_print! macro in its own scope

Before this fix runtime_print! can be used only once in a scope
because of the name pollution.

* Bump runtime impl versioin (no logic change)
2020-02-09 20:11:53 +01:00
Alexander Popiak cb567d6b8b Rename StorageMap::exists to ::contains_key (Resolves #4839) (#4847)
* rename StorageMap::exists(key) to ::contains_key(key)

* bump impl_version
2020-02-08 20:31:35 +01:00
Wei Tang 4df27e760e Refactor epoch changes to a separate crate (#4785)
* Init epoch changes module

* Initial integration of new epoch changes module for BABE

* Fix all initial compile errors

* rename: digest -> digests

* Fix babe tests

* Bump impl_version

* Fix more test issues

* Remove test flag for tree

It unfortunately won't work for multiple crates.

* Update cargo lock

* Fix duplicate parking_lot version

* Add missing license header
2020-02-06 16:48:38 +01:00
André Silva db4c8c03bb node: disable grandpa automatic finality fallback (#4835)
* node: disable grandpa automatic finality fallback

* node: bump spec_version
2020-02-06 00:10:35 +01:00
Wei Tang 710ffebcca pallet-evm: log created address (#4821)
* pallet-evm: log created address

* Bump spec_version

* Only emit Created event when ExitReason is Succeed
2020-02-04 16:58:23 +01:00
Gavin Wood 1c9418d748 Don't attempt to upgrade balances module on chain start (#4802)
* Introduce vesting to node, debug message for upgrades and fix them

* Bump spec version
2020-02-01 18:08:39 +00:00
Gavin Wood d52d8692f9 Refactor the balances module (#4649)
* Initially scoping out of the problem

* Remove need for exiry in balance locks.

* Remove expiry from locks.

* Remove supefluous balance test

* Amalgamate pieces of balance module

* Split out vesting

* Fix tests

* Fixes for vesting.

* Docs.

* Weight docs.

* Refactor things in terms of set_balances.

* Switch out ED to be free + reserved.

* Remove on_free_balance_zero and some docs.

* Build fixes

* Update frame/vesting/src/lib.rs

Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com>

* Update frame/vesting/src/lib.rs

Co-Authored-By: Xiliang Chen <xlchen1291@gmail.com>

* Migration

* Remove superfluous code.

* Test fixes

* Fix some tests

* Fix repatriate reserve

* Fixes

* Add test for migration

* Final cleanups

* Fix

* Indentation.

* Undo unneeded referencing

* Bump runtime version

* Fixes

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
2020-02-01 13:20:16 +00:00
Tomasz Drwięga 2f9315cc02 Refactor im-online and print more debug info. (#4771)
* Initial version.

* Fix tests.

* Refactor using StorageValueRef.

* Add tests and apply review suggestions.

* Bump runtime.

Co-authored-by: Gavin Wood <github@gavwood.com>
2020-01-31 18:59:49 +00:00
Sergei Pepyakin df6ef1780f pallet-contracts: Rent projection RPC (#4754)
* Initial approach

* Introduce the pallet-contracts-common crate

* Add rent::compute_rent_projection

* Wire everything together

* Fix build error.

* Rename EvictionDate → EvictionAt.

* Clean.

* Renaming and cleaning.

* Add documentation for rent_projection RPC.

* Add documentation for rent_projection runtime API.

* Refactor rent_budget.

Merge it with subsistence_treshold.

* Bump impl_version

* Constrain RPC impl with Block::Header::Number.

* Rename pallet-contracts-common into -primitives

* Add a comment for `compute_rent_projection` on the usage

* Small tidying
2020-01-31 15:22:25 +01:00
Bastian Köcher 45938d8033 Expose information about the extrinsic in the metadata (#4774)
* Expose information about the extrinsic in the metadata

This pr exposes some information about the extrinsic used in the runtime
via metadata. The following information are exposed:

- Version of the extrinsic
- List of all signed extensions used by the extrinsic.

* Increment `spec_version`
2020-01-30 16:41:03 +01:00
Gavin Wood 907fd8c2fa Identity should bound additional fields (#4770)
* Identity should bound additional fields

* ump rutnime
2020-01-29 18:41:51 +01:00
Bastian Köcher 4c36143375 Add get_global for Sandbox (#4756)
* Add `get_global` for `Sandbox`

This pr adds `get_global` to retrieve a `global` variable from an
instantiated sandbox wasm blob.

* Bump `spec_version`

* Update primitives/wasm-interface/src/lib.rs

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

* `get_global` -> `get_global_val`

Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
2020-01-29 16:24:40 +01:00
Gavin Wood 5c1c31ccd4 Revamp some of the weights (#4759)
* Remove free transaction dos vectors.

* Bump spec version

* Indentation.

* Update frame/support/src/weights.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-01-29 13:38:46 +01:00
Hoani Bryson d38e96f2e1 Remove unnecessary duplication in generic asset create (#4744)
* Remove unneccessary duplication in generic asset create

* Increment impl_version due to refactoring generic_asset
2020-01-28 23:30:25 +01:00
philipstanislaus 4c63766e41 Add SS58 network identifier for Centrifuge (#4748)
* Add SS58 network identifier for Centrifuge

* Bump version
2020-01-28 20:30:39 +01:00
Bastian Köcher c37e9817ef Print extrinsic failed error always, not just on import (#4747)
* Print extrinsic failed error always, not just on import

Before we printed the error of a transaction only when importing a
block, this pr changes it to print the error also at building the block.

* Increment `impl_version`
2020-01-28 19:33:23 +01:00
Sergei Pepyakin f39335d638 pallet-contracts: Refactor and comment rent module. (#4733)
* Refactor and comment `rent` module.

* impl_version bump

* Add doc for Exempt

* Simplify code.

* Update bin/node/runtime/src/lib.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update frame/contracts/src/exec.rs

Co-Authored-By: Hero Bird <robin.freyler@gmail.com>

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: Hero Bird <robbepop@web.de>
2020-01-27 17:40:57 +01:00
Bastian Köcher fc99887de0 Introduces author_hasKey and author_hasSessionKeys rpc endpoints (#4720)
* Introduces `author_hasKey` and `author_hasSessionKeys` rpc endpoints

Both endpoints can be used to check if a key is present in the keystore.

- `hasKey` works on with an individual public key and key type. It
checks if a private key for the given combination exists in the
keystore.
- `hasSessionKeys` works with the full encoded session key blob stored
on-chain in `nextKeys`. This requires that the given blob can be decoded
by the runtime. It will return `true`, iff all public keys of the
session key exist in the storage.

Fixes: https://github.com/paritytech/substrate/issues/4696

* Update client/rpc-api/src/author/error.rs

Co-Authored-By: Nikolay Volf <nikvolf@gmail.com>

* Indentation

Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
2020-01-24 15:20:45 +01:00
Hero Bird ad9c75e4c4 [contracts] minor follow-up on PR #4722 (#4723) 2020-01-23 16:59:00 +01:00
thiolliere 164dec95e5 Pallet session new API (#4609)
* Initial work

* Fix most things

* fix test

* fix old comment

* migration

* fix

* remove useless stuff

* fix

* less spaghetti implementation

* fix initial session

* fix
2020-01-20 17:26:53 +01:00
Shawn Tabrizi d5ecec3775 Patch practical usability issues with Society (#4651)
* Add `max_members` to `found`, add society genesis for Substrate node

* Update test

* Use `Option<bool>` rather than `Option<()>`

* Update from feedback
2020-01-17 15:43:09 +01:00
Bastian Köcher c5c73abc05 Add pallet-society and pallet-recovery to substrate node (#4622)
* Add `pallet-society` and `pallet-recovery` to substrate node

* Add `OnReapAccount`

* Fixes and replaces nicks with identity
2020-01-14 20:11:42 +01:00
Xiliang Chen 507909c3be Improve PaysFee trait and dispatch info logic in utility module (#4606)
* pass target to PaysFee trait and allow batch call to be free if all its calls are free

* bump version

* fix error
2020-01-13 08:48:34 +01:00
Kian Paimani 90f85a52b1 Fix runners-up candidacy submission check in council (#4592)
* fix is_runner()

* add a test

* Bump
2020-01-10 15:26:12 +01:00
Bastian Köcher fd6b29dd2c Remove requirement on Hash = H256, make Proposer return StorageChanges and Proof (#3860)
* Extend `Proposer` to optionally generate a proof of the proposal

* Something

* Refactor sr-api to not depend on client anymore

* Fix benches

* Apply suggestions from code review

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Apply suggestions from code review

* Introduce new `into_storage_changes` function

* Switch to runtime api for `execute_block` and don't require `H256`
anywhere in the code

* Put the `StorageChanges` into the `Proposal`

* Move the runtime api error to its own trait

* Adds `StorageTransactionCache` to the runtime api

This requires that we add `type NodeBlock = ` to the
`impl_runtime_apis!` macro to work around some bugs in rustc :(

* Remove `type NodeBlock` and switch to a "better" hack

* Start using the transaction cache from the runtime api

* Make it compile

* Move `InMemory` to its own file

* Make all tests work again

* Return block, storage_changes and proof from Blockbuilder::bake()

* Make sure that we use/set `storage_changes` when possible

* Add test

* Fix deadlock

* Remove accidentally added folders

* Introduce `RecordProof` as argument type to be more explicit

* Update client/src/client.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

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

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Integrates review feedback

* Remove `unsafe` usage

* Update client/block-builder/src/lib.rs

Co-Authored-By: Benjamin Kampmann <ben@gnunicorn.org>

* Update client/src/call_executor.rs

* Bump versions

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
2020-01-10 10:48:32 +01:00
Tomasz Drwięga 74d6e660c6 Add documentation to SubmitSignedTransaction and actually make it work (#4200)
* Add documentation to signed transactions and actually make them work.

* Fix naming and bounds.

* Forgotten import.

* Remove warning.

* Make accounts optional, fix logic.

* Split the method to avoid confusing type error message.

* Move executor tests to integration.

* Add submit transactions tests.

* Make `submit_transaction` tests compile

* Remove a file that was accidently committed

* Add can_sign helper function.

* Fix compilation.

* Add a key to keystore.

* Fix the tests.

* Remove env_logger.

* Fix sending multiple transactions.

* Remove commented code.

* Bring back criterion.

* Remove stray debug log.

* Apply suggestions from code review

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

* Make sure to initialize block correctly.

* Initialize block for offchain workers.

* Add test for transaction validity.

* Fix tests.

* Review suggestions.

* Remove redundant comment.

* Make sure to use correct block number of authoring.

* Change the runtime API.

* Support both versions.

* Bump spec version, fix RPC test.

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-01-10 01:46:55 +01:00
Shawn Tabrizi a1e0076aa8 Introduce OnReapAccount (#4585)
* Initial run and gun at `OnReapAccount`

* Fix some imports

* More fixes

* Whitespace

* More wack-a-mole

* Gotta catch em all

* Update lib.rs

* Small doc update

* Whitespace
2020-01-10 01:46:23 +01:00
Gavin Wood 67202b7ec3 Add tipping into treasury (#4480)
* First draft

* Initial work on tests

* Add tests.

* Ensure old members can't tip.

* Fix complexity

* Update node runtime

* Build fix.

* build fix

* Fix tests

* Fix tests

* Refactor Contains impl for tests

* Introduce new way to avoid impl Contains conflicts

* Fixes

* Docs.

* Docs.

* Typo

* Whitespace

* Docs

* Typo

* Formatting

* Update frame/treasury/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/treasury/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/treasury/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Apply suggestions from code review

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Add provisional weights.

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2020-01-09 14:39:12 +01:00
Marcio Diaz 6100fb14e6 Introduce rebond (#4374)
* Implement rebond: allowing to re-bond stake unbonded.
2020-01-09 11:33:27 +01:00
Arkadiy Paronyan 897445f32a Bumped runtime version (#4568) 2020-01-08 12:12:11 +01:00
Shawn Tabrizi 7efa62725e Update copyright year (#4532) 2020-01-05 14:05:44 +01:00
Tomasz Drwięga 5986869390 Fix period of offchain transactions. (#4521)
* Fix period of offchain transactions.

* Calculate period dynamically.

* Convert to u64.
2020-01-03 20:39:46 +00:00
Bastian Köcher 4a9697db94 Check for invalid modules when registering a pallet in construct_runtime (#4520) 2020-01-02 20:10:20 +01:00
Xiliang Chen 901dff5d14 use generated ModuleToIndex type (#4495) 2019-12-24 16:16:19 +01:00
Gavin Wood 3c70800eab Extend Utility pallet with multisig and pseudonyms (#4462)
* Add subaccounts functionality

* More work

* Multisig prototyped with tests

* Add timepoints to prevent replay

* Remove TODO

* Check for the right owner in cancel.

* Test the timepoint stuff

* Batch works with any origin

* Refactor tuples into structs.

* Finalise function docs/complexity and also add proper weights.

* Fix wasm

* Module-level docs

* Fix typo

* Runtime fix

* Better deposit system; more tests.

* Fix typo

* Switch +1 for -1

* Add Blake2_128Concat; fix insecurity; change return policy.

* Fix typo

* Update frame/utility/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/utility/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update bin/node/runtime/src/lib.rs

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>
2019-12-22 20:41:55 +01:00
Bastian Köcher 8e393aa5a8 Make decl_error! errors usable (#4449)
* Make `decl_error!` errors usable

This pr implements support for returning errors of different pallets in
a pallet. These errors need to be declared with `decl_error!`.

The pr changes the following:

- Each dispatchable function now returns a `DispatchResult` which is an
alias for `Result<(), DispatchError>`.
- `DispatchError` is an enum that has 4 variants:
  - `Other`: For storing string error messages
  - `CannotLookup`: Variant that is returned when something returns a
  `sp_runtime::LookupError`
  - `BadOrigin`: Variant that is returned for any kind of bad origin
  - `Module`: The error of a specific module. Contains the `index`,
  `error` and the `message`. The index is the index of the module in
  `construct_runtime!`. `error` is the index of the error in the error
  enum declared by `decl_error!`. `message` is the message to the error
  variant (this will not be encoded).
- `construct_runtime!` now creates a new struct `ModuleToIndex`. This
struct implements the trait `ModuleToIndex`.
- `frame_system::Trait` has a new associated type: `ModuleToIndex` that
expects the `ModuleToIndex` generated by `construct_runtime!`.
- All error strings returned in any module are being converted now to `DispatchError`.
- `BadOrigin` is the default error returned by any type that implements `EnsureOrigin`.

* Fix frame system benchmarks
2019-12-19 14:01:52 +01:00
Bastian Köcher e19f5adfb7 Fix frame_system renaming in contruct_runtime (#4412)
* Fix contruct_runtime

* Update lib.rs

* Update event.rs

* Update event.rs

* Update event.rs

* Update event.rs

* Update event.rs

* Update event.rs

* Update event.rs

Back to where we started

* Update chain_spec.rs

* Update genesis.rs

* Fix it properly
2019-12-17 10:54:50 +01:00
Gavin Wood 48860a768b Fix naming of utility crate (it's a legit pallet) (#4408)
* Fix naming of utility crate (it's a legit pallet)

* Additional bits
2019-12-17 14:25:52 +08:00
Tomasz Drwięga 8778ca7dc8 [big refactor] Remove crate aliasing. (#4395)
* Rename: Phase 1.

* Unify codec.

* Fixing: Phase 2

* Fixing: Phase 3.

* Fixing: Phase 4.

* Fixing: Phase 5.

* Fixing: Phase 6.

* Fixing: Phase 7.

* Fixing: Phase 8. Tests

* Fixing: Phase 9. Tests!!!

* Fixing: Phase 10. Moar tests!

* Finally done!

* More fixes.

* Rename primitives:: to sp_core::

* Apply renames in finality-grandpa.

* Fix benches.

* Fix benches 2.

* Revert node-template.

* Fix frame-system in our modules.
2019-12-16 20:36:49 +08:00
Weiliang Li 4f2cdb20c1 Rename: primitives/sr-io -> primitives/sp-io (#4328)
* primitives/sr-io -> primitives/io

* fix

* rename

* runtime-io -> sp-io

* git mv

* fix ci

* remove package name

* fix

* fix

* try minimizing diff

* try minimizing diff again

* try minimizing diff again
2019-12-10 16:08:35 +01:00
Weiliang Li 6da9f59d72 Rename: primitives/sr-std -> primitives/sp-std (#4327)
* primitives/sr-std -> primitives/std

* fix

* fix conflict

* rstd -> sp-std

* git mv

* fix review

* fix merge
2019-12-10 08:26:27 +01:00
Tomasz Drwięga 3805393a13 Merge txpool-runtime-api with txpool-api (#4320)
* Remove transaction-pool-runtime-api

* Merge runtime-api with transaction-pool.
2019-12-06 17:24:17 +01:00
Gavin Wood 0f1a5f6514 Enumeratable dispatches using unhashed index in key. (#4278) 2019-12-03 00:49:27 +01:00
Andrew Jones 4c2ba5b71f Fix sp-session typo (#4273)
* Fix sp-session typo

* Remove erroneous whitespaces

* Don't mess with the file, editor
2019-12-02 20:24:25 +01:00
thiolliere 22c00ff424 Add swap and decode_len to DoubleMap finishing #3749 (#4264)
* Add `swap` and `decode_len` to `DoubleMap`

*  Add tests to `swap` and `decode_len` for `DoubleMap` (WIP)

* Address review comments

* Remove function that is not in scope

* fix test

* better naming
2019-12-02 13:01:29 +01:00
Benjamin Kampmann 927e13c13a The crate rename (#4223)
* Adding script for rename, could be applicable for nodes on top of it, too

* add stderr and gitlab ci features

* apply script

* fix now minor details in expected stderr

* Update the Cargo.lock

* fix name: sc-transaction -> sc-tracing

* fix rename in script, too
2019-12-02 11:23:53 +01:00
Gavin Wood fd1cec850e Economic fixes for democracy module (#4256)
* Fix up `end_block` mess; add free preimage noting for imminents.

* Fixes

* Bump runtime

* Update frame/democracy/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>

* Handle grumble

* Update frame/democracy/src/lib.rs

Co-Authored-By: Shawn Tabrizi <shawntabrizi@gmail.com>
2019-12-01 10:13:09 +01:00