Commit Graph

208 Commits

Author SHA1 Message Date
Gavin Wood 350e72dac5 Revert "Header-only sync for old forks (#3942)" (#4022)
This reverts commit 172359adad.
2019-11-05 16:05:36 +01:00
Arkadiy Paronyan 172359adad Header-only sync for old forks (#3942)
* Header-only sync for old forks

* Simplified blocks-count

* Update core/consensus/common/src/block_import.rs

Co-Authored-By: Marcio Diaz <marcio.diaz@gmail.com>
2019-11-05 12:17:12 +01:00
Tomasz Drwięga 20a3989785 Runtime logging. (#3821)
* Implement Printable for tuples.

* Add debugging function.

* Add debug 1.

* Implement  for everything.

* RuntimeDebug derive.

* Introduce RuntimeDebug.

* Add some dummy logging.

* Replace RuntimeDebug with Debug.

* Revert "Replace RuntimeDebug with Debug."

This reverts commit bc47070a8cb30241b2b590b2fa29fd195088162f.

* Working on Debug for all.

* Fix bounds.

* Add debug utils.

* Implement runtime logging.

* Add some docs and clean up.

* Clean up derives.

* Fix custom derive impl.

* Bump runtime.

* Fix long lines.

* Fix doc test.

* Use CARGO_CFG_STD.

* Revert "Use CARGO_CFG_STD."

This reverts commit ea429566de18ed0fa052571b359eb9826a64a9f4.

* Use parse_macro_input

* Update lockfile.

* Apply review suggestions.

* Remove stray re-export.

* Add no-std impl.

* Update lockfile.
2019-10-22 14:13:44 +02:00
Caio f5162edc83 It's Clippy time (#3806)
Fix some Clippy issues
2019-10-19 13:01:51 +02:00
André Silva 356015e450 grandpa: pluggable voting rules (#3673)
* grandpa: support pluggable custom voting rules

* grandpa: add docs to grandpa voting rule

* grandpa: make voting rule mandatory

* grandpa: add test for voting rule

* node: add GRANDPA voting rule

* grandpa: pass backend to VotingRule

* core: fix docs in SelectChain::finality_target

* grandpa: implement 3/4 of unfinalized chain restriction as voting rule

* grandpa: rename AlwaysBehindBestBlock voting rule

* grandpa: fix tests

* grandpa: remove useless test

* grandpa: extend environemnt voting rule test

* grandpa: add proofs to unreachable statements

* grandpa: fix typo

* grandpa: fix docs
2019-10-18 13:07:41 -04:00
Ashley 411b8f96d4 Add error types to BABE and PoW (#3827)
* Add an error type to Babe

* Add an error type to PoW

* Simplify error enum variant names

* Update core/consensus/babe/src/lib.rs

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

* Add missing newline

* Split up DataProvider into CreateInherents and CheckInherents
2019-10-17 12:34:03 +02:00
Demi Obenour 4da48dd9f5 Bump dependencies (#3787)
* Update dependencies, respecting semver

* Bump dependencies

* Don’t patch tiny-bip39 dependency
2019-10-09 12:29:28 -04:00
André Silva 984c6ac839 babe: verify slots are strictly increasing (#3785)
* babe: re-use code to propose and import test block

* babe: add failing test for slot validation

* babe: verify slot numbers are strictly increasing
2019-10-08 21:56:22 +02:00
André Silva b181951bcc babe: prune the epoch tree on startup (#3768) 2019-10-05 10:44:07 +02:00
Marcio Diaz 65ef193ec8 Use header metadata in babe verify. (#3756)
* Use header_metadata in verify.

* Log hash in header_metadata error.

* Fix naming, error.
2019-10-05 10:43:19 +02:00
André Silva f1cdaae6de babe: small compilation fix (#3764)
* babe: fix type on find_pre_digest call

* fork-tree: optimize prune

* babe: fix test compilation
2019-10-04 19:55:03 +01:00
André Silva 49fb11a1ea babe: ancient epoch tree pruning (#3746)
* babe: prune epoch tree when importing a new epoch change

* fork-tree: fix tree pruning

* babe: actually prune epoch change fork tree

* Fix typos

* babe: add test for epoch tree pruning

* fork-tree: fix pruning of stale forks
2019-10-04 19:51:08 +02:00
Joshy Orndorff 99da0232ee Grammar (#3754) 2019-10-04 09:12:06 +02:00
Wei Tang 18fa1d15ce Cumulative fixes to make working with consensus-pow easier (#3617)
* consensus-pow: add difficulty data to auxiliary

* Timestamp api

* Implement FinalityProofProvider for ()

* Add DifficultyApi

* Remove assumption that Difficulty is u128

* Use a separate trait for add instead of hard-code it as Saturating

* Some convenience functions to work with PowVerifier

* Try to fix mining unstability

* Fix generic resolution

* Unused best_header variable

* Fix hash calculation

* Remove artificial sleep

* Tweak proposer waiting time

* Revert sleep removal

The reason why it was there is because when mine_loop returns, it means an error
happened. In that case, we'd better sleep for a moment before trying again,
because immediately trying would most likely just fail.

* Pass sync oracle to mining

So that it does not mine when major syncing

* Expose build time as a parameter

Instead of hardcode it as previously 100ms.

* Update lock file

* Fix compile

* Support skipping check_inherents for ancient blocks

For PoW, older blocks are secured by the work, and can mostly be considered to
be finalized. Thus we can save both code complexity and validation time by
skipping checking inherents for them.

* Move difficulty fetch function out of loop

To make things faster

* Remove seed from mining

Each engine can use its own Rng source.

* Better comments

* Add TotalDifficulty definition for U256 and u128

* Update core/consensus/pow/src/lib.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>

* Rename TotalDifficulty::add -> increment

* Use SelectChain to fetch the best header/hash

* Update lock file
2019-10-03 11:02:20 +08:00
DemiMarie-parity 62b97a090d Upgrade dependencies whenever “easy” (#3556)
* Update all dependencies

* Upgrade dependencies whenever “easy”

“easy” means that there are no major changes required.

* Fix build and bump paste dependency to 0.1.6

* Remove dead code

* Re-add = dependency for futures-preview

* Add missing std features for runtime-io

* Remove git dependencies

as updated versions have been published to crates.io

* try to debug bug

* For sr-io, "std" should imply "no_oom" and "no_panic_handler".

Otherwise, rustc complains (correctly) about duplicate lang items.

* Add missing "runtime-io/std" features

* Fix compilation errors

* Prevent duplicate lang items

Rust does not allow duplicate lang items.  When compiled without the
`std` feature, `sr-io` defines two lang items.  Therefore, `sr-io`
compiled without `feature = "std"` must not be linked with `std`.

However, `pwasm-utils` and `wasmi-validation` both bring in `std` unless
compiled with `default-features = "false"`.  This caused a duplicate
lang item error.  Building both with `default-features = "false"`
prevents this error.  When building with `feature = "std"`, they should
both be built with the `std` feature, so this feature needs to be
explicitly depended on.

* Bump `impl_version`

* Make tests pass

Three tests used 1 less gas than they had previously.

* Try to un-break build

* Add a Cargo.lock file

* Revert offchain code

* Revert "Revert offchain code"

This reverts commit d216d08cc6ca0344614669c1d24cde3aa5c0d4e2.

* Don’t try to send a body with a GET request

without adding a Transfer-Encoding or Content-Length header.

This has always been wrong, but hyperium/hyper#1925 hid the bug until
hyper was upgraded to 0.12.35.

* Change some more GET requests to POST requests

* Fix excess line width and remove an `extern crate`

* Delete commented-out extern crate

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

* Fix regression in Cargo.toml files

dev-dependencies need `default-features = false`, too.

* Bump parity-wasm dependency

* Bump `futures-preview`

* Apply suggestions from code review

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

* Update Cargo.lock files

* Apply suggestions from code review

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

* Update core/service/src/chain_ops.rs

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>
2019-10-02 15:23:59 -04:00
Marcio Diaz f6bd58ac1f Optimize tree route to sync faster (#3665)
* Introduce HeaderMetadata and use it for tree_route. Add lowest_common_ancestor.
* Add tests.
2019-10-02 20:30:43 +02:00
DemiMarie-parity 8646cd158e BABE refactoring: split out verification (#3658)
* Refactor parts of BABE verification into separate module

* Fix silly compiler error

* Move more of the verification code to verification.rs

* Remove some unused imports

* Fix line width

* fix testsuite compile error

* Fix compile errors in tests

* Move authorship-related code to its own files

* fix compile errors in tests

* Respond to review comments by @rphmeier

* improve docs

* fix compile error

* Add missing doc comment
2019-10-02 15:51:49 +02:00
Alexandre R. Baldé 3907582457 Remove unused imports (#3737) 2019-10-02 00:10:37 +02:00
Ashley c545344c60 Add an Error type to Aura (#3688)
* Add an Error type to Aura

* Add Cargo.lock

* AuRa -> Aura

Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
2019-10-01 12:42:11 +08:00
Tomasz Drwięga 667ee95f5d ChainSpec extensions (#3692)
* Add some chainspec tests and make sure we validate it.

* Manual implementation of Extension + Forks definitions.

* Move chain spec to separate crate.

* Allow using ChainSpec with extensions.

* Renames.

* Implement Extension derive.

* Implement Extension for Forks.

* Support specifying fork blocks.

* make for_blocks work

* Support forks correctly.

* Add a bunch of docs.

* Make fork blocks optional.

* Add missing docs.

* Fix build.

* Use struct for check_block params.

* Fix tests?

* Clean up.
2019-09-29 01:05:36 +08:00
Toralf Wittner af0d71d389 Add block announce validator. (#3346)
* Add `BlockAnnounceValidator` trait.

* Add associated data to block announcement.

* Make tests compile.

* Move validator into `sync.rs`.

* Smaller changes.

* Update core/network/src/protocol.rs

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

* Update core/network/src/protocol.rs

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

* Update core/network/src/test/sync.rs

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

* Formatting.

* Remove assoc. data from `BlockImportNotification`.

* Use `Option<Vec<u8>>` for associated data.

* Update core/network/src/protocol/sync.rs

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

* Fix type error.
2019-09-24 10:48:21 +02:00
Ashley 1baee72d75 use pdqselect for median_algorithm selection (#3636)
* use pdqselect for median_algorithm selection instead of sorting the whole vec

* Make use of pqdselect clearer

Co-Authored-By: André Silva <andre.beat@gmail.com>

* Make use of pqdselect clearer

Co-Authored-By: André Silva <andre.beat@gmail.com>
2019-09-23 22:37:53 +02:00
Robert Habermeier c200ce757b Fixing BABE epochs to change between blocks (#3583)
* always fetch epoch from runtime

* node integration tests don't test light nodes

* give stand-in full node a FULL role

* rejig babe APIs

* introduce next-epoch-descriptor type

* overhaul srml-BABE epoch logic

* ensure VRF outputs end up in the right epoch-randomness

* rewrite `do_initialize` to remove unnecessary loop

* begin accounting for next epoch in epoch function

* slots passes header to epoch_data

* pass slot_number to SlotWorker::epoch_data

* begin extracting epoch-change logic into its own module

* aux methods for block weight

* aux methods for genesis configuration

* comment-out most, refactor header-check pipeline

* mostly flesh out verifier again

* reinstantiate babe BlockImport implementation

* reinstate import-queue instantiation

* reintroduce slot-worker implementation

* reinstate pretty much all the rest

* move fork-choice logic to BlockImport

* fix some, but not all errors

* patch test-runtime

* make is_descendent of slightly more generic

* get skeleton compiling when passing is_descendent_of

* make descendent-of-builder more succinct

* restore ordering of authority_index / slot_number

* start fiddling with tests

* fix warnings

* improve initialization architecture and handle genesis

* tests use correct block-import

* fix BABE tests

* fix some compiler errors

* fix node-cli compilation

* all crates compile

* bump runtime versions and fix some warnings

* tweak fork-tree search implementation

* do backtracking search in fork-tree

* node-cli integration tests now work

* fix broken assumption in test_connectivity

* babe tests fail for the right reasons.

* test genesis epoch logic for epoch_changes

* test that epochs can change between blocks

* First BABE SRML test

* Testing infrastructure for BABE

Also includes a trivial additional test.

* Apply suggestions from code review

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

* A little more test progress

* More work on BABE testing

* Try to get the tests working

* Implement `UintAuthorityId`-based test mocks

* Fix compilation errors

* Adjust to upstream changes

* Block numbers are ignored in BABE epoch calculation

* authority_index() should ignore invalid authorities

* Fix compile error

* Add tests that session transitions happen

* Check if BABE produces logs

It currently does not.

* Fix test suite

This was really nasty, due to a type confusion that showed up as an
off-by-1 buffer error.

* Add additional tests

Most of these were derived from the current output, so they are only
useful to guard against regressions.

* Make the tests more readable

Also bump impl_version.

* Fix excessive line width

* Remove unused imports

* Update srml/babe/src/lib.rs

Co-Authored-By: André Silva <andre.beat@gmail.com>

* try to fix imports

* Fix build errors in test suite

* tests did not pass

* Try to get at least one digest to be output

Currently, the code emits either no digests (if I don’t call
`Session::rotate_session()` or two digests (if I do), which is wrong.

* More tests

They still don’t work, but this should help debugging.

* fix silly error

* Don’t even try to compile a broken test

* remove broken check_epoch test and add one for genesis epoch

* Check that the length of the pre-digests is correct

* Bump `impl_version`

* use epoch_for_descendent_of even for genesis

* account for competing block 1s

* finish srml-babe docs

Co-Authored-By: André Silva <andre.beat@gmail.com>

* address grumbles
2019-09-23 16:03:05 +02:00
Hernando Castano e434dbdfc5 Use ThreadPool::spawn_ok() instead of ThreadPool::spawn() (#3656)
* Bump futures-timer to v0.3

* Bump futures-preview to v0.3.0-alpha.18

* Replace ThreadPoll::spawn() with ThreadPoll::spawn_ok()
2019-09-20 15:26:14 +02:00
Svyatoslav Nikolsky eba6dd73c6 Blockchain cache pruning strategy (#3395)
* blockchain cache pruning strategy

* added some internal docs to cache_pruning_strategy

* Update core/client/db/src/cache/mod.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
2019-09-20 09:49:15 +03:00
Weiliang Li d105d3f3a1 fn import_block -> fn block_import_params in SimpleSlotWorker (#3647) 2019-09-19 15:49:24 +01:00
Bastian Köcher 2b040fe983 Properly detect debug build in slots (#3630)
`debug-assertions` can also be enabled in for release builds. This
introduces a new build-script that extracts the build type from the
`PROFILE` env variable and sets the `build_type` cfg.
2019-09-17 14:39:40 +02:00
Shawn Tabrizi 113d512300 Suggest --release compilation (#3627) 2019-09-17 13:32:52 +02:00
Svyatoslav Nikolsky 010395e620 Never panic during execution proof check (#3504)
* do not panic during execution proof check

* Update core/state-machine/src/lib.rs

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

* Update core/state-machine/src/lib.rs

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

* Update core/state-machine/src/lib.rs

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

* BackendTrustLevel enum

* up runtime version

* Update core/state-machine/src/lib.rs

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

* Update core/state-machine/src/lib.rs

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

* fixed some grumbles

* Update core/state-machine/src/testing.rs

Co-Authored-By: Gavin Wood <gavin@parity.io>

* Update core/state-machine/src/lib.rs

Co-Authored-By: Gavin Wood <gavin@parity.io>

* mov where

* spaces -> tabs (to restart build)
2019-09-11 10:27:32 +03:00
Wei Tang ece0b57d8d Consensus: Proof of Work (#3473)
* consensus-pow: init primtives and verifier

* consensus-pow: add total difficulty auxiliary

* consensus-pow: implement total difficulty chain selection

* consensus-pow: implement pow import queue

* consensus-pow-primitives: add mine into PowApi

* consensus-pow: implement mining

* Update lock file

* Style fixes

No run-on expressions allowed.

* consensus-pow: refactor register_pow_inherent_data_provider

* consensus-pow: make PowApi::mine yieldable

* consensus-pow: better mining loop

* Add missing license header

* consensus-pow-primitives: clarify the meaning of None for PowApi::verify

* consensus-pow: changing total difficulty addition to use saturating add

* consensus-pow: change mine-loop error to log on error! level

* consensus-pow: allow inserting arbitrary preruntime digest for pow

The preruntime digest can be intepreted by the runtime as the block author/coinbase.

* Fix line width

* More line width fixes

* consensus-pow: separate difficulty, verify API

This makes it more apparent that currently in PoW engine, `difficulty` should
be input, not output.

* srml-pow: implementation of average_span difficulty adjustment

* srml-pow: basic blake2 algo example

* srml-pow-average-span: make it not require genesis config

* srml-pow: add support for authorship

* Missing license headers

* consensus-pow: PowAlgorithm trait generalization

* Missing docs for consensus-pow

* More docs

* node-runtime: bump impl_version

* Add rationale for difficulty type

* consensus-pow: refactor aux_key

* Update lock file

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/primitives/src/lib.rs

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

* Update core/consensus/pow/primitives/src/lib.rs

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

* Remove PowRuntimeAlgorithm

* block_id -> parent_block_id

* Auxiliary data -> auxiliary storage data

* Fix error message

* Fix compile

* Update core/consensus/pow/primitives/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Update core/consensus/pow/primitives/src/lib.rs

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

* Update core/consensus/pow/src/lib.rs

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

* Fix crate description

* More docs

* Address grumbles

1. Make preruntime Optional.
2. Add more docs on what is `preruntie` and `round`.
3. Replace `Default::default` with the approriate type.
2019-09-06 15:45:53 +02:00
André Silva 397855c611 client: only report block import to telemetry if new best (#3548)
* client: only report block import to telemetry if new best

* grandpa: fix tests

* consensus: derive Default for ImportedAux

* network: fix test
2019-09-04 17:14:42 +01:00
Caio db7cd526e4 Typo (#3531) 2019-09-02 16:25:44 +02:00
Benjamin Kampmann 0cae7217d8 Remove client.backend (#2960)
* generalize tree_root to remove client.backend dependency

* replace client.backend.blockchain.header with client.header

* move used_state_cache_size into client info

* Create intermediate Setup State. Fixes #1134

* remove client.backend from finality proof

* update node-template

* move memory backend into test helper mode

* move test helper into client

* starting the big refactor, remove unused functions

* apply_finality

* apply_finality

* replacing more .backend from environment with client directly

* remove .backend from grandpa by using traits

* remove .backend from babe

* remove .backend from tests where it is not needed

* remove .backend from tests

* fixing tests

* fixing tests

* fixing more tests

* fixing tests

* fix all forks test

* fix style

* fixing unnecessary allocation

* remove old test.

* fix service docs

* apply suggestion

* minor clean ups

* turns out the test-helper features actually is being used!

* fixing line length.

* fix line length

* minor cleaning

* Apply suggestions from code review

thanks, @Basti

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

* address grumbles

* simplify finalize block on client

* move block back into inner function

* Apply suggestions from code review

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

* use as.ref instead of match

* Update core/client/src/backend.rs

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>
2019-08-30 02:20:26 +02:00
André Silva 574f68fd7e im-online: use generic crypto (#3500)
* im-online: support using ed25519 and sr25519 crypto

* app-crypto: add trait bounds to RuntimePublic::Signature

* im-online: add missing type annotations

* authority-discovery: depend on im-online module and use its crypto

* node: set i'm online crypto to sr25519

* node: bump spec_version

* rpc: don't generate i'm online pubkey in insert_key method

* im-online: fix docs

* im-online: move app crypto packages

* aura: move app crypto packages
2019-08-28 14:46:52 +02:00
André Silva 895c872a09 aura: keystore is required for authoring (#3449) 2019-08-21 16:42:04 +02:00
Max Inden 2c0e73b78c srml/authority-discovery: Introduce srml module to sign and verify (#3385)
In order to have authorities (validators) discover each other, they need
to publish their public addresses by their ip address on the Kademlia
Dht indexed by their public key. This payload needs to be signed by a
key identifying them as a valid authority.

Code inside `/core` does not know the current set of authorities nor
can it assume what kind of cryptography primitives are currently in use.
Instead it can retrieve its public key and the current set of
authorities from the runtime and have it sign and verify Dht payloads.

This commit enables code in `/core` to do so by introducing a srml
module and runtime api to:

1. Retrieve own public key.

2. Retrieve public keys of current authority set.

3. Sign a Dht payload.

4. Verify a Dht payload.

This commit makes the logic from the previous commit
(`core/consensus/common/primitives.ConsensusApi`)
cf80af9255 obsolete and thus removes it.
2019-08-20 17:39:14 +02:00
Svyatoslav Nikolsky 6fb721e861 Value lifetime is returned from blockchain cache (#3403)
* value range in blockchain cache

* revert me (testing for spurious failure)

* Revert "revert me (testing for spurious failure)"

This reverts commit 21a4a3cf5ee14e003541b779c41351e4f5e1122a.
2019-08-19 13:44:16 +02:00
Bastian Köcher 310987ab73 Implements FindAuthor<u32> for srml-aura (#3426)
* Implements `FindAuthor<u32>` for `srml-aura`

* Update lib.rs

* Build
2019-08-17 19:41:29 +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
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
Pierre Krieger be732a2d68 Update to libp2p 0.12 (#3408) 2019-08-15 16:41:39 +02:00
André Silva 6058207935 consensus: refactor aura and babe proposer (#3377) 2019-08-15 08:20:39 +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 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
Bastian Köcher d1161b7d36 Switch AuRa to dynamic keystore lookup (#3359) 2019-08-09 23:10:53 +01: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
Pierre Krieger 97febf4c30 Make Verifier::verify mutable (#3165)
* Make Verifier::verify mutable

* Fix GrandPa tests

* Fix doctest

* Fix more doctests
2019-08-07 21:21:44 +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