Commit Graph

105 Commits

Author SHA1 Message Date
Michael Müller a706d994cb Transaction factory (#2481)
* Fix typos

* Add transaction factory

`cargo run -- purge-chain -y --chain dev && cargo run -- --dev --transaction-factory 10`

* Fix comment and remove build deps

* Move crate to test-utils

* Switch from flag to subcommand

`cargo run -- factory --dev --num 5`

* Decouple factory from node specifics

* Introduce different manufacturing modes

* Remove unrelated changes

* Update Cargo.lock

* Use SelectChain to fetch best block

* Improve expect proof

* Panic if factory executed with unsupported chain spec

* Link ToDo comments to follow-up ticket

* Address comments and improve style

* Remove unused dependencies

* Fix indent level

* Replace naked unwrap

* Update node/cli/src/factory_impl.rs

* Fix typo

* Use inherent_extrinsics instead of timestamp

* Generalize factory and remove saturated conversions

* Format imports

* Make it clearer that database needs to be empty

* Ensure factory settings

* Apply suggestions from code review

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

* Update test-utils/transaction-factory/src/lib.rs

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

* Fix match guard syntax

* Simplify import, remove empty line

* Update node/cli/Cargo.toml

* Update lockfile
2019-05-28 17:01:43 +02:00
Benjamin Kampmann 22d3043917 Silence known deprecation warnings (#2651)
* Silence known deprecation warnings

1. Prefixes known instances of usages of client.backend and client.import_lock with `#[allow(deprecated)]` to silence the warnings. 2. Remove file-global `#![allow(deprecated)]` used in these cases. Both to prevent us overlooking externally caused deprecation messages.

* fixing missing ;

* fix missing test cases

* move deprecated markers to make CI happy

* move deprecated markers to make CI happy

* attempt to fix the test

* bumping impl_version of node runtime

* Minor cleanup
2019-05-28 10:34:59 +02:00
Tomasz Drwięga c162fc5ff1 Expunge error-chain (feat. tomaka) (#2662)
* Remove error_chain

* Expunge error-chain from rpc and service.

* Expunge from transaction pool.

* Expunge from node/cli

* Expunge from keystore.

* Remove some boilerplate.

* Fix remaining stuff.

* Improve on deprecation message.

* Fix issues.

* Fix trnsaction pool tests.

* Fix the rest.

* Fix borked merge.

* Update lock
2019-05-24 10:35:31 +01:00
Pierre Krieger 6431cdf601 Remove TaskExecutor from the API of the informant (#2642)
* Remove TaskExecutor from the API of the informant

* Fix node-template
2019-05-23 09:44:36 +01:00
thiolliere aa2c496a65 Make perthings operate in type operator (#2501)
* perthings operate in type operator

* implementation with rem

* fmt

* doc

* better fmt

* bump version

* Tests for pet-things

* demonstrate output as type of operation

* Remove redundant assertions.

* rename test

* update lock

* bump impl version
2019-05-15 18:48:58 +02:00
André Silva e0a6a1f55a node: set protocol id for flaming fir (#2589) 2019-05-15 18:14:52 +02:00
Pierre Krieger 0d0fe6a0ea Add WebSocket addresses for bootnodes (#2578) 2019-05-14 16:30:16 +02:00
Svyatoslav Nikolsky 9a14ba0555 Fix light client startup (build_select_chain returns Result<Option>) (#2574)
* fix light client strtup (build_select_chain -> Option)

* fixed node template compilation

* Update core/service/src/lib.rs

Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com>
2019-05-14 12:38:30 +01:00
André Silva 132984adf5 Introduce Flaming Fir testnet (#2526)
* node: replace emberic elm with flaming fir testnet

* update readme
2019-05-14 12:11:25 +02:00
Svyatoslav Nikolsky 22586113ea Light GRANDPA import handler (#1669)
* GrandpaLightBlockImport

* extract authorities in AuraVerifier

* post-merge fix

* restore authorities cache

* license

* new finality proof draft

* generalized PendingJustifications

* finality proof messages

* fixed compilation

* pass verifier to import_finality_proof

* do not fetch remote proof from light import directly

* FinalityProofProvider

* fixed authorities cache test

* restored finality proof tests

* finality_proof docs

* use DB backend in test client

* justification_is_fetched_by_light_client_when_consensus_data_changes

* restore justification_is_fetched_by_light_client_when_consensus_data_changes

* some more tests

* added authorities-related TODO

* removed unneeded clear_finality_proof_requests field

* truncated some long lines

* more granular light import tests

* only provide finality proof if it is generated by the requested set

* post-merge fix

* finality_proof_is_none_if_first_justification_is_generated_by_unknown_set

* make light+grandpa test rely on finality proofs (instead of simple justifications)

* empty_finality_proof_is_returned_to_light_client_when_authority_set_is_different

* missing trait method impl

* fixed proof-of-finality docs

* one more doc fix

* fix docs

* initialize authorities cache (post-merge fix)

* fixed cache initialization (post-merge fix)

* post-fix merge: fix light + GRANDPA tests (bad way)

* proper fix of empty_finality_proof_is_returned_to_light_client_when_authority_set_is_different

* fixed easy grumbles

* import finality proofs in BlockImportWorker thread

* allow import of finality proofs for non-requested blocks

* limit number of fragments in finality proof

* GRANDPA post-merge fix

* BABE: pos-merge fix
2019-05-13 11:36:52 +02:00
André Silva 9d23d2a25a Bump master to v2.0.0 (#2514)
* bump crates to v2.0.0

* fix crate authors

* bump node runtime spec_version

* remove unused import for no-std
2019-05-10 16:55:15 +02:00
Benjamin Kampmann 18ca0170c3 Allow for customisation of chain selection systems (#2240)
* move SelectChain trait out of client

* Extend SelectChain, move longest chain implementation into it

* Bring SelectChain into service

* implement LongestChain SelectChain

* implement longest chain for node

* update Cargo.lock's

* in between erroring tests

* deprecate ::backend and ::import_lock

* Remove unneded space

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

* Remove unneded space

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

* Fixes test compilation

* remove todo

* re-enable client test

* add doc

* fixing tests

* Clarify SelectChain Interface, intended implementation and usage

* minor components cleanups

* minor cleanups

* Update lock files

* Implement cleaner interface for SelectChain

* addressing comments

* Updating tests

* bump node runtime impl version

* address grumbles
2019-05-10 14:08:12 +02:00
Xiliang Chen ef142722e3 Pass RunCmd to user (#2425) 2019-05-01 20:08:17 +02:00
thiolliere c7d9ca379d Contract accounting removal (#2230)
* first partial implementation

* update rent allowance

* fmt

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

* remove comments

* reward surcharge claims

* remove rent allowance in param + code_hash changed

* Fix bug

* fix tests

* fmt

* impl getter setter rent allowance

* fmt

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

* comments

* doc + be->le

* doc

* doc

* fix improve fast return

* renamings

* rename + COMPLEXITY

* COMPLEXITY

* add test

* etrinsic claim surcharge delay configurable

* comment addressed

* move and rewrite of pay_rent

* remove child trie

* fmt

* use derive

* arithmetic operation

* fix

* fix storage root + checked_mul + test

* WIP: test

* WIP

* add tests and fix

* fmt

* typo and doc suggestions

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

* WIP

* address some comments

divide tests + some docs

* use br_table

* remove unused function

* Bump the runtime version

* insert_with

* Add some comments.

* Refactor

* Shuffle and fix comments

* More comment fixes.

* dues limited

* Add comment

* Handicap

* Docs.

* Apply suggestions from code review

Co-Authored-By: pepyakin <s.pepyakin@gmail.com>

* Coalesce block_passed in a block

* Fix build

* Paid → Ok

* match → if

* Imrpove handicap description
2019-04-30 09:41:33 +02:00
Stanislav Tkach 0f02bed702 Update hex-literal version, simplify imports and remove unused dependencies (#2371) 2019-04-25 11:17:40 +02:00
Mokhtar Naamani bd6427a268 set reasonable value for bonding_duration in chainspec staging config (#2289)
* set reasonable value for bonding_duration in chainspec staging config

* set default bonding_duration to 1, and bump runtime version

* Update node/cli/src/chain_spec.rs

Co-Authored-By: mnaamani <mokhtar.naamani@gmail.com>

* Update node/cli/src/chain_spec.rs

Co-Authored-By: mnaamani <mokhtar.naamani@gmail.com>

* Update srml/staking/src/lib.rs

Co-Authored-By: mnaamani <mokhtar.naamani@gmail.com>
2019-04-23 22:26:09 +02:00
Michael Müller 87776e63bb Adjust consensus telemetry (#2198)
* Send high-level consensus telemetry by default

* Notify telemetry on finalized

* Send used authority set to telemetry

* Do not send commit message telemetry by default

* Fix typo

* Allow for notifications on telemetry connect

...and send the current authority set on each connect.

* Send authority set to telemetry on change

* Revert "Send used authority set to telemetry"

This reverts commit 1deceead52bb7443a02879ac8138afad9a6ca5ff.

* Merge branch 'master' into 'cmichi-send-high-level-consensus-telemetry-by-default'

Squashed commit of the following:

commit 19d77cbc23
Author: Xiliang Chen <xlchen1291@gmail.com>
Date:   Wed Apr 10 20:26:29 2019 +1200

    update authers for rest of the node-template cargo.toml files (#2242)

commit 0afc357a97
Author: Bastian Köcher <bkchr@users.noreply.github.com>
Date:   Tue Apr 9 10:31:18 2019 +0200

    Throw a compile error for `on_finalise` and `on_initialise` (#2236)

commit e57e54ab9c
Author: Pierre Krieger <pierre.krieger1708@gmail.com>
Date:   Tue Apr 9 05:30:43 2019 -0300

    Add warning when using default protocol ID (#2234)

    * Add warning when using default protocol ID

    * Update core/service/src/lib.rs

commit cb766e5f5d
Author: Xiliang Chen <xlchen1291@gmail.com>
Date:   Tue Apr 9 17:22:20 2019 +1200

    update name and authors to placeholder text for node-template (#2222)

    * update name and authors to placeholder text

    * revert package name change

commit a1e15ae55a
Author: André Silva <andre.beat@gmail.com>
Date:   Mon Apr 8 12:50:34 2019 +0100

    grandpa: Voter persistence and upgrade to finality-grandpa v0.7 (#2139)

    * core: grandpa: migrate to grandpa 0.7

    * core: grandpa: store current round votes and load them on startup

    * core: grandpa: resend old persisted votes for the current round

    * core: grandpa: store base and votes for last completed round

    * core: grandpa: fix latest grandpa 0.7 changes

    * core: grandpa: update to grandpa 0.7.1

    * core: grandpa: persist votes for last two completed rounds

    * core: grandpa: simplify VoterSetState usage

    * core: grandpa: use Environment::update_voter_set_state

    * core: grandpa: fix aux_schema test

    * core: grandpa: add docs

    * core: grandpa: add note about environment assumption

    * core: grandpa: don't update voter set state on ignored votes

    * core: grandpa: add test for v1 -> v2 aux_schema migration

    * core: grandpa: add test for voter vote persistence

    * core: grandpa: use grandpa 0.7.1 from crates.io

    * core: grandpa: use try_init in test

    * core: grandpa: add comment about block_import in test

    * core: grandpa: avoid cloning HasVoted

    * core: grandpa: add missing docs

    * core: grandpa: cleanup up can_propose/prevote/precommit

commit ed3ae4ac39
Author: Gregory Terzian <2792687+gterzian@users.noreply.github.com>
Date:   Mon Apr 8 13:17:00 2019 +0200

    remove clone bound on specialization in testnet factory (#2157)

commit 03f3fb1442
Author: Andrew Jones <ascjones@gmail.com>
Date:   Sat Apr 6 12:23:56 2019 +0100

    Contract import/export validation (#2203)

    * Reject validation of contract with unknown exports

    * Validate imports eagerly

    * Increment spec version

commit decddaab0f
Author: Pierre Krieger <pierre.krieger1708@gmail.com>
Date:   Fri Apr 5 14:07:09 2019 -0300

    Fix state inconsistency between handler and behaviour (#2220)

    * Fix state inconsistency between handler and behaviour

    * Fix the error! being in the wrong place

commit dce0b4ea49
Author: Bastian Köcher <bkchr@users.noreply.github.com>
Date:   Fri Apr 5 18:50:38 2019 +0200

    Use `storage_root` of newly calculated header (#2216)

    Instead of calculating the `storage_root` a second time, we just can
    take the `storage_root` from the new header.

commit b01136c90d
Author: Marek Kotewicz <marek.kotewicz@gmail.com>
Date:   Fri Apr 5 14:44:46 2019 +0200

    Peerset::discovered accepts many peer ids (#2213)

    * Peerset::discovered accepts many peer ids

    * Improve tracing in peerset

commit 1142bcde97
Author: Marek Kotewicz <marek.kotewicz@gmail.com>
Date:   Thu Apr 4 19:40:40 2019 +0200

    simplification of peerset api (#2123)

    * Introduction of PeersetHandle

    * integrate PeersetHandle with the rest of the codebase

    * fix compilation errors

    * more tests for peerset, fixed overwriting bug in add_reserved_peer

    * Slots data structure and bugfixes for peerset

    * bend to pressure

    * updated lru-cache to 0.1.2 and updated linked-hash-map to 0.5.2

    * peerset discovered list is now a LinkedHashMap

    * fix review suggestions

    * split back Peerset and PeersetHandle

    * test for Peerset::discovered

    * applied review suggestions

    * fixes to peerset::incoming

    * peerset disconnects are all instantaneous

    * instantaneous drop in peerset finished

    * Peerset::set_reserved_only can also reconnect nodes

    * Peerset scores cache uses lru-cache

    * remove redundant function call and comment from Peerset::on_set_reserved_only

    * add_peer returns SlotState enum

    * apply review suggestions

    * is_reserved -> is_connected_and_reserved

commit 301844dd56
Author: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Date:   Thu Apr 4 18:01:28 2019 +0200

    Disconnect on protocol timeout (#2212)

commit cb3c912b1a
Author: André Silva <andre.beat@gmail.com>
Date:   Thu Apr 4 15:56:49 2019 +0100

    core: grandpa: verify commit target in justification (#2201)

commit 6920b169cd
Author: Bastian Köcher <bkchr@users.noreply.github.com>
Date:   Thu Apr 4 16:56:16 2019 +0200

    Introduce `original_storage` and `original_storage_hash` (#2211)

    Both functions will ignore any overlayed changes and access the backend
    directly.

commit cb7a8161f5
Author: Xiliang Chen <xlchen1291@gmail.com>
Date:   Fri Apr 5 03:55:55 2019 +1300

    code cleanup (#2206)

commit acaf1fe625
Author: Arkadiy Paronyan <arkady.paronyan@gmail.com>
Date:   Wed Apr 3 15:52:46 2019 +0200

    Emberic elm testnet (#2197)

* Make telemetry onconnect hoook optional

* Merge branch 'master' into 'cmichi-send-high-level-consensus-telemetry-by-default'

* Introduce GrandpaParams struct to condense parameters

* Remove debug statement

* Fix tests

* Rename parameter

* Fix tests

* Rename struct

* Do not send verbosity level

* Combine imports

* Implement comments

* Run cargo build --all

* Remove noisy telemetry

* Add docs for public items

* Unbox and support Clone trait

* Fix merge

* Fix merge

* Update core/finality-grandpa/src/lib.rs

Co-Authored-By: cmichi <mich@elmueller.net>
2019-04-23 15:49:28 +02:00
André Silva e31cd26a9e grandpa: observer (#2244)
* grandpa: initial implementation of minimal grandpa worker

* grandpa: extract grandpa observer future to function

* grandpa: add test for observer

* grandpa: start observer if no local key is defined

* grandpa: add minor comments

* grandpa: observer: log invalid commit

* grandpa: observer: persist voter set state on authority change and pause

* grandpa: observer: use commit processing callback

* grandpa: keep run_grandpa to avoid breaking public api

* grandpa: use grandpa::process_commit_validation_result

* grandpa: use finality-grandpa 0.7.2
2019-04-17 16:50:38 +02:00
Andrew Jones 1e0c1d8850 Introduce ext_println to contract runtime (#2239)
* Implement `ext_println` in contract runtime

* Only allow contracts to import `ext_println` on dev chains

* Configure dev chain to allow contracts with `ext_println`

* Increment spec version

* Docs

* Rename config to the more specific enable_println
2019-04-11 15:49:17 +02:00
Arkadiy Paronyan acaf1fe625 Emberic elm testnet (#2197) 2019-04-03 15:52:46 +02:00
Robert Habermeier bb95e7d6a2 Initial version of the polite-grandpa networking protocol (#2110)
* Consensus status packet

* Allow for repropagation after status

* More generic gossip

* add a basic view struct and gossip module

* move gossip stuff to the gossip module

* integrate view into gossip

* some reshuffling

* alter rules for keeping one commit at a time in view

* Allow sending addressed messages

* don't cast outgoing votes if we know that we voted before

* Handle one hop messages

* initial run at polite grandpa

* build WASM

* handle neighbor messages

* refactor validator's internals into an Inner struct

* gossip only knows to keep or discard messages. optimize should_send_to

* Periodic rebroadcast

* implement `should_send_to` and message_expired

* track peers' best received commit height

* Pass peer id to topic steam

* kill rebroadcasting network

* Notify about existing peers

* clean up network APIs a bunch

* implement gossip::send_message for direct messages

* refactor network trait

* implement gossip::send_message for direct messages

* get all non set-change tests passing

* treat unknown rebroadcasts as broadcasts

* get all other main tests passing

* remove unimplemented test

* everything compiles

* treat unknown rebroadcasts as broadcasts

* Rebradcast interval

* Apply suggestions from code review

Style

Co-Authored-By: arkpar <arkady.paronyan@gmail.com>

* Style

* some module docs

* address some grumbles + docs

* allow rebroadcast every few minutes

* send_topic && generic context

* some tests for view change

* more grumbles & tests

* use send_peer
2019-04-02 18:09:05 +02:00
Robert Habermeier f0c21815b3 Aura: add a deprecated method for seal compatibility (#2176)
* aura API defaults to rejecting old seals

* build node-cli
2019-04-02 17:19:50 +02:00
thiolliere 7e3b2d464a skip phantom for decl_event (#2158)
* use parity-codec-derive from parity-codec everywhere

* codec v3.2 -> v3.3

* skip phantom when deriving event

* fix decl_module call

* update impl version of node + builds
2019-04-02 12:04:23 +02:00
Gav Wood eca163ba64 Bump version to 1.0.0 globally (#2149)
* Bump versionb globally

* Rebuild and fix

* Rename fixes

* Rebuild

* Minor fix and code formatting for validator election

* Fix tests

* More test fixes

* Fix several bugs in phragmen elections.

* Rebuild, remove pointless closures
2019-04-01 15:16:06 +02:00
joe petrowski 0ddcbf747f Convert all UK spelling to US (#2138)
* all the ise

* forgot a misspelling

* a few more replacements

* bump impl

* rollback and fixes

* bump impl again

* Add aliases for RPC

* Update on_demand.rs
2019-03-29 14:11:45 +01:00
DemiMarie-parity a10e86ba5a Refactor DigestItem (#2108)
* Add `start_aura2`.

* .gitignore patch conflict files

and remove one that accidentally got committed

* Fix build

The tests still don’t work.

* Fix compilation errors

* Fix compile errors (again)

* Try (and fail) to fix tests

* Properly deserialize data

Previously, `DigestItem::Consensus` had no separate `DigestItemType`,
so it did not get properly serialized and deserialized.

* Add extra debug logging.  Always allow old seals.

A `RUST_LOG=substrate_aura_consensus cargo test --all -- --nocapture \
tests::authoring_blocks` revealed that old seals were being and
rejected, causing the test to hang.  As a temporary debug measure, allow
old seals unconditionally, so that CI can test if this fixes the
problem.

* Forcibly disable rejection of old seals

* Use old trait, but newer serialization

The old trait for `CompatibleDigestItem` actually worked.  By changing
its implementation, one can ensure that all *new* seals have the modern
form, but *legacy* seals are still decoded correctly.

* Bump impl version

* Squash spurious deprecation warning

`rustc` should not be emitting a deprecation warning in deprecated
code, but it does, so silence it.

* Rip out unused Cargo feature

* Move AURA to aura_primitives

* Respond to code review

* Wrap overly-long line

* Reduce logging verbosity and add target

* Add dependency on `sr-primitives` to `aura_primitives`

* Fix build

It failed with a message about Cargo.lock being out of date.

* core: aura: rename aura engine id const

* core: aura: remove superfluous logging

* core: primitives: add removed semicolons

* core: aura: remove unused import

* core: network: style fix

* runtime: update wasm blobs

* runtime: bump impl_version

* core: primitives: tag all DigestItemType variants explicitly
2019-03-29 12:15:23 +00:00
Gav Wood 3f348d0a18 Ensure timestamp config makes sense. (#2132)
* Timestamp period should be expressed as expected period

* Fix test

* Ensure value never illegal

* Rename

* Remove println

* Add default

* Comment

* Fix, bump and rebuild wasm

* Fix test

* Add TODOs

* Configure only minimum_period.

* Fix

* Update srml/timestamp/src/lib.rs

Co-Authored-By: gavofyork <github@gavwood.com>

* Update srml/timestamp/src/lib.rs

Co-Authored-By: gavofyork <github@gavwood.com>
2019-03-28 15:59:59 +01:00
thiolliere 29001cb469 Decouple contract from balances (#2081)
* decouple contract from balance

* update impls and builds

* set fees in contract module

* builds
2019-03-28 13:46:30 +01:00
Tomasz Drwięga e2f5e40876 Initial: Offchain Workers (#1942)
* Refactor state-machine stuff.

* Fix tests.

* WiP

* WiP2

* Service support for offchain workers.

* Service support for offchain workers.

* Testing offchain worker.

* Initial version working.

* Pass side effects in call.

* Pass OffchainExt in context.

* Submit extrinsics to the pool.

* Support inherents.

* Insert to inherents pool.

* Inserting to the pool asynchronously.

* Add test to offchain worker.

* Implement convenience syntax for modules.

* Dispatching offchain worker through executive.

* Fix offchain test.

* Remove offchain worker from timestamp.

* Update Cargo.lock.

* Address review comments.

* Use latest patch version for futures.

* Add CLI parameter for offchain worker.

* Fix compilation.

* Fix test.

* Fix extrinsics format for tests.

* Fix RPC test.

* Bump spec version.

* Fix executive.

* Fix support macro.

* Address grumbles.

* Bump runtime
2019-03-25 23:22:11 +01:00
André Silva e28ff32b89 core: cli flag to disable grandpa (#2105)
* core: cli flag to disable grandpa

* core: fix test service configuration

* Update core/service/test/src/lib.rs
2019-03-25 15:19:36 +00:00
Arkadiy Paronyan c6addc9bd5 CLI option to enable authoring when offline (#2104)
* CLI option to enable authoring when offline

* Update core/service/src/config.rs

Co-Authored-By: arkpar <arkady.paronyan@gmail.com>
2019-03-25 11:28:35 +01:00
Arkadiy Paronyan 90d3fe8913 Reduce grandpa interval for substrate node (#2097) 2019-03-23 12:40:43 +01:00
Kian Peymani 564c954aa7 Self-Vote for Staking (among others.) (#2078)
* initial doc for the staking module

* Remove md style links.

* Remove todos.

* Add rust code types

* Rename and fix review notes.

* Add new md file

* Final touches.

* Migrate compleatly to rustdoc

* Update link

* Fix heading

* Final touches wrt the new template.

* Remove empty prereq.

* Fix more reviews

* Some final nits.

* Fix some side issues.

* Fix another set of reviews

* Fix + stabilize leftover reivews.

* Remove unused test parameters

* Fix typo.

* Merge redundant loops

* Adds phantom self-vote

* Fix broken tests.

* Refactor some names to match the reference.

* Remove redundant inner loops from election round.

* Introduce phragmen post-processing.

* Some fixes and todos.

* Fix some tests with new phragmen params

* Fix test

* Bump spec

* Fix wasm build

* Fix tests and phragmen fallback. Avoid double-controlling

* Fix and rebuild wasm

* Whitespaces, whitespaces everywhere.

* Rebuild

* Disable post-processing.

* Identify by stash, not controller account.

* Couple of fixes

* Fix first test

* Fix invulnerability_should_work

* Fix a couple more tests

* Fix more tests

* Fix more tests

* Fix more tests

* Fix some tests

* Fix update-ledger.

* Fix update-ledger.

* Fix another test

* Fix another test

* Fix rest of staking tests

* Remove printlns

* Rebuild wasm

* Fix & tests for auth/val syncing

* Fix up threading for tests

* Remove superfluous asserts
2019-03-22 21:41:33 +01:00
DemiMarie-parity 000e7a8002 Make AuRa generic over cryptography (#2062)
As is so often the case in Rust, most of the work was fixing compiler
errors and removing spurious type annotations.
2019-03-21 17:26:00 -04:00
Gav Wood dcd77a147c Introduce safe types for handling imbalances (#2048)
* Be a little safer with total issuance.

* PairT instead of _Pair

* Remove rev causing upset

* Remove fees stuff.

* Fix build (including tests)

* Update runtime, bump version

* Fix

* Handle gas refunds properly.

* Rename identifier

ala #2025

* Address grumbles

* New not-quite-linear-typing API

* Slimmer API

* More linear-type test fixes

* Fix tests

* Tidy

* Fix some grumbles

* Keep unchecked functions private

* Remove another less-than-safe currency function and ensure that
contracts module can never create cash.

* Address a few grumbles and fix tests
2019-03-20 14:07:28 +01:00
thiolliere d743a8b71f Implement parameterisable modules (#1800)
* first implementation

* remove done comment

* origin done

* impl log for instance

* impl inherent for instance

* Fix wasm build + full example build

this requires parity codec implements codec for core::marker::PhantomData

* patch parity-codec link to github branch

* improve internal names and fix instance prefix

* Fix in macros

* add test modules for support

this allow to test for construct_runtime as well.

The reason to have put that in another crate is:
* if we put test in `tests/` dir of srml/support then decl_storage fails to get
  srml-support access because it believes it is inside srml-support
  crate and so derive access to `quote!{ crate }` but this is wrong
  (and I don't see any way to prevent that, and it only bother us so I
  don't think that matters that much)
* if we put test inside lib.rs then contruct_runtime cannot be used
  because it call some macros that are defined with macros
  (decl_outer_event and decl_outer_origin) and thus rustc complains.

* defaultinstance to its own struct to avoid errors

* enforce <T, I> for Event and Config, impl test

* add origin, log, inherent to test

* test more code generation

* basic storage test

* fix typo

* rename a few imports and field

* delete wip test in example and runtime

* change default prefix to make it backward compatible with test

* rename Instance to I and Instantiable to Instance

note: the name of generic parameter I is only enforce by decl_module!
and this could be rewritten

* doc

* clean old TODOs

* update parity-codec to 3.2

* update node impl version + builds

* fix warning

* fix unrelated grandpa test

* refactor code
2019-03-15 19:25:18 +01:00
Gav Wood 03d52fdbeb Crypto fixes/improvements (#2008)
* Crypto fixes:

- Use schnorrkel's HDKD derive
- Assume all key URIs beginning with `/` are prefixed with public
  root phrase.

* Remove commented code.

* Update README

* Update core/primitives/src/ed25519.rs

Co-Authored-By: gavofyork <github@gavwood.com>
2019-03-15 13:53:09 +01:00
Kian Peymani b86c96ea31 Phragmén Validator Election (#1915)
* adds first draft phragmen with tuned tests and sr-primitives

* fix a few docs and code styles

* clean, organize and finish remaining test cases

* more and more tests

* update edge cases behavior and relavent tests

* fix global test issues

* updated wasm files

* all tests fixed

* cleanup

* fix some global issues

* fix global tests

* bump versions

* fix typo

* first step toward extracting phragmen

* Fix most of the grumbles.

* fix rest of the grumbles

* spaces to tabs

* update wasm

* Removed nightly feature.

* More tests

* Fix broken tests.

* Bump and update wasm.
2019-03-14 12:23:55 +01:00
Gav Wood d7fcf5dc9d Overhaul crypto (Schnorr/Ristretto, HDKD, BIP39) (#1795)
* Rijig to Ristretto

* Rebuild wasm

* adds compatibility test with the wasm module

* Add Ed25519-BIP39 support

* Bump subkey version

* Update CLI output

* New keys.

* Standard phrase/password/path keys.

* Subkey uses S-URI for secrets

* Move everything to use new HDKD crypto.

* Test fixes

* Ignore old test vector.

* fix the ^^ old test vector.

* Fix tests

* Test fixes

* Cleanups

* Fix broken key conversion logic in grandpa

CC @rphmeier

* Remove legacy Keyring usage

* Traitify `Pair`

* Replace Ed25519AuthorityId with ed25519::Public

* Expunge Ed25519AuthorityId type!

* Replace Sr25519AuthorityId with sr25519::Public

* Remove dodgy crypto type-punning conversions

* Fix some tests

* Avoid trait

* Deduplicate DeriveJunction string decode

* Remove cruft code

* Fix test

* Minor removals

* Build fix

* Subkey supports sign and verify

* Inspect works for public key URIs

* Remove more crypto type-punning

* Fix typo

* Fix tests
2019-03-13 14:08:31 +01:00
Bastian Köcher 17f093da13 Make use of assimilate_storage for GenesisConfig (#1982)
* Make use of `assimilate_storage` for `GenesisConfig`

Fixes incorrect initialization of the staking gensis storage.

* Add some documentation
2019-03-13 12:59:07 +01:00
郭光华 3149136367 Fix telemetry panic error in node-template (#1958) 2019-03-12 13:19:42 +01:00
Bastian Köcher 7927054f86 Update copyrights to 2019 (#1932) 2019-03-06 15:04:28 +01:00
Robert Habermeier dfb48a2405 Offline fallback for GRANDPA (#1619)
Co-authored-by: André Silva <andre.beat@gmail.com>

* skeleton for finality tracker

* dispatch events when nothing finalized for a long time

* begin integrating finality tracker into grandpa

* add delay field to pending change

* add has_api_with function to sr_version for querying APIs

* partially integrate new force changes into grandpa

* implement forced changes

* get srml-grandpa compiling

* Update core/finality-grandpa/src/authorities.rs

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

* Update core/finality-grandpa/src/authorities.rs

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

* Update core/finality-grandpa/src/authorities.rs

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

* remove explicit dependence on CoreApi

* increase node runtime version

* integrate grandpa forced changes into node runtime

* add some tests to finality-tracker

* integrate finality tracking into node-runtime

* test forced-change logic

* test forced changes in the authority-set handler

* kill some unneeded bounds in client

* test forced-changes in finality-grandpa and fix logic

* build wasm and finality-tracker is no-std

* restart voter on forced change

* allow returning custom error type from lock_import_and_run

* extract out most DB logic to aux_schema and use atomic client ops

* unify authority set writing

* implement set pausing

* bump runtime version

* note on DB when we pause.

* core: grandpa: integrate forced changes with multiple pending standard changes

* core: grandpa: fix AuthoritySet tests

* runtime: bump impl_version

* core: clear pending justification requests after forced change import

* srml: finality-tracker: use FinalizedInherentData

* core: log requests for clearing justification requests

* core, node: update runtimes

* core: grandpa: fix tests

* core: grandpa: remove todos and add comments

* core: grandpa: use has_api_with from ApiExt

* core: fix tests

* core: grandpa: remove unnecessary mut modifier

* core: replace PostImportActions bitflags with struct

* core: grandpa: restrict genesis on forced authority set change

* core: grandpa: add more docs

* core: grandpa: prevent safety violations in Environment::finalize_block

* core: grandpa: register finality tracker inherent data provider

* core: grandpa: fix tests

* node: update runtime blobs

* core: grandpa: remove outdated todo

* core: aura: fix typo in log message

* core: grandpa: check re-finalization is on canonical chain

* srml: finality-tracker: fix initialization

* node: update runtime wasm

* srml: finality-tracker: don't re-initialize config keys
2019-03-05 15:41:35 +00:00
Gav Wood 828cd9580a Stash/controller model for staking (#1782)
* First steps to stash/controller separation

* More drafting

* More drafting

* Finish draft.

* Optimisation

* Remove accidental commit

* Make it build.

* Fix linked map for traits.

* Fix Option<_> variant.

*  Improve naming a tad

* Rebuild runtime

* Builds!

* First test.

* Bump RT version

* Minor fix

* Update Mock

* adds the correct reward testcase (+staking eras which was already ok)

* fixes the basic staking testcase to work properly (along with a small fix in the module)

* New logic to avoid controller transferring stash.

* Fix some build issues.

* adding some comments to tests

* Fix impls.

* adds a few more lines to explain the test case

* More fixes.

* gets the basic test up and running again

* Fix rest of build

* Rebuild wasm

* Fix docs.

* fix staking test with new chnages

* updating some tests, pending questions

* More working tests

* adds double staking test

* Docs

* remove invalid slashing test

* Payee stuff.

* Fix build

* Docs

* Fix test

* Fix a couple of tests

* Layout plan for finishing tests before Pragmen

* Add some working tests

* re-build staking and reward tests

* Add more tests

* fix offline grace test

* Nominator should have payee checked for cleanup

* adds more nomination tets

* adds validator prefs tests

* Fix and clean up some TODOs

* Fix a couple of issues

* Fix tests

* noting warnings from tests

* final fix of local tests

* Fix slot_stake bug

* Half baked test

* Add logic to limit `unstake_threshold` set in storage

* Make sure to check before writing!

Almost forgot this one

* Move a couple of comments

* fix last broken slot_stake test

* Ignore broken test
2019-03-02 14:31:48 +01:00
Bastian Köcher 2e9b2be8fa Update parity-codec/-derive to 3.1 (#1900)
* Update parity-codec/-derive to 3.1

* Update wasm stuff
2019-03-01 09:04:53 +01:00
Michael Müller 90e5c5ddfb Telemetry improvements (#1886)
* Fix typo

* Support multiple telemetry endpoints and verbosity levels

* Bump substrate-telemetry version

* Telemetrify Aura consensus

* Telemetrify Grandpa

* Fix CI version conflicts

* Implement style remarks

* Fix fixture

* Implement style remarks

* Clone only when necessary

* Get rid of Arc for URL

* Handle connection issues better
2019-02-28 12:22:05 +01:00
Pierre Krieger 34fccecc02 Add names to tokio threads (#1866) 2019-02-25 15:40:51 -05:00
Gav Wood c3e6572886 Introduce new testnet ready for 0.10 (#1677)
* Introduce new testnet ready for 0.10

* Upgraded dd spec
2019-02-20 16:16:35 +01:00
Gregory Terzian 72bb8ef4c5 Rewrite the BasiQueue using channels (#1327)
* use channels to implement basic import queue

* async justification import

* better conditional for is_done in tests

* reword the test for presence of link

* fix conditional

* trace instead of panic when no link present

* reword expectations when sending to importers

* fix

* debug justification import error

* update expectations

* use NumberFor

* nits

* add general description

* move error handling into closure
2019-02-17 10:13:14 +01:00
Xiliang Chen fafffdb771 Transaction Fee Module (#1648)
* wip

* Split bytes fee charging and charging by amount into different traits.

* Move to edition 2018.

* Implemented charge fee traits for fees module.

* Implemented 'on_finalise' for fee module.

* Updated fees finalize impl.

* Renaming and documentation update.

* Added overflow & underflow check for fee calculation.

* Added mock and unit tests for fee module.

* More unit tests for fees module.

* Fixed srml-executive unit tests.

* Remove transaction base/bytes fee from balances module, fix unit tests.

* fix compile error

* Fixed unit test.

* Minor fixes.

* Bump spec version.

* Bump spec version.

* Updated fees module and runtime wasm.

* Fees module code style improvement; updated runtime wasm.

* Bump spec and impl version.
2019-02-15 11:21:38 +01:00