Commit Graph

499 Commits

Author SHA1 Message Date
André Silva fc392896dc node: update flaming fir chain spec (#3423) 2019-08-16 16:23:46 +02:00
André Silva cb7527d2b2 babe: Introduce secondary slots (Aurababeous) (#3380)
* babe: initial implementation of secondary slots

* babe: validate secondary slot author

* babe: implement weight based fork choice

* babe: remove unused

* aura: cleanup unused imports

* babe: pass in parent weight when authoring and verifying

* babe: use epoch randomness for picking secondary slot authors

* babe: fix tests

* babe: fix wasm build

* babe: node-side code for disabling secondary slots

* babe: allow enabling/disabling secondary slots from runtime

* babe: fix test

* babe: use blake2_256 for secondary slot assignment

* babe: run block initialization in should_end_session

* node: increase slot duration to 6s

* babe: add docs

* node: bump spec_version

* Apply suggestions from code review

Co-Authored-By: joe petrowski <25483142+joepetrowski@users.noreply.github.com>

* babe: simplify secondary slot assignment calculation

* babe: remove unnecessary comment

* node: bump spec_version

* babe: fix bad merge
2019-08-16 15:47:53 +02:00
Tomasz Drwięga 42fb0c7cad Verify signature and session index during apply phase of im-online. (#3418)
* Verify signature and session index during apply phase of im-online.

* Bump impl_version.

* Add docs to SignedExtension
2019-08-16 12:59:02 +02:00
Svyatoslav Nikolsky 3825a21bac Fix light client synchronization on master (#3301)
* value ranges in consensus cache

* skip values in cache

* read epoch0 + epoch1 data from genesis in babe

* sync authorities + session validators at genesis

* removed some debug printlns

* fixed cache encoding

* Revert "skip values in cache"

This reverts commit ce451c32823aaa4b67d99ca5b58f1bf3984df4db.

* Revert "value ranges in consensus cache"

This reverts commit 9062f9434cddd14a01275ddbfcd904b04282e63b.

* get rid of cache::AUTHORITIES in Babe

* cleaning up

* cleaning up

* update spec version

* lost changes

* fixed tests

* Update node/runtime/src/lib.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* fix once-per-block condition

* fix standalone babe + temp_storage in BuildGenesis

* fix benhes compilation

* fixed comment

* re-added light nodes to integration tests

* finalize_with_ancestors from extra_requests

* post-merge fix

* aaand removed debug code

* (another one)

* fix warn in logs (do not call ForkTree::finalize twice for the same block)

* sync digest.next_authorities with actual next authorities

* more docs

* reverting all commits affecting storage

* also remove keys from babe trait

* fixed warnings

* post-merge fixes

* reverted some redundant changes

* reverted more changes
2019-08-16 11:51:49 +02:00
André Silva d1dde7e087 session: add handler for genesis session (#3413)
* session: add handler for genesis session

* node: bump spec version

* aura: handle on_genesis_session

* srml: make sure we don't re-initialize genesis authorities

* session: fix mock

* node: remove genesis authorities from chain spec

* staking: fix mock

* srml: don't initialize genesis authorities twice

* aura: don't reinitialize genesis authorities

* aura: fix runtime_io dependency

* Bump runtime
2019-08-16 11:24:06 +03:00
André Silva 3590c9c33f im-online: use new session keys (not upcoming session) (#3414)
* im-online: use new session keys (not upcoming session)

* node: bump spec_version

* im-online: rename on_new_session queued validator set parameter
2019-08-16 09:58:38 +02:00
Robert Habermeier ee0ac798eb remove weighting and staking dependency in BABE (#3412)
* remove weighting and staking dependency in BABE

* bump spec version

* Update Cargo.toml

* Update lock

* Fix warnings.
2019-08-15 21:21:14 +02:00
Michael Müller 7f764dbd37 Replace config field with default value (srml/im-online) (#3388)
* Fix whitespacing

* Replace configurable fields with default values

* Bump version

* Apply suggestions from code review

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

* Fix more whitespacing

* Fix style
2019-08-13 20:16:02 +02:00
Marcio Diaz 7b45130115 Add transaction pool to Aura and Babe import queue (#3225)
* Add transaction pool to babe import queue

* Add transaction pool to Babe check header

* Fix tests

* Add tx pool to Aura import_queue

* Fix tests, node-template

* Add comments regarding unused _transaction_pool

* Make tx pool optional in check_header
2019-08-13 10:44:00 +01:00
Gavin Wood 9afd655d8b Era change can be forced on and forced off (#3374)
* Forcing can be on or off.

* Add a testcase.
2019-08-12 18:14:16 +02:00
Gav Wood ebba5d1d3c Revert "Forcing can be on or off."
This reverts commit 583b0552d6.
2019-08-12 17:25:34 +02:00
Gav Wood 583b0552d6 Forcing can be on or off. 2019-08-12 17:24:12 +02:00
Jim Posen 36abb128f5 srml-contracts: Contract calls/instantiations to return exit statuses (#3320)
* srml-contracts: Rename ext_scratch_copy to ext_scratch_read.

This is to disambiguate from the next ext_scratch_write function.

* Remove unnecessary OutputBuf and EmptyOutputBuf.

* Replace VmExecError with a result type of custom structs.

* Do not drop the scratch buffer on traps and regular returns.

This just reduces the number of allocations required during nested
contract calls and instantiations.

* Semantics for returning a status code and data from contract calls.

* Remove CallReceipt and InstantiateReceipt.

With forthcoming changes to return data from instantiate calls, the two
types of receipts become very similar to each other and to
ExecReturnValue. Instead, replace them with ExecReturnValue and
a regular 2-tuple in the case of instantiation.

* Modify contract function signatures to allow returning status codes.

* Introduce ext_sandbox_write runtime function.

* Test all the things.

* Bump node runtime spec version.

* Style fixes.
2019-08-12 16:16:30 +02:00
André Silva 70d716dc48 node: exit on GRANDPA voter or BABE authoring error (#3353)
* node: exit on GRANDPA voter or BABE authoring error

* node: exit process with non-zero return code when service fails

* service: rename infallible task to essential task

* service: revert field name changes

* core: fix service testnet
2019-08-12 15:54:30 +02:00
Pierre Krieger 6fa84bae0f Refactor parse_and_execute (#3358)
* Refactor `parse_and_execute`

Adds a new function named `parse_and_prepare`, which prepares the environment and parses the command.
Contrary to `parse_and_execute`, `parse_and_prepare` returns a struct that permis the user to execute the command, as opposed to execute it itself.

`parse_and_execute` has been modified to use `parse_and_prepare` internally.

* Embed dispatch functions directly into run()

After the previous commit, we now have a lot of functions whose only one is to call other functions. And these other functions are called only from one location.
Let's merge these two for clarity.

* Deprecate parse_and_execute and replace it in node and node-template

* Apply suggestions from code review

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
2019-08-11 16:07:40 +02:00
Gavin Wood 14bb115193 Scale trait and move to u32 blocknumbers (#3357)
* Scale trait and move to u32 blocknumbers.

* Fixes

* Cleanups

* Update node/runtime/src/lib.rs

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

* Fix up some of the factory stuff.

* Update core/sr-primitives/src/traits.rs

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

* Move Nonce/Index to u32 (#3361)

* Force a non-borked version of upstream crate

* Line lengths and runtime version bump
2019-08-11 15:03:06 +02:00
André Silva 59c88cb2f3 node: setup disabled grandpa properly (#3356) 2019-08-09 16:53:44 +02:00
André Silva 98d502466d node: re-introduce validator flag (#3351) 2019-08-09 15:17:52 +02:00
Bastian Köcher c824c959d7 Adds --no-validator CLI flag (#3348)
* Implement `is_validator` for offchain-workers

* Introduce `--no-validator` flag

* Don't run babe/grandpa/im-online when `--no-validator` is given

* Fixes compilation

* Bump spec version

* Improve error handling in executor

* Add missing extern function

* Revert making error public

* Remove `--no-validator` CLI
2019-08-09 14:24:18 +02:00
André Silva 8f3a68db25 grandpa: fix --no-grandpa flag breaking block production (#3350) 2019-08-09 00:53:54 +01:00
Pierre Krieger bafc7202ca Service various cleanups (#3238)
* Remove generic from sign()

* Remove mandatory RuntimeGenesis trait req

* Remove requirement from Configuration

* Relax trait bounds of core/cli

* Move method

* The config field is no longer public

* Remove Components from bounds of functions

* Implement DerefMut for LightComponents

* Implement Executor for Full/LightComponents

* Fix bad merge

* Fix forgotten config()

* Fix build
2019-08-08 16:14:30 +02:00
cheme b0e1212d48 Child storage tests and genesis fix. (#3185)
* Using child storage, (srml-support only), test failing .

* fix simple tests.

* Enumerable by requiring owned struct (previous form only allow
&'static).
Broken tests are from genesis init.

* implement for_child_keys_with_prefix

* indent

* clear_child_prefix fix.

* clear_child_prefix fix 2.

* fix for storage_impl, if/when allowing child and not child this could be
reverted.

* Fix lot of urlinked child genesis, still need to look upon actual
genesis srml module code.
Probably still a lot of broken code needing debugging.

* switch well_known_key to their associated module child trie.
Fix a genesis init (balance).
Complete some testing.
Comment some tests before using.

* fixing test runtime child keys

* latest commit fix broken genesis init

* fix system balances child name.

* Important fix: storage_root from test externalities need children (it is
already the case for ext).

* executive root with child calculation

* Avoid empty trie on test ext.

* Symetric removal of key for system.

* commenting changes related tests.

* Remove child module specifics.

* fix issues.

* fix some formatting

* fix bench and bump runtime

* Remove extend_storage_overlays, assimilate_storage do the same as is
proper considering srml macro.

* Fix warning for assimilate.

* Removing kill as they do not impact any test cases.

* Use tuple of storage map instead of two parameters. This changes the
behavior of decl_storage genesis build closure (breaking api).

* Do not use build storage before assimilate.

* fix error

* Update core/state-machine/src/backend.rs
2019-08-08 15:05:25 +02:00
Jim Posen 0067b2d9a2 srml-contracts: Refactor away some duplication in runtime functions. (#3257)
* srml-contracts: Storage access micro-optimization.

* srml-contracts: Refactor runtime functions to reduce duplication.

* Bump node runtime impl version.
2019-08-08 15:02:04 +02:00
Bastian Köcher 0de7d9bb64 Adds author_rotateKeys RPC (#3337)
* Adds `author_rotateKeys` RPC

`author_rotateKeys` will rotate all session keys, store them into the
keystore and returns their encoded public keys as result. These encoded
public keys can be used directly to send the transaction to the chain.

* Review comments
2019-08-08 11:00:04 +02:00
Xiliang Chen 0f0df9850a add post_dispatch (#3229)
* add post_dispatch

* Update traits.rs

* Update checked_extrinsic.rs

* Update traits.rs

* Update traits.rs

* fix build issue

* update runtime version

* fix test build issue
2019-08-08 09:56:04 +02:00
Bastian Köcher 60269d65c6 Clean up CLI interface (#3334)
* Clean up CLI interface

- Removes `--validator` and `--grandpa-voter`
- Make `--alice` etc work without `--dev`

* Style fixes
2019-08-08 09:33:45 +02:00
Arkadiy Paronyan 58bd0d4c05 Set uncles inherent (#3317)
* Include uncles

* Filter missing uncles

* Moved inherent registration to a new crate

* Ignore invalid inherent encoding
2019-08-08 00:56:29 +02:00
Bastian Köcher ea58b7c92a Make DefaultByte implement Send + Sync (#3333)
* Make `DefaultByte` implement `Send + Sync`

* Update runtime version.
2019-08-08 00:10:36 +02:00
Andrew Jones 65a7629361 Derive CompactAs for Perbill/mill/U128 (#3327)
* Derive CompactAs for Perbill/mill/U128

* Increment impl_version
2019-08-07 21:48:30 +02:00
Gavin Wood 1a524b8207 Refactor key management (#3296)
* Add Call type to extensible transactions.

Cleanup some naming

* Merge Resource and BlockExhausted into just Exhausted

* Fix

* Another fix

* Call

* Some fixes

* Fix srml tests.

* Fix all tests.

* Refactor crypto so each application of it has its own type.

* Introduce new AuthorityProvider API into Aura

This will eventually allow for dynamic determination of authority
keys and avoid having to set them directly on CLI.

* Introduce authority determinator for Babe.

Experiment with modular consensus API.

* Work in progress to introduce KeyTypeId and avoid polluting API
with validator IDs

* Finish up drafting imonline

* Rework offchain workers API.

* Rework API implementation.

* Make it compile for wasm, simplify app_crypto.

* Fix compilation of im-online.

* Fix compilation of im-online.

* Fix more compilation errors.

* Make it compile.

* Fixing tests.

* Rewrite `keystore`

* Fix session tests

* Bring back `TryFrom`'s'

* Fix `srml-grandpa`

* Fix `srml-aura`

* Fix consensus babe

* More fixes

* Make service generate keys from dev_seed

* Build fixes

* Remove offchain tests

* More fixes and cleanups

* Fixes finality grandpa

* Fix `consensus-aura`

* Fix cli

* Fix `node-cli`

* Fix chain_spec builder

* Fix doc tests

* Add authority getter for grandpa.

* Test fix

* Fixes

* Make keystore accessible from the runtime

* Move app crypto to its own crate

* Update `Cargo.lock`

* Make the crypto stuff usable from the runtime

* Adds some runtime crypto tests

* Use last finalized block for grandpa authority

* Fix warning

* Adds `SessionKeys` runtime api

* Remove `FinalityPair` and `ConsensusPair`

* Minor governance tweaks to get it inline with docs.

* Make the governance be up to date with the docs.

* Build fixes.

* Generate the inital session keys

* Failing keystore is a hard error

* Make babe work again

* Fix grandpa

* Fix tests

* Disable `keystore` in consensus critical stuff

* Build fix.

* ImOnline supports multiple authorities at once.

* Update core/application-crypto/src/ed25519.rs

* Merge branch 'master' into gav-in-progress

* Remove unneeded code for now.

* Some `session` testing

* Support querying the public keys

* Cleanup offchain

* Remove warnings

* More cleanup

* Apply suggestions from code review

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

* More cleanups

* JSONRPC API for setting keys.

Also, rename traits::KeyStore* -> traits::BareCryptoStore*

* Bad merge

* Fix integration tests

* Fix test build

* Test fix

* Fixes

* Warnings

* Another warning

* Bump version.
2019-08-07 20:47:48 +02:00
Bastian Köcher 394eff6c2f Update to schnorrkel 0.8.0 (#3267)
* Update to schnorrkel `0.8.0`

* Increase `spec_version`

* Bump schnorrkel to 0.8.3 (#3283)

* Schnorrkel 0.8.1 (builds on bkchr upgrade branch)

* Add tests for known hard/soft derivation values

* Bump all schnorrkel versions

* Flatten for easier inspection

* 0.8.2

* 0.8.3

* Update subkey/Cargo.toml

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

* Update `Cargo.lock`

* 0.8.4

* Fix cargo lock file.

* Adding an error message for `NotMarkedSchnorrkel` as that was missing.
Also fixing a typo, strage -> stage.
2019-08-07 12:59:54 +02:00
thiolliere 4ed67e03a4 Update to parity-scale-codec (#3232)
* WIP: update codec

* WIP

* compiling

* WIP

* rename parity-scale-codec to codec

* WIP

* fix

* remove old comments

* use published crates

* fix expected error msg

* bump version

* fmt and fix

* remove old comment

* fix wrong decoding impl

* implement encode like for structures

* undo removal of old pending changes

* trailingzeroinput

* Apply suggestions from code review

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

* update codec

* fmt

* version is 1.0.0

* show more error

* fmt
2019-08-06 19:36:23 +02:00
Robert Habermeier d5726d8e8a fix BABE randomness calculation (#3305) 2019-08-05 20:50:37 -04:00
André Silva a7c6950f1b node: fix integration test transaction format (#3306) 2019-08-05 21:56:26 +02:00
Sergei Pepyakin f0856db12c srml-contracts: Minor fixes to docs. (#3262)
* Adjust documentation.

* Bump impl_version.

* Update srml/contracts/src/wasm/runtime.rs

Co-Authored-By: Hero Bird <robbepop@web.de>

* Remove incorrect doc.
2019-08-02 19:53:33 +02:00
André Silva aa86185648 node: use BABE predigest data to find authorship (#3293)
* node: use BABE predigest data to find authorship

* node: bump spec_version

* babe: use u32 for authority index
2019-08-02 19:52:36 +02:00
cheme da8b91ae7b Trie simplification. (#2815)
* switch to simple codec, trie broken for now

* Actualy use trie_root_noext

* align some hash, failing test on EMCH comment

* Fix trie code over layout instead of hash, revert legacy code for legacy
mainnet ??

* stub behind LayOut

* fix no_std

* temp solution for legacy trie behind feature legacy-key in various crate

* use remote project

* rc client db need prefix

* update trie deps

* bum spec runtime version

* Removing legacy as default.

* Switch mode to non legacy.

* bump runtime version

* Remove legacy trie compatibility features.

* fix warning

* bump version

* change hash on new test.

* Move dependency (#11 trie PR) patched to a parity repo.
Bench reverted to correct hasher.
Some renaming and doc improvments.

* ChildBitmap renaming to BitMap.

* Renaming of LayOut to Layout.

* formatting.

* Removing abreviation such as _ix nb_ or bm.

* Update deps and apply renaming 'Buff' -> 'Buffer'.

* Align to latest trie crates naming changes.

* Update trie dependency.

* Update trie dependency.

* change block_import test hash

* update trie deps (trie use new scale codec but it does not seems to be
an issue).

* update to use latest trie version (no mgmt of multiple radix).

* tabify

* Restoring test to 10 000.

* Use published crate, trie bench is currently down until publishing
(require another pr to update version).

* Update trie-bench.
2019-08-02 19:51:59 +02:00
Gavin Wood 7927e80bc6 Check the genesis hash in transactions regardless of era. (#3286)
* Check the genesis hash in transactions regardless of era.

* Fix check-fees, too.

* Undo.

* Subkey supports new signing.

* Remove unneeded type param.

* Bump tx version

* Build.

* Another build fix

* Build again

* Cleanup

* Another fix.

* Fix

* Fixes

* 6 second blocks.

* Fixes

* Build fix

* Fix

* Fix.
2019-08-02 18:30:20 +02:00
Gavin Wood ae6c2f7f8c Fix staking (#3284)
* 6 second blocks.

* Version bump

* Add test for slashable_balance()
2019-08-01 16:01:22 +02:00
thiolliere b504f5a7bb Make staking add_reward_points_to_validator public (#3273)
* make staking add_reward_points_to_validator public

* make storage private

* bump version
2019-08-01 09:55:27 +02:00
Sergei Pepyakin de02aee156 srml-contracts: Deferred actions (#3255)
* Switch to deferred actions

* Make restore_to a deferred action.

* Bump version.

* Review fixes.
2019-08-01 09:52:59 +02:00
Tomasz Drwięga 04c115a6e9 Revert "Update schnorrkel to 0.7.0 (#3261)" (#3264)
This reverts commit a5fa1ddd99.
2019-07-31 00:19:32 +02:00
Bastian Köcher a5fa1ddd99 Update schnorrkel to 0.7.0 (#3261)
* Update schnorrkel to `0.7.0`

* Apply suggestions from code review

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* Increase `spec_version`
2019-07-30 17:46:05 -04:00
André Silva c1640ef5da node: update flaming fir chain spec (#3258)
* node: update BABE authority ids in staging testnet config

* node: update flaming fir chain spec
2019-07-30 22:44:02 +01:00
André Silva bd052d8da4 babe: Disable unused median calculation (#3251)
* babe: don't execute median algorithm

* babe: checked sub in median calculation

* node: bump impl_version to make ci happy

* babe: remove forbid dead_code
2019-07-30 22:08:20 +01:00
Jim Posen 1295260f2b Remove unused imports introduced in #3239. (#3252)
Partly due to interaction with #3191.
2019-07-30 14:30:01 +02:00
Jim Posen 4c0934b2a7 srml-contracts: Forbid declaration of float types in contracts (#3234)
* srml-contracts: Forbid remaining uses of float types.

* Bump node runtime impl version.
2019-07-30 13:41:09 +08:00
André Silva 483ad60379 srml: babe: add expected block time and epoch duration constants (#3241)
* srml: babe: add expected block time constant

* srml: babe: expose epoch duration constant

* node: bump spec_version

* core: don't use moment type in test-runtime

* babe: add docs regarding c parameter
2019-07-30 13:39:33 +08:00
Pierre Krieger 20eb52d6bb Allow creating a ChainSpec from a Vec<u8> (#3233)
* Allow creating a ChainSpec from a Vec<u8>

* Line widths

* Embedded -> Binary

* Remove from_embedded
2019-07-29 20:50:50 +02:00
Jim Posen 8aa367c27a Fix substrate factory CLI command (#3239)
* CLI execution flag for import-blocks and factory.

* Fix minimum_balance bug with CLI factory.
2019-07-29 17:06:13 +02:00