Commit Graph

2289 Commits

Author SHA1 Message Date
Bastian Köcher d81df14391 Make node-template-release create a workspace (#3484) 2019-08-27 07:43:10 +02:00
Svyatoslav Nikolsky 8f29199076 init cache on restart (#3486) 2019-08-26 20:30:09 +02:00
joe petrowski b80e611218 fix typos in readme (#3481) 2019-08-26 10:56:00 +02:00
Andrew Jones aae31831fb Custom deserialize impl for ApisVec (#3471) 2019-08-26 09:37:42 +02:00
Xiliang Chen da03850eed add Copy to Moment type (#3476)
* add Copy to Moment type

* bump version

* add Copy to support::Traits::Time::Moment and removed few clones
2019-08-25 12:57:31 +02:00
Gavin Wood 672e62fe0f Allow root to force transfers (#3475)
* Allow root to force transfers

* Bump version

* Avoid changing pre-existing encodings
2019-08-24 20:12:29 +02:00
Kian Paimani c14afe4352 Clean runtime constants (#3459)
* Remove bogus constants.

* Bump.
2019-08-24 18:00:26 +02:00
Svyatoslav Nikolsky e9273329ae fix digest in check_execution_proof (#3469) 2019-08-24 17:42:57 +02:00
thiolliere a528b7dc56 improve error msg on wrong closure signature (#3467) 2019-08-24 17:41:45 +02:00
Robert Habermeier b50596428e GRANDPA links set IDs to sessions. (#3472)
* introduce some type aliases for round and set-id

* overhaul session "changed" flag and document better

* do_initialize in BABE when getting new session

* grandpa module tracks set IDs

* update runtime versions

* doc comment -> comment

* Include docs fixes from Gav

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

* some more review changes

* fix srml-grandpa compilation
2019-08-24 17:17:01 +02:00
Bastian Köcher bdd6bba20a Show the available key management RPC calls in README (#3474)
* Show the available key management RPC calls in README

* minor fixes
2019-08-24 11:53:44 +02:00
Tomasz Drwięga 7df089241c Implement HTTP request in offchain workers (#3461)
* Implement HTTP request in offchain workers

* Bump impl_version

* Don't compile offchain workers for WASM anymore

* Initialize HttpConnector as a fallback.

* Apply review suggestions 😳
2019-08-24 06:54:14 +02:00
Tomasz Drwięga 986876e174 Pluralise newHead (#3463) 2019-08-24 06:52:22 +02:00
thiolliere a3e2a710c8 Fix linkemap swap (#3468)
* fix linkedmap swap

* version bump
2019-08-24 06:51:40 +02:00
André Silva 725aa0aec8 grandpa: observer doesn't send catch up messages (#3460)
* grandpa: don't send catch up requests when running GRANDPA observer

* grandpa: fix tests

* grandpa: add tests for catch up requests
2019-08-23 15:13:01 +02:00
Kian Paimani 94243e66b3 Remove MakePayment and introduce SignedExtension docs/examples (#3464)
* New doc for signed extensions.

* Cleanup.

* review nits.
2019-08-23 14:12:39 +02:00
Marcio Diaz 9c4843315c Fix cargo description. (#3458) 2019-08-22 12:45:48 +02:00
thiolliere 716e6fa7f4 avoid silent ignore (#3450) 2019-08-22 11:49:22 +02:00
André Silva 5359206aae grandpa: validate honest out of scope catch ups are for the previous set (#3453) 2019-08-22 10:35:45 +02:00
thiolliere 2f3e7cbe80 decl_module doc (#3451) 2019-08-21 17:38:41 +02:00
thiolliere 591e27e4ab typo (#3455) 2019-08-21 17:35:08 +02:00
Jim Posen 974b341b14 srml-contracts: Apply contract removals immediately (#3417)
* Add ability to destroy a contract in the overlay.

* Don't allow contracts to be destroyed in recursive execution.

* Tests for contract self-destruction.

* Don't allow constructor to exit with insufficient balance.

* Remove dead code.

* Bump node runtime spec version.
2019-08-21 16:44:27 +02:00
André Silva 895c872a09 aura: keystore is required for authoring (#3449) 2019-08-21 16:42:04 +02:00
Toralf Wittner 43c3a682e0 Update soketto to version 0.2.3 (#3448)
This version fixes an issue with lifetime elision which causes
compilation to fail on recent rustc versions (e.g. 1.39.0-nightly
(bea0372a1 2019-08-20)).

See https://github.com/paritytech/soketto/pull/1 for more information.
2019-08-21 16:41:45 +02:00
Bryant Eisenbach f3649e3856 docs: Added more correct documentation for using genesis config (#3445) 2019-08-20 20:34:18 +02:00
André Silva 6876c50af8 sync: don't return on fork tree revert (#3444) 2019-08-20 20:32:26 +02:00
Robert Habermeier 320fb38a2f pay out slashes to the treasury (#3446) 2019-08-20 20:32:14 +02:00
thiolliere 71cee78d85 Fix srml-balance burn implementation (#3443)
* tests

* fix

* bump version
2019-08-20 20:32:00 +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
André Silva 5ff10aece8 grandpa: don't recreate SharedVoterSetState (#3441) 2019-08-20 13:01:24 +02:00
Tomasz Drwięga 56296386ab Custom RPC implementation for node. (#3109)
* Allow RPCs to be customized.

* Implement node-rpc extensions.

* Working on a test.

* Add node-testing crate.

* Fix genesis test config

* Fix nonce lookups.

* Clean up.

* Fix expected block type.

* Make the RPC extension function optional.

* Fix service doc test.

* Bump jsonrpc.

* Bump client version.

* Update Cargo.lock

* Update jsonrpc.

* Fix build.

* Remove unused imports.

* Fix signed extra.

* Post merge clean up.

* Fix tests.

* Patch hashmap-core.

* Fix build.

* Fix build.

* Remove hashmap_core patches.
2019-08-20 11:06:35 +02:00
cheme 95abffc8e4 Update trie crate to hashbrown usage. (#3440)
* Update trie crate to non hashmap_core one.

* bump runtime impl.
2019-08-19 15:59:36 +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
André Silva 68fd94028f grandpa: fix finalization race condition (#3437)
* network: handle safe fork_tree::revert errors

* grandpa: deal with race conditions on finality

* network: return on fork_tree revert
2019-08-19 13:40:36 +02:00
Bastian Köcher 3b0af8bbf4 Do not call externalities without Ext being set (#3436)
* Do not call externalities without `Ext` being set

* Fix compare and set

* Bump runtime version.

* Bump hashmap_core
2019-08-19 12:52:39 +02:00
Michael Müller 017752df41 Introduce srml/scored-pool (#3381)
* Introduce srml/scored-pool

* Bump impl_version

* Apply suggestions from code review

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

* Remove unnecessary pub use

* Remove unnecessary import

* Adapt to InitializeMembers

* Bump impl_version

* Implement remarks (shortens code)

* Improve complexity of score()

Search and remove and search again for the
new spot and insert then => O(2LogN).

* Get rid of a clone()

* Reduce complexity of issue_candidacy()

* Add CandidateScored event + Improve comments

* Fix naming

* Use Lookup instead of AccountId as param

* Use set_members_sorted instead of computing diff

* Remove function which is only used during genesis

* Get rid of rev() by changing sort order of Pool

* Rename issue_candidacy to submit_candidacy

* Shorten code

* Remove find_in_pool() and have transactor submit index

* Remove unnecessary dependency

* Improve error messages

* Improve naming

* Improve comments

* Make code clearer wrt which receiver to invoke

* Adapt to new system trait

* Refactor to request CandidateDeposit only once

* Refactor to request Pool only once

* Improve structure and comments
2019-08-19 09:26:21 +02:00
Gautam Dhameja 0bb44f5024 Make node-template in sync with node. (#3422)
* Make node-template in sync with node.

* Update service.rs

* Updated babe constants.

* Added SignedExtra for CheckVersion in node-template and subkey.

* Added CheckVersion SignedExtra for node.

* Fixed tests.

* Try fix integration test.

* Attempt 2 at fixing integration test.

* Update node-template/runtime/src/lib.rs
2019-08-19 09:17:33 +02:00
André Silva 8eacdb54de client: refuse to import blocks that revert finality (#3432)
* client: don't import blocks that revert finality

* client: test import of blocks that revert finality

* client: replace tempdir with tempfile in test
2019-08-18 18:05:16 +02:00
Gavin Wood 6c5fbe64ca Signed transactions now have affinity with runtime versions (#3430)
* Signed transactions now has affinity with runtime versions

* Bump runtime version
2019-08-18 18:01:05 +02:00
Kian Paimani 0e56b56a86 Proper loser handling in approval election. (#3392)
* Fix how we treat loser candidates.

* Bump.

* Improve doc.

* Update srml/elections/src/lib.rs

* Fix test
2019-08-17 22:43:21 +02:00
Kian Paimani a3618ef197 Fix staking tests (#3428)
* Fix staking tests.
2019-08-17 20:10:53 +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
Bastian Köcher a0f2e9b396 Move checks for renamed functions to __check_reserved_function_names (#3425)
* Move checks for renamed functions to `__check_reserved_function_names`

* Fix trybuild test
2019-08-17 01:14:21 +02:00
Tomasz Drwięga 6cc4495700 Offences reporting and slashing (#3322)
* Remove offline slashing logic from staking.

* Initial version of reworked offence module, can report offences

* Clean up staking example.

* Commit SlashingOffence

* Force new era on slash.

* Add offenders in the SlashingOffence trait.

* Introduce the ReportOffence trait.

* Rename `Offence`.

* Add on_before_session_ending handler.

* Move offence related stuff under sr-primitives.

* Fix cargo check.

* Import new im-online implementation.

* Adding validator count to historical session storage as it's needed for slash calculations

* Add a comment about offence.

* Add BabeEquivocationOffence

* GrandpaEquivocationOffence

* slash_fraction and fix

* current_era_start_session_index

* UnresponsivnessOffence

* Finalise OnOffenceHandler traits, and stub impl for staking.

* slash_fraction doesn't really need &self

* Note that offenders count is greater than 0

* Add a test to ensure that I got the math right

* Use FullIdentification in offences.

* Use FullIndentification.

* Hook up the offences module.

* Report unresponsive validators

* Make sure eras have the same length.

* Slashing and rewards.

* Fix compilation.

* Distribute rewards.

* Supply validators_count

* Use identificationTuple in Unresponsivness report

* Fix merge.

* Make sure we don't slash if amount is zero.

* We don't return an error from report_offence anymo

* We actually can use vec!

* Prevent division by zero if the reporters is empty

* offence_forces_new_era/nominators_also_get_slashed

* advance_session

* Fix tests.

* Update srml/staking/src/lib.rs

Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>

* slashing_performed_according_exposure

* Check that reporters receive their slice.

* Small clean-up.

* invulnerables_are_not_slashed

* Minor clean ups.

* Improve docs.

* dont_slash_if_fraction_is_zero

* Remove session dependency from offences.

* Introduce sr-staking-primitives

* Move offence under sr_staking_primitives

* rename session_index

* Resolves todos re using SessionIndex

* Fix staking tests.

* Properly scale denominator.

* Fix UnresponsivnessOffence

* Fix compilation.

* Tests for offences.

* Clean offences tests.

* Fix staking doc test.

* Bump spec version

* Fix aura tests.

* Fix node_executor

* Deposit an event on offence.

* Fix compilation of node-runtime

* Remove aura slashing logic.

* Remove HandleReport

* Update docs for timeslot.

* rename with_on_offence_fractions

* Add should_properly_count_offences

* Replace ValidatorIdByIndex with CurrentElectedSet

ValidatorIdByIndex was querying the current_elected set in each call, doing loading (even though its from cache), deserializing and cloning of element.

Instead of this it is more efficient to use `CurrentElectedSet`. As a small bonus, the invariant became a little bit easier: now we just rely on the fact that `keys` and `current_elected` set are of the same length rather than relying on the fact that `validator_id_by_index` would work similar to `<[T]>::get`.

* Clarify babe equivocation

* Fix offences.

* Rename validators_count to validator_set_count

* Fix squaring.

* Update core/sr-staking-primitives/src/offence.rs

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

* Docs for CurrentElectedSet.

* Don't punish only invulnerables

* Use `get/insert` instead of `mutate`.

* Fix compilation

* Update core/sr-staking-primitives/src/offence.rs

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

* Update srml/offences/src/lib.rs

Co-Authored-By: Robert Habermeier <rphmeier@gmail.com>

* Update srml/im-online/src/lib.rs

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

* Update srml/im-online/src/lib.rs

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

* Update srml/im-online/src/lib.rs

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

* Update srml/babe/src/lib.rs

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

* Update core/sr-staking-primitives/src/offence.rs

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

* Update core/sr-staking-primitives/src/offence.rs

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

* Update core/sr-staking-primitives/src/offence.rs

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

* Update core/sr-staking-primitives/src/offence.rs

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

* Update core/sr-staking-primitives/src/offence.rs

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

* Add aura todo.

* Allow multiple reports for single offence report.

* Fix slash_fraction calculation.

* Fix typos.

* Fix compilation and tests.

* Fix staking tests.

* Update srml/im-online/src/lib.rs

Co-Authored-By: Logan Saether <x@logansaether.com>

* Fix doc on time_slot

* Allow slashing only on current era (#3411)

* only slash in current era

* prune journal for last era

* comment own_slash

* emit an event when old slashing events are discarded

* Pave the way for pruning

* Address issues.

* Try to refactor collect_offence_reports

* Other fixes.

* More fixes.
2019-08-16 19:54:50 +02:00
André Silva 99f3f07690 node: update flaming fir (#3424)
* node: update staging testnet authorities

* node: update flaming fir chain spec
2019-08-16 19:09:18 +02:00
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
Sergei Pepyakin f735d067c4 Respect heap_pages parameter. (#3420) 2019-08-16 15:33:22 +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
Tomasz Drwięga c94e0f28b4 Reject transactions with no provides tags. (#3416) 2019-08-16 11:52:47 +02:00