Commit Graph

40 Commits

Author SHA1 Message Date
Wei Tang 71d889b692 Make AuthorityId generic (#1296)
* BlockAuthorityId convenience type

* Rename AuthorityId -> Ed25519AuthorityId to make it more precise

* Generalize AuthorityId up to substrate-client

* Fix in client-db

* rename: BlockAuthorityId -> AuthorityIdFor

* typo: should be digest item

* Fix test-runtime authorityId mismatch

One states that AuthorityId is u64 while the other states that it's Ed25519AuthorityId.

* Fix more u64 - Ed25519AuthorityId mismatch

* Fix compile of most of the srml modules

* Continue to pin aura and grandpa with ed25519 and fix compile

* Add MaybeHash trait

* Fix node-runtime compile

* Fix network tests
2019-01-08 11:14:18 +01:00
Gav Wood 043831cfb0 Invulnerabiity from slashing for certain validators (#1355)
* Invulnerabiity from slashing

* Update srml/staking/src/lib.rs

Co-Authored-By: gavofyork <github@gavwood.com>
2019-01-07 16:07:58 +01:00
Gregory Terzian 771a8127c2 moving core/service/consensus into new core/authorship crate (#1257) 2018-12-31 12:33:49 +01:00
André Silva f8f932d123 node: fix shutdown (#1308)
* node: remove grandpa authority flags

* node: exit-guard grandpa and aura spawned futures

* node: wait for futures to stop running on shutdown

* core: run connectivity tests on same ports

* core: pass on_exit future when starting aura and grandpa

* node: add issue number to todo

* core: fix aura and grandpa tests
2018-12-21 17:30:45 +01:00
Gav Wood ef8b94656e Sudo module (#1315)
* Sudo module

* Fix comment

* Fix errors

* Fix test

* Update hashes

* Final test fixes and build

* Final hex change
2018-12-21 13:43:34 +01:00
André Silva d67821a580 node: remove grandpa authority flags (#1306) 2018-12-21 12:56:18 +01:00
Jaco Greeff d5749e878b Add additional Charred Cherry properties (#1286) 2018-12-19 17:45:12 +01:00
Gav Wood ac2c44f322 A new substrate-node testnet for 1.0beta (#1280)
* Add new testnet

* Rename

* Update lib.rs

* Rename ctd.

* Remove BBQ Birch Testnet reference from Readme

* Fix comment

* Update keys
2018-12-17 18:57:07 +01:00
André Silva 45d53ad022 Remove grandpa liveness oracle (#1271)
* core: support broadcasting consensus message to all peers

* grandpa: remove liveness oracle

* node: always start grandpa on full nodes

* core: don't check for grandpa justifications on failed block imports

* core: fix network connectivity test
2018-12-15 20:39:48 +01:00
Gav Wood 27f69def9a Lock-voting (#1254)
* Optionally long lock voting

* Lock voting.

* Fix tests

* Comment update

* Comments

* Minor grumbles

* Docs.
2018-12-13 18:58:50 +01:00
Bastian Köcher 3c7ee7d041 Use dev as id in development_config_genesis (#1259) 2018-12-12 15:29:12 +01:00
Robert Habermeier 6299b42a4d Punish offline validators, aura-style (#1216)
* make offline-reporting infrastructure more generic

* add a listener-trait for watching when the timestamp has been set

* prevent inclusion of empty offline reports

* add test for exclusion

* generate aura-offline reports

* ability to slash many times for being offline "multiple" times

* Logic for punishing validators for missing aura steps

* stub tests

* pave way for verification of timestamp vs slot

* alter aura import queue to wait for timestamp

* check timestamp matches seal

* do inherent check properly

* service compiles

* all tests compile

* test srml-aura logic

* aura tests pass

* everything builds

* some more final tweaks to block authorship for aura

* switch to manual delays before step

* restore substrate-consensus-aura to always std and address grumbles

* update some state roots in executor tests

* node-executor tests pass

* get most tests passing

* address grumbles
2018-12-10 18:37:08 +01:00
Gav Wood 66cbe232f5 Governance: Voters put money where mouth is (#1183)
* Referendums only gett enacted after a delay; successful voters must
lock funds up until enactment.

* Build fixes.

* Configurable council enact delay, fix test builds.

* Fix spelling

* Remove TODO
2018-12-10 17:29:40 +01:00
cheme ed5b78eaf0 decl_storage as a proc_macro (#1176)
* `decl_storage` parsing of the macro (TODO change tool crate structure)

* Start formatting, for now use inner macro.
Still missing optional formating last part (genesis ...).

* Calling extra genesis macro

* decl_storage lines parsing.

* genesis macro as quote (need some cleaning reorg)

* dirty $crate substitute

* proc crate reorg.

* PR impl : skip usage of phantom data, it only applies in test and
council (others required it).

* Remaining macro of decl_storage, warning stringify behave sometime
oddly.

* Formatting code and some cleaning.

* Include line parsing to main struct (cannot use existing macro anymore).

* Remove genesis phantom data when there is already a field with type
parameter.

* Revert wasm files

* Remove old version of `decl_storage`.

* Fix false positive for phantom trait (additional type check on config
build).

* slight changes:
- return token errors instead of panic
- do not use useless intermediate vec

* Update srml/support/procedural/tools/derive/src/lib.rs

remove indent

Co-Authored-By: cheme <emericchevalier.pro@gmail.com>

* Switch iterations to fold, remove unused import.
2018-12-09 21:09:39 +01:00
André Silva e779eeb2ec Grandpa validator set handoff justification (#1190)
* core: make block justification optional

* runtime: update wasm binaries

* core: optionally pass justification on finalize_block

* finality-grandpa: add channel to trigger authority set changes

this will allow the `BlockImport` to trigger an authority set change when
importing a change block that provides a justification (when syncing)

* finality-grandpa: move finalize_block to free function

* finality-grandpa: add GrandpaOracle for auth set liveness checking

this will be used by `BlockImport` to check whether the authority set for a
given block is still live, if the authority set isn't live then importing a
change block requires a justification.

* finality-grandpa: store justification on finalized transition blocks

* finality-grandpa: check justification on authority set change blocks

* finality-grandpa: poll grandpa liveness oracle every 10 seconds

* finality-grandpa: spawn grandpa oracle in service setup

* core: support multiple subscriptions per consensus gossip topic

* finality-grandpa: create and verify justifications

* finality-grandpa: update to local branch of grandpa

* finality-grandpa: update to finality-grandpa v0.5.0

* finality-grandpa: move grandpa oracle code

* finality-grandpa: fix canonality check

* finality-grandpa: clean up error handling

* finality-grandpa: fix canonical_at_height

* finality-grandpa: fix tests

* runtime: update wasm binaries

* core: add tests for finalizing block with justification

* finality-grandpa: improve validation of justifications

* core: remove unused IncompleteJustification block import error

* core: test multiple subscribers for same consensus gossip topic

* Revert "finality-grandpa: improve validation of justifications"

This reverts commit 51eb2c58c2219801e876af6d6c9371bdd9ff2477.

* finality-grandpa: fix commit validation

* finality-grandpa: fix commit ancestry validation

* finality-grandpa: use grandpa v0.5.1

* finality-grandpa: add docs

* finality-grandpa: fix failing test

* finality-grandpa: only allow a pending authority set change per fork

* finality-grandpa: fix validator set transition test
2018-12-08 13:34:59 +08:00
Robert Habermeier 63980e3770 make block builder and construct_runtime! generic over inherent-data (#1191)
* make block builder generic over inherent-data

* construct_runtime has you specify inherent data type

* get all tests to compile
2018-12-03 11:49:30 +01:00
Bastian Köcher 69a288e586 Cleanup the cli interface (#1194)
Parameters like `--dev`, `--base-path` or `--chain` were replicated
for each subcommand and were also present in the "top". This pr removes
these parameters from the subcommands.
The subcommands also ignored stuff like `--dev` as it was only read in
the top matcher, that did not look into the subcommand matchers.
Now, if you specify one of the parameters for a subcommand, you will get
an error instead of silently ignoring it.
2018-12-03 10:16:06 +01:00
Andrew Jones c36998aeaf Default boot_nodes to local node in build-spec (#1181)
* Default to local bootnode with build-spec

* Rexport libp2p stuff via network crate

* Remove unused imports and fix where formatting

* Remove spurious blank lines

* Remove unnecessary else clause
2018-12-01 16:47:40 +08:00
Bastian Köcher ed421c56ee Rewrite impl_runtime_apis! and decl_runtime_apis! as proc-macro (#1174)
* Rewrites `impl_runtime_apis!` macro as `proc-macro`

* Adds some documentation

* Require the `impl_runtime_apis` to use a path for accessing the trait

* Make the runtime implement `GetNodeBlockType`

* Moves first chunk of runtime api code into the `impl_runtime_apis` macro

This also renames `ClientWithApi` into `RuntimeApi`.

* Make `impl_runtime_apis` use `runtime` api version automatically

* `decl_runtime_apis` automatically adds `Block: BlockT` as generic parameter

* Remove function generic arguments in block builder api

* Remove some unnused stuff from the `decl_runtime_apis` macro

* Make `InherentData` working again

* Make `impl_runtime_apis!` implement the `RuntimeApi` side as well

* Make it compile again after rebasing with master

* Split `sr-api-macros` into multiple files

* Reimplement `decl_runtime_apis!` as proc_macro

* Use `decl_runtime_apis!` for `Core` as well and improve error reporting

* Adds documentation for `decl_runtime_apis!` and `impl_runtime_apis!`

* Move some code

* Adds compile fail tests

* Adds a test and fixes some bugs

* Make `impl_runtime_apis!` support `_` as parameter name

* Fixes build errors with wasm

* Wasm rebuild after master rebase

* Apply suggestions from code review

Co-Authored-By: bkchr <bkchr@users.noreply.github.com>

* Addresses some grumbles

* Adds test to ensure that method signatures need to match

* New wasm files
2018-11-30 11:42:46 +01:00
Benjamin Kampmann c27c613445 Remove Proposer from Service (#1171)
* Remove Proposer from Service

Refs #1021, #1158
2018-11-27 17:22:28 +01:00
Benjamin Kampmann 52e36bbeb8 Clean up CLI params (#1165)
* Fix params: they are kebab not snake-cased
* Fix docs missing in cli
* remove unsed macro-use
2018-11-27 09:25:27 +01:00
André Silva b7e0db725d core, node: use grandpa block import for locally sealed aura blocks (#1167)
* core, node: use grandpa block import for locally sealed aura blocks

* core: impl DerefMut for FullComponents

* node: take grandpa_import_setup from service config
2018-11-26 15:29:13 +01:00
Robert Habermeier 11fe84a742 Minimal switch of substrate-node to GRANDPA /Aura (#1128)
* add beginnings of SRML grandpa library

* get srml-grandpa compiling

* tests for srml-grandpa

* add optional session integration to grandpa SRML

* start integration into node runtime

* Allow extracting pending change from header digest

* Make it compile on wasm

* make tests compile again

* Move Authority Key fetching into service, simplify service factory construction

* Generalize Authority Consensus Setup system

* Add Authority Setup Docs

* Allow CLI params to be extensible

 - move params to structopts
 - split parsing and default command execution
 - add custom config to node
 - extended parsing of custom config
 - extending params via structop's flatten

* Minor fixes on cli extension params:
 - added docs
 - re-add actual app name, rather than node-name
 - make strategy and subcommand optional

* better cli params

* synchronize GRANDPA and normal node authorities

* Implement grandpa::network for gossip consensus

* run_grandpa in Node

* Fix missed merge error

* Integrate grandpa import queue

* more specific type def

* link up linkhalf and import block

* make grandpa future send

* get compiling

* Fix new params convention and license header

* get it running

* rebuild node runtime WASM

* change logging level

* Update node/cli/src/params.rs

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

* Update node/cli/src/params.rs

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

* Update node/cli/src/lib.rs

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

* Update node/runtime/src/lib.rs

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

* Update node/cli/src/lib.rs

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

* Clean up and Fixme for mutable config

* Move GrandpaService Integration into grandpa, feature gated but on per default

* Fixing grandpa runtime module test

* Update wasm runtime hashes for tests

* GRANDPA: use post-header hash when logging scheduled changes

* add an extra bit of logging to authorities

* fixing missing constrain

* remove old code

* move `NewAuthorities` to an event in srml-grandpa

* fix node-executor tests to use grandpa log

* Remove GossipConsensus from tests, use newly provided sync-feature, fixes tests

* Update to latest wasm runtimes

* address grumbles

* address grumbles

* only derive deserialize when using std

* Clean up use of Deserialize
2018-11-21 18:42:50 +01:00
Bastian Köcher d149f3358a Revert and redo #952 (#1133)
* Revert "Pruning changes trie without digests (#952)"

This reverts commit 6f9a505fba.

* pruning changes tries without digests

* u64::max_value()

* Update wasm files and fix merge conflict

* Fixes tests
2018-11-18 10:09:18 +01:00
Svyatoslav Nikolsky 6f9a505fba Pruning changes trie without digests (#952)
* pruning changes tries without digests

* u64::max_value()
2018-11-17 18:04:53 +01:00
Bastian Köcher a4e5842915 Introduce a PhantomData field in GenesisConfig (#1116)
This makes it possible to support `GenesisConfig`s that to do not use
generic parameter.
2018-11-16 16:16:10 +01:00
Robert Habermeier e45a68a009 add extra verification for aura (#1126)
* add extra verification for aura

* fix tests

* adjust documentation wording
2018-11-16 11:36:35 +01:00
Shawn Tabrizi 7f8ee0f53b Clean up justification (#1111)
* adding mac libraries and how to start testnet

* Clean up Justification struct, Issue #1033

* adding mac libraries and how to start testnet
2018-11-14 13:39:38 +01:00
Bastian Köcher 9063d1acae Implement runtime api client side directly in the runtime (#1094)
* Move `initialise_block` into `Core` trait as it is crucial calling the API functions

* Switch to first version of new runtime API implementation

* Fixes bug in tests

* Reenable asserts

* Directly use the `TestAPI` in the tests

* Start improving the api traits

:100644 100644 898aadc7 49217199 M	Cargo.lock
:100644 100644 61570436 465ed664 M	core/client/src/backend.rs
:100644 100644 5d0c886b 64d710fd M	core/client/src/block_builder.rs
:100644 100644 c447855e 5ecbe474 M	core/client/src/client.rs
:100644 100644 139cef13 f90dbf3d M	core/client/src/error.rs
:100644 100644 2800c503 3298e66a M	core/client/src/runtime_api.rs
:100644 100644 affa1c5c 809b08bc M	core/primitives/src/lib.rs
:100644 100644 2877dfa9 d5547413 M	core/sr-api/Cargo.toml
:100644 100644 9a49784d 6a625a03 M	core/sr-api/src/lib.rs
:100644 100644 7c28e1c7 a1a444a9 M	core/sr-primitives/src/traits.rs
:100644 100644 2e113ab6 dcc01a6d M	srml/metadata/Cargo.toml
:100644 100644 ea722a70 0809531a M	srml/metadata/src/lib.rs

* Refactoring

* Move `sr-api` into client and more refactoring

* Fixes tests

* Some documentation and cleanup

* Fixes compilation after rebase

* More refactoring and more documentation

* Makes `substrate-client` compilable on `wasm`

On `wasm` it basically just exports the runtime api stuff.

* Fixes grumbles

* Updates wasm files after rebasing the master

* Remove TODO comment

* Remove whitespaces

* Fixes after rebasing master

* Another rebase, another fix commit
2018-11-13 13:33:28 +01:00
Sergey Pepyakin 1f0f3c8f6b srml-contract: Extract schedule (#1044)
* Rename Config → Schedule.

* Fetch and pass config.

* Integrate config everywhere.

* <<<E as Ext>::T as Trait> → <<E::T as Trait>

* Update roots

* Cache existential_deposit

* Update COMPLEXITY.md

* Update roots.
2018-11-12 20:44:05 +01:00
azban 367c99b2bb test-utils: add chain-spec-builder cli (#1061)
* test-utils: add chain-spec-builder cli

* style changes, mostly indentation

* fix padding

* add issue to todo

* more style fixes

* share seed padding with keystore

* fix master rebase error
2018-11-12 20:21:03 +01:00
Andrew Jones db075b57f0 RPC: expose chain spec properties (#1104)
* Add properties to chain spec

* Read properties as serde_json::Value

* Use a serde json::map::Map directly for properties

* Add type alias for json Map

* Update chain_spec.rs
2018-11-12 19:58:44 +01:00
Hero Bird 660c747c51 Update fixed-hash & uint utilities (#1078)
* [core/primitives] Update crunchy 0.1 => 0.2

* [core/primitives] Update fixed-hash 0.2 => 0.3.0-beta

* [core/primitives] Update `uint` 0.4 => 0.5.0-beta

* [core/state-machine] Fix errors emerged by fixed-hash update

* [core/state-db] Fix errors that emerged from fixed-hash update

* [core/sr-io] Fix errors that emerged from the fixed-hash update

* [core/trie] Fix errors emerged from fixed-hash updates

* [core/trie] Make use of new Hash::as_fixed_bytes_mut method in tests

* [core/sr-primitives] Fix errors emerged from updating fixed-hash

* [core/executor] Fix errors that emerged from fixed-hash update

* [core/test-runtime] Fix errors that emerged from updating fixed-hash

* [core/test-runtime] Fix an error that emerged from fixed-hash update

* [core/transaction-pool] Fix errors that emerged from updating fixed-hash

* Add From<u64> impl for hash types defined in core/primitives

* [core/client/db] Fix errors that emerged from fixed-hash update

* [core/{client/network/rpc}]: Fix errors emerged by fixed-hash update

* [node/{cli/executor/runtime}]: Fix errors emerged by updating fixed-hash

* [core/network]: Fix bug in parsing constant str

* Update Cargo.lock

- Add crunchy 0.2.1
- fixed-hash 0.2.2 => 0.3.0-beta.3
- Add static-assertions 0.2.5
- uint 0.4.1 => 0.5.0-beta.1

* [core/primitives]: Add fixed-hash/rustc-hex feature for FromStr impl

* [core/primitives] No longer provide From<u64> impl for hash types if byteorder support is not enabled

* [core/primitives] Revert to using From impl again in primitives tests

* [core/..] Fix some bugs that emerged by recent fixed-hash updates

* Update a bunch of Cargo.lock files

* [core/state-db] Re-add whitespace between attr and extern crate/mod

* [core/primitives] Fix bug in From<u64> impl for hash types using the wrong feature guard
2018-11-06 15:39:55 +01:00
Benjamin Kampmann 50adea6220 Consensus Engines Implementation: Aura (#911)
* Generalize BlockImport

 - move ImportBlock, BlockOrigin, ImportResult into shared sr-primitives
 - let Consensus provide  and  traits again
 - update consensus traits to latest development
 - implement traits on client::Client, test_client::TestClient
 - update RHD to use the new import_block API

* Move ImportBlock into consensus-common
* Send import notification in aura tests
* Integrating aura into service
* Make Signatures more generic
* Aura Block Production with the given key
* run aura on the thread pool
* start at exact step start in aura
* Add needed wasm blob, in leiu of better solutions.
* Make API ids consistent with traits and bring upstream for sharing.
* Add decrease_free_balance to Balances module
* Encode `Metadata` once instead of two times
* Bitops include xor
* Upgrade key module.
* Default pages to somewhat bigger.
* Introduce upgrade key into node
* Add `Created` event
2018-10-27 15:59:18 +02:00
Gav Wood 1475610880 Remove nonsense code and options, fix score and generally make subkey work (#936)
* Remove nonsense code and options, fix score and generally make subkey work.

* Rename Demo -> Node
2018-10-20 22:15:28 +02:00
Bastian Köcher 7f6862ba5e Remove node-service (#933)
* Move `chain_spec` into `node-cli`

* Fixes tests

* Adds `construct_simple_service` and `construct_service_factory` macros

* Remove the `node-service` crate

* Add some documentation

* Fixes compilation on stable
2018-10-19 12:22:32 +02:00
Arkadiy Paronyan 9a660f82ed Integration tests (#805)
* Started substrate tests

* Sync test

* Test updates

* Improved tests

* Use on-chain block delay

* Parallel test execution

* Otimized tests

* Logging

* Fixed racing test

* Fixed compilation

* Fixed timestamp test

* Removed rlp dependency

* Minor fixes

* Fixed tests

* Removed best_block_id and resolved fdlimit issue

* Whitespace

* Use keyring

* Style

* Added API execution setting

* Removed stale import
2018-09-28 10:37:55 +01:00
Gav Wood 851c7f42df Fix block generation by updating codec versions in wasm (#810)
* Fixes for staging testnet

* Fix codec versioning

* Comment unneeded trace

* Update lib.rs

* Update parity-codec

* Add script to update wasm deps and update them.

* Update hashes

* Add BBQ Birch testnet

* it's default-features, apparently.

* Use simpler version spec for parity codec

* Typo
2018-09-27 14:38:56 +01:00
Bastian Köcher 5eb1aefde6 Updates dependencies and tries to consolidate multiple version (#815) 2018-09-27 13:50:15 +01:00
Gav Wood 1e01162505 Phase 1 of repo reorg (#719)
* Remove unneeded script

* Rename Substrate Demo -> Substrate

* Rename demo -> node

* Build wasm from last rename.

* Merge ed25519 into substrate-primitives

* Minor tweak

* Rename substrate -> core

* Move substrate-runtime-support to core/runtime/support

* Rename/move substrate-runtime-version

* Move codec up a level

* Rename substrate-codec -> parity-codec

* Move environmental up a level

* Move pwasm-* up to top, ready for removal

* Remove requirement of s-r-support from s-r-primitives

* Move core/runtime/primitives into core/runtime-primitives

* Remove s-r-support dep from s-r-version

* Remove dep of s-r-support from bft

* Remove dep of s-r-support from node/consensus

* Sever all other core deps from s-r-support

* Forgot the no_std directive

* Rename non-SRML modules to sr-* to avoid match clashes

* Move runtime/* to srml/*

* Rename substrate-runtime-* -> srml-*

* Move srml to top-level
2018-09-12 11:13:31 +02:00