Commit Graph

37 Commits

Author SHA1 Message Date
Guillaume Thiolliere 1cbfc9257f Rename pallet trait Trait to Config (#7599)
* rename Trait to Config

* add test asserting using Trait is still valid.

* fix ui tests
2020-11-30 14:34:54 +00:00
Shawn Tabrizi 7753a2250f sudo_as should return a result (#7620) 2020-11-30 13:57:15 +01:00
Guillaume Thiolliere 6182878933 Fix weight for inner call with new origin (#7196)
* fix weight for inner call with new origin

* fix
2020-10-01 08:24:34 +00:00
Bastian Köcher 86594727d9 Rename ModuleToIndex to PalletRuntimeSetup (#7148)
* 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
2020-09-22 13:39:56 +00:00
Wei Tang 9fdd4672b0 Use tracing-based subscriber logging (#6825)
* init_logger: switch from log-based to tracing-based and add compatibility layer

* Move tracing profiling subscriber related config realization

* sp-tracing: change profiling to be a layer instead of a subscriber

* Enable profiling layer in cli

* Change all test env_logger init to sp_tracing::try_init_simple

* Remove all local env_logger dependency

* Add missing tracing-subscriber dependency

* frame-sudo: fix tests

* frame-support: fix tests

* Fix frame/pallet and executor tests

* Fix the remaining tests

* Use subscriber's try_init as recommended by @davidbarsky

* Be explict that the tracing-log feature is needed

* Set subscriber writer to stderr

* Shorter line width

* Update cargo lock tracing version

* Fix sc_tracing crate compile

* Fix sc_authority_discovery crate test

* unremove default-features

* Leave enabled to default true

* Warn if global default cannot be set

* Fix unused import

* Remove unused PROXY_TARGET

* Change all reference from rc5 to rc6

* Change all reference of rc2 to rc6

* Fix styling

* Fix typo

* make logger init error'ing

* re-fixing the test issue

Co-authored-by: Benjamin Kampmann <ben@parity.io>
2020-09-17 11:04:43 +02:00
Denis Pisarev be5dc02d3b Fail docs on warnings (#5923)
* change (ci): docs job optimized; runs every commit; fails on warnings

* change (ci): rename jobs; temporary allow failing

* change (ci): better warnings filtering

* fix (ci): hotfix Docker release

* test (ci): run docs job with flags

* test (ci): pwd fails

* change (ci): pass just //doc dir as an artifact; debug

* change (ci): return to the previous structure; undebug

* change (ci): typo

* rebase on upstream 2

* fix the jobname

* Fix some warnings (#7079)

* Partial fix for transaction priority (#7034)

* Partial fix for priority stuff.

* Small fix

* Fix tests.

* Update frame/transaction-payment/src/lib.rs

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

* Better doc

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

* What happens if we remove wat? (#7056)

* What happens if we remove wat?

* Update Cargo.lock

* Make SlashingSpans Public (#6961)

* Make SlashingSpans Public

Offchain Applications will often need to inspect this type because it is directly used in staking election, thus worthy of being `pub`. Rest of the slashing api can remain private, only this and the `fn last_non_zero_slash()` of `SlashingSpans` are of interest.

* Update frame/staking/src/lib.rs

* client/authority-discovery/src/service: Improve docs (#7059)

* Decrease poll interval (#7063)

* Remove unused code (#7027)

Signed-off-by: Jimmy Chu <jimmychu0807@gmail.com>

* Disambiguate `BlockNumber` type in `decl_module` (#7061)

* Disambiguate `BlockNumber` type in `decl_module`

* fix `frame-support-tests`

* fix ui tests

* fix trait order

* Implement `FromStr` for `Ss58AddressFormat` (#7068)

* Implement `FromStr` for `Ss58AddressFormat`

* Update primitives/core/src/crypto.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Set reserved nodes with offchain worker. (#6996)

* add offchain worker api to set reserved nodes.

* new offchain api to get node public key.

* node public key from converter

* refactor set reserved nodes ocw api.

* new ndoe authorization pallet

* remove unnecessary clone and more.

* more

* tests for node authorization pallet

* remove dependency

* fix build

* more tests.

* refactor

* Update primitives/core/src/offchain/testing.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* Update frame/node-authorization/src/lib.rs

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

* format code

* expose NetworkService

* remove NetworkStateInfo in offchain

* replace NodePublicKey with PeerId.

* set max length of peer id.

* clear more

* use BTreeSet for set of peers.

* decode opaque peer id.

* extract NetworkProvider for client offchain.

* use OpaquePeerId in node authorization pallet.

* fix test

* better documentation

* fix test

* doc

* more fix

* Update primitives/core/src/offchain/mod.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Update client/offchain/src/api.rs

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* derive serialize and deserialize

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix some warnings

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more doc errors

* More doc fixes

* Remove subdb to make `rustdoc` happy

* Make the line length check happy

* Fix compilation error

* Another try

* Allow unused

Co-authored-by: Dan Forbes <dan@danforbes.dev>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Sergei Shulepov <sergei@parity.io>
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: s3krit <pugh@s3kr.it>
Co-authored-by: Jimmy Chu <jimmy@parity.io>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: kaichao <kaichaosuna@gmail.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
2020-09-11 17:39:16 +02:00
Shawn Tabrizi 6e6568167a Allow PostDispatchInfo to disable fees (#6749)
* initial mock

* add test

* remove unneeded clone

* Update frame/support/src/weights.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* fix compile

* Update frame/support/src/weights.rs

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Update frame/sudo/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Apply suggestions from code review

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

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-07-29 12:30:10 +00:00
warfollowsme | ryabina.io bbabb17426 More app-friendly event description (#6684)
* More app-friendly event description

* change origin -> owner

* checked all decl_event! and changed decriptions.

* annotated parameter names for remaining events
2020-07-20 13:13:20 +02:00
Kian Paimani c03f1743c8 Remove duplicate comments (#6638) 2020-07-12 10:02:56 +02:00
Shawn Tabrizi 2302898b8a Add WeightInfo to all pallets with benchmarks. (#6575)
* Start adding weight info

* More weightinfo

* finish weight info

* more fixes

* inital update of node runtime

* fix the rest of the compilation

* update balances

* add docs

* fix balances tests

* Fix more tests

* Fix compile

* Fix pallet-evm tests
2020-07-08 18:22:01 +02:00
Shaopeng Wang a6702b7121 decl_module! macro: use 'frame_system' instead of system as default ident (#6500)
* Use frame_system as default ident.

* Remove unused 'frame_system' to 'system' renaming.

* Fix construct_runtime_ui tests.

* Rename system to frame_system in sudo/utility pallet test.

* Bump runtime impl_version.

* Update formatting.
2020-07-07 23:06:21 +00:00
Gavin Wood 5f991ae9b8 Allow Sudo to do anything (#6375)
* All Sudo to do anything.

* Rename old labels.
2020-06-17 12:22:57 +02:00
Guillaume Thiolliere c2ad27271b Introduce in-origin filtering (#6318)
* impl filter in origin

* remove IsCallable usage. Breaking: utility::batch(root, calls) no longer bypass BasicCallFilter

* rename BasicCallFilter -> BaseCallFilter

* refactor code

* Apply suggestions from code review

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

* remove forgotten temporar comment

* better add suggestion in another PR

* refactor: use Clone instead of mem::replace

* fix tests

* fix tests

* fix tests

* fix benchmarks

* Make root bypass filter in utility::batch

* fix unused imports

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2020-06-15 17:05:41 +02:00
Alexander Theißen 7d3f1fe6ea Deprecate FunctionOf and remove its users (#6340)
* Deprecate FunctionOf and remove users

* Remove unused import
2020-06-12 15:21:39 +02:00
Tomasz Drwięga f74a7171be Maximum extrinsic weight limit (#6067)
* Only check single extrinsics weight limit in validate_transaction.

* Add missing parameter to all pallets.

* Add tests, fix default configuration.

* Bump spec version.

* Use AvailableBlockRation to calculate MaxExtrinsicWeight
2020-05-20 15:05:16 +02:00
Benjamin Kampmann be8c96adec Relax substrate licensing scheme (#5947) 2020-05-15 13:21:56 +02:00
emostov 71da6e96e6 Add tests to Sudo Pallet (#5963)
* transition treasury to configurable moduleids

* make election module id configurable

* convert runtime and pallet to accept module id config elections-phragmen

* add ModuleId to evm pallet

* change society pallet to configurable module id

* delete commented out module_id

* fix merge residual compile errors

* setup initial mock structure

* establish privelleged function test

* save progress

* first pass new_test_ext

* test sudo to make sure it error when non-root

* add set keys tests

* fix unused result from set_key call

* remove unused imports warnings

* pre master merge

* Expose BlockHashCount on system metadata constants (#5960)

* squash

* fix whitespace

* spelling and whitespace

* a single pesky space

* add logger module to mock

* add logger dispatch to privlleged function

* sub logger in for dummy functions

* create first of several event tests

* first pass at test coverage for events

* comment house keeping

* spell check

* Expose BlockHashCount on system metadata constants (#5960)

* establish privelleged function test

* save progress

* first pass new_test_ext

* test sudo to make sure it error when non-root

* add set keys tests

* fix unused result from set_key call

* remove unused imports warnings

* pre master merge

* squash

* fix whitespace

* spelling and whitespace

* a single pesky space

* add logger module to mock

* add logger dispatch to privlleged function

* sub logger in for dummy functions

* create first of several event tests

* first pass at test coverage for events

* comment house keeping

* implement last_seen_account storage item, event, and, logger function

* create vec account log and use in tests

* allow weight to be passed into account log

* refactor all log dispatchables

* save progress

* complete initial transition to refactored logger

* cleaning

* fix merge residual compile errors

setup initial mock structure

establish privelleged function test

save progress

first pass new_test_ext

test sudo to make sure it error when non-root

add set keys tests

fix unused result from set_key call

parent 5151bd784545ededa6153052a93fcc309f7b3885
author zeke <emostov@middlebury.edu> 1589076740 -0700
committer zeke <emostov@middlebury.edu> 1589350443 -0700

parent 5151bd784545ededa6153052a93fcc309f7b3885
author zeke <emostov@middlebury.edu> 1589076740 -0700
committer zeke <emostov@middlebury.edu> 1589350442 -0700

remove unused imports warnings

fix unused result from set_key call

remove unused imports warnings

pre master merge

Expose BlockHashCount on system metadata constants (#5960)

squash

fix whitespace

spelling and whitespace

a single pesky space

add logger module to mock

add logger dispatch to privlleged function

sub logger in for dummy functions

create first of several event tests

first pass at test coverage for events

comment house keeping

pre master merge

Expose BlockHashCount on system metadata constants (#5960)

Expose BlockHashCount on system metadata constants (#5960)

fix whitespace

spell check

implement last_seen_account storage item, event, and, logger function

create vec account log and use in tests

allow weight to be passed into account log

refactor all log dispatchables

save progress

complete initial transition to refactored logger

cleaning

* clean up

* cleaning

* condense non_privileged logs into 1 fn

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-05-13 22:48:49 +02:00
Wei Tang 9ecc1180fc Remove "simple declaration of the Module type" comments (#5944)
* Remove "simple declaration of the `Module` type" comments

* Bump runtime impl version

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

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

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-05-07 22:10:57 +02:00
Shawn Tabrizi b0d17b02ea Update System Weights (#5888)
* Update system weights

* Use maximum block weight for scheduler

* Update offences to use full block

* Move weight inside if statement

* Add one read to offences `on_initialize`

* Delete factory test

* Revert "Delete factory test"

This reverts commit 8f95aacd63a028ef1b415185b45367b4140d86fd.

* Revert "Add one read to offences `on_initialize`"

This reverts commit 7df7ebc73625ed79b14086f13c247d4058ee87d6.

* Revert "Move weight inside if statement"

This reverts commit 87277d07913a7d1868eeee85ef4673f51ee4013b.

* Revert "Update offences to use full block"

This reverts commit 0bbe0ce18e9419b032157f7d37dea6481078cdc0.

* Use scheduler in Sudo

* Apply suggestions from code review

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Revert "Use scheduler in Sudo"

This reverts commit 95bd2768dfea100bdf682cf4fe6c0f46e8e1f66e.

* remove max extrinsic weight (it does nothing useful)

* fix tests

* introduce `sudo_unchecked_weight`

* bump spec version

* scheduler 80 percent of maximum

* Update `set_changes_trie_config` weight

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

* Update frame/democracy/src/tests.rs

* Update tests.rs

* update based on feedback

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
2020-05-07 14:33:33 +02:00
Bastian Köcher 02f1772023 pallet-sudo: Store DispatchResult in Sudid event (#5804) 2020-04-28 12:25:36 +02:00
Shawn Tabrizi 8a33c297b4 Introduce BlockExecutionWeight and ExtrinsicBaseWeight (#5722)
* Introduce `BlockExectionWeight` and `ExtrinsicBaseWeight`

* Add new traits everywhere

* Missed one update

* fix tests

* Update `check_weight` logic

* introduce `max_extrinsic_weight` function

* fix + add tests

* format nits

* remove println

* make test a bit more clear

* Remove minimum weight

* newlines left over from find/replace

* Fix test, improve clarity

* Fix executor tests

* Extrinsic base weight same as old `MINIMUM_WEIGHT`

* fix example test

* Expose constants

* Add test for full block with operational and normal

* Initiate test environment with `BlockExecutionWeight` weight

* format nit

* Update frame/system/src/lib.rs

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

* Replace `TransactionBaseFee` with `ExtrinsicBaseWeight` (#5761)

* Replace `TransactionBaseFee` with `ExtrinsicBaseFee`

* Fix stuff

* Fix and make tests better

* Forgot to update this test

* Fix priority number in test

* Remove minimum weight from merge

* Fix weight in contracts

* remove `TransactionBaseFee` from contract tests

* Let `register_extra_weight_unchecked` go past `MaximumBlockWeight`

* address feedback

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2020-04-25 05:59:54 +00:00
Kian Paimani 6607393f9b enum Pays for PaysFee (#5733)
* enum Pays for PaysFee

* Fix doc test

* Update bin/node/executor/tests/basic.rs

* Update bin/node/executor/tests/basic.rs
2020-04-22 15:50:25 +02:00
Kian Paimani 50a7e12b3f Migrate away from SimpleDispatchInfo (#5686)
* Migrate away from SimpleDispatchInfo

* Fix imports

* Better doc

* Update lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
2020-04-22 09:20:28 +02:00
Shawn Tabrizi 980b635c8d Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2020-04-16 10:43:18 +02:00
Alexander Theißen 8f819f4ba6 Make Dispatchable return the actual weight consumed (#5458)
* Make Dispatchable return the actual weight consumed

Add PostInfo associated type to Dispatchable and have frame implement
Dispatchable { type PostInfo = PostDispatchInfo } where PostDispatchInfo
contains the actual weight consumed.

* Fix whitespace issues in docs
2020-04-03 16:45:30 +02:00
Kian Paimani a0772117ac Mandate weight annotation (#5357)
* Disallow default weight

* Fix build and test

* Fix tests

* Fix another beloved ui test.

* fix beloved trybuild tests

* fix treasury?

* Final test fix

* Fix build

* Fix another one

* Fix

* More doctest fix
2020-03-26 11:17:05 +01:00
Shawn Tabrizi ab47ee226a Add passthrough weight to Sudo (#4946)
* Add passthrough weight to Sudo

* Bump spec version

* Passthrough `pays_fee`

* Sudo always pays fee

* Use `FunctionOf`

* Add support for closure in dispatch classification

* Update docs
2020-02-17 17:30:49 +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
Joshy Orndorff 957ea8ba46 Remove references to frame_consensus from docs (#4582)
* Simply remove references to frame_consensus

* More thorough re-write

* Update frame/session/src/lib.rs

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

* on_initialize is not dispatchable

* Attempt to fix test.

* Actually fix test.

* Actually ran passing test.

* Update frame/session/src/lib.rs

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

Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
2020-01-27 17:14:10 +01:00
Shawn Tabrizi 7efa62725e Update copyright year (#4532) 2020-01-05 14:05:44 +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
Shawn Tabrizi 7e3872c064 Make sudo use decl_error! (#4369)
* Make sudo use `decl_error`

* copy pasta error

* Update to use `as_str`

* Add doc

* Add back `decl_error`
2019-12-17 00:32:40 +01: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
Tomasz Drwięga 1f84d6d41d Fix warnings when compiling runtime. (#4332)
* Remove warnings when compiling runtime.

* Remove dispatch::Result imports.

* Add missing imports.

* Fix missing vecs. #4333

* Fix oom function.

* Remove superfluous import.

* More warnings.
2019-12-10 14:21:34 +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
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
Shawn Tabrizi c9175b59ff Rename Palette to FRAME (#4182)
* palette -> frame

* PALETTE, Palette -> FRAME

* Move folder pallete -> frame

* Update docs/Structure.adoc

Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com>

* Update docs/README.adoc

Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com>

* Update README.adoc
2019-11-22 19:21:25 +01:00