* 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
* 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
* 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
* 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>
* 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
* 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.
* 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>
* 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
`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.
* 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>
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.
* value range in blockchain cache
* revert me (testing for spurious failure)
* Revert "revert me (testing for spurious failure)"
This reverts commit 21a4a3cf5ee14e003541b779c41351e4f5e1122a.
* 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
* 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
* 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
* 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.