Commit Graph

37 Commits

Author SHA1 Message Date
Stanislav Tkach 443ad90b47 Update codec version to the 4.1 version (#2948)
* Update codec version to the 4.1 version

* Bump impl_version

* Update lock files

* Update codec to 4.1.1 version

* Bump impl version
2019-06-26 16:26:24 +02:00
thiolliere 8b89c7ae62 Update parity-scale codec minor version (#2951)
* update parity-scale codec minor version

* update to 3.5.3

* update locks

* increase impl version

* Update to 3.5.4

* Update WASM lockfiles
2019-06-26 08:48:12 +02:00
Gavin Wood bda8641892 New sessions, kill consensus module (#2802)
* Draft of new sessions

* Reintroduce tuple impls

* Move staking module to new session API

* More work on staking and grandpa.

* Use iterator to avoid cloning and tuple macro

* Make runtime build again

* Polish the OpaqueKeys devex

* Move consensus logic into system & aura.

* Fix up system module

* Get build mostly going. Stuck at service.rs

* Building again

* Update srml/staking/src/lib.rs

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

* Refactoring out Consensus module, AuthorityIdOf, &c.

* Refactored out DigestItem::AuthoritiesChanged. Building.

* Remove tentative code

* Remove invalid comment

* Make Seal opaque and introduce nice methods for handling opaque items.

* Start to use proper digest for Aura authorities tracking.

* Fix up grandpa, remove system::Raw/Log

* Refactor Grandpa to use new logging infrastructure.

Also make authorityid/sessionkey static. Switch over to storing
authorities in a straight Vec.

* Building again

* Tidy up some AuthorityIds

* Expunge most of the rest of the AuthorityKey confusion.

Also, de-generify Babe and re-generify Aura.

* Remove cruft

* Untangle last of the `AuthorityId`s.

* Sort out finality_tracker

* Refactor median getting

* Apply suggestions from code review

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

* Session tests works

* Update core/sr-primitives/src/generic/digest.rs

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

* Session tests works

* Fix for staking from @dvc94ch

* log an error

* fix test runtime build

* Some test fixes

* Staking mock update to new session api.

* Fix build.

* Move OpaqueKeys to primitives.

* Use on_initialize instead of check_rotate_session.

* Update tests to new staking api.

* fixup mock

* Fix bond_extra_and_withdraw_unbonded_works.

* Fix bond_with_little_staked_value_bounded_by_slot_stake.

* Fix bond_with_no_staked_value.

* Fix change_controller_works.

* Fix less_than_needed_candidates_works.

* Fix multi_era_reward_should_work.

* Fix nominating_and_rewards_should_work.

* Fix nominators_also_get_slashed.

* Fix phragmen_large_scale_test.

* Fix phragmen_poc_works.

* Fix phragmen_score_should_be_accurate_on_large_stakes.

* Fix phragmen_should_not_overflow.

* Fix reward_destination_works.

* Fix rewards_should_work.

* Fix sessions_and_eras_should_work.

* Fix slot_stake_is_least_staked_validator.

* Fix too_many_unbond_calls_should_not_work.

* Fix wrong_vote_is_null.

* Fix runtime.

* Fix wasm runtime build.

* Update Cargo.lock

* Fix warnings.

* Fix grandpa tests.

* Fix test-runtime build.

* Fix template node build.

* Fix stuff.

* Update Cargo.lock to fix CI

* Re-add missing AuRa logs

Runtimes are required to know about every digest they receive ― they
panic otherwise.  This re-adds support for AuRa pre-runtime digests.

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

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

* Kill log trait and all that jazz.

* Refactor staking tests.

* Fix ci runtime wasm check.

* Line length 120.

* Make tests build again

* Remove trailing commas in function declarations

The `extern_functions!` macro doesn’t like them, perhaps due to a bug in
rustc.

* Fix type error

* Fix compilation errors

* Fix a test

* Another couple of fixes

* Fix another test

* More test fixes

* Another test fix

* Bump runtime.

* Wrap long line

* Fix build, remove redundant code.

* Issue to track TODO

* Leave the benchmark code alone.

* Fix missing `std::time::{Instant, Duration}`

* Indentation

* Aura ConsensusLog as enum
2019-06-14 16:34:34 +02:00
Svyatoslav Nikolsky 012ce5878b Restore integration tests (#2620)
* restored test_consensus

* restored test_sync

* run integration tests only on CI

* use single test-thread for integration tests

* post-merge fix

* panic when integration test runs for too long

* add some traces to integration logs

* manual wait -> timeout

* post-merge fix

* post-merge fix
2019-06-05 09:16:14 +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
Gavin Wood adba89913e Clean up random seed to make a bit more flexible (#2456)
* Reformulate random seed to be more random

- First 80 random values come from cycling the incomplete series (
  instead of filling with zeroes)
- Calculate random material each usage (use a single amalgamated
  ring buffer to store them for avoiding 81 lookups each time)
- Mutate inputs by hashing each with:
  - its index (into the 81)
  - an additional "subject" key provided by caller

This keeps the final output low-influence while still allowing
it to be used as the seed to independent contexts. (Hashing the
result to give the final seed is no better than using parent_hash).

* Docs

* Bump runtime

* Update notes

* Remove feature(alloc)

* Update srml/system/src/lib.rs

Co-Authored-By: gavofyork <github@gavwood.com>
2019-05-06 13:57:30 +02:00
Sergei Pepyakin e2bb429711 Use serde derive feature. (#2351)
* core/primitives

* sr-primitives

* sr-primitives

* srml-treasury

* substrate-executor

* substrate-keystore

* network-libp2p

* substrate-service

* srml-system

* substrate-rpc

* sr-version

* substrate-telemetry

* substrate-test-runtime

* substrate-transaction-pool

* node-template-runtime

* node-primitives

* srml-consensus

* srml-contract

* srml-democracy

* srml-finality-tracker

* srml-grandpa

* srml-metadata

* srml-support

* Clean

* Update locks
2019-04-23 18:42:42 +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
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 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 7927054f86 Update copyrights to 2019 (#1932) 2019-03-06 15:04:28 +01:00
Gav Wood ccc11974ee Aggregate all liquidity restrictions in a single place (#1921)
* Clean up session key rotation

* Fix build

* Bump version

* Introduce feature to balances.

* Move staking locking logic over to central point

* ^^^ rest

* First part of assimilation

* More assimilation

* More assimilation

* Fix most tests

* Fix build

* Move Balances to new locking system

* :q!

* Bump runtime version

* Build runtime

* Convenience function

* Test fix.

* Whitespace

* Improve type legibility.

* Fix comment.

* More tests.

* More tests.

* Bump version

* Caps

* Whitespace

* Whitespace

* Remove unneeded function.
2019-03-06 12:46:17 +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
Gav Wood a61c218cc3 Introduce Ristretto signing (#1730)
* first draft of ristretto crypto module #1685

* adds better comments and code-style

* remove the last evil unwrap

* remove a mistakenly committed lockfile

* add a fresh new lockfile --will probably need a manual merge later

* fix an invalid old test vector

* Wire in ristretto

* Update comment

* Fix use.

* new Signature type api alias to be compatible with substrate

* Add new keyring, fix node executor tests

* Bump version.

* Remove all hashes.

* Update core/primitives/src/sr25519.rs

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

* Revert back to Ed25519 (until JS UI is ready)

* Fix test
2019-02-13 10:10:17 +01:00
Stanislav Tkach 473721f959 Migrate node (cli, executor, primitives and runtime) to the 2018 edition (#1589) 2019-01-29 17:57:56 +01:00
thiolliere 0078927ac5 update codec and grandpa (#1582)
* update codec

* use new codec

* update grandpa code

* build .lock and binaries
2019-01-28 14:16:17 +01:00
Benjamin Kampmann ab4c70b379 Update dependencies (#1527)
* update to latest env_logger

* roundabout dependency update

* Update to latest vengen

* Update rand to 0.6

* Update to latest rng shuffle API

* Roundabout update of dependencies

* Update rustc_hex

* Update wasm

* Fix logging setup in tests

* revert to fix test
2019-01-25 12:44:41 +01:00
Bastian Köcher 70b1af7b1e Rewrite Inherent data (#1488)
* Implement new inherent data

* Fixes compilation on wasm

* Fixes after rebase

* Switch back to generate inherent stuff by macro

* Update after rebase

* Apply suggestions from code review

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

* Fix compilation after rebase

* Address grumbles

* Remove `InherentDataProviders` from `Client`

* Update wasm files after rebase

* Address grumbles

* Fixes compilation after latest merge

* Last fix
2019-01-22 17:52:08 +01:00
thiolliere beeacf9cfa impl HasCompact for Perbill and Permill (#1411)
* impl Compact<> and HasCompact for Permill Perbill

* update parity-codec to 2.2

* add Cargo.lock

* add lock and build for runtime

* rebuild Cargo.lock after rebase
2019-01-17 11:25:48 +01:00
Tomasz Drwięga 677b79765b Fix serialization of extrinsics. (#1402) 2019-01-11 19:24:25 +01:00
Gav Wood 039741c977 Ensure opaque extr serialise is same as transparent (#1388)
* Ensure opaque extr serialise is same as transparent

Fixes #889

* Fix wasm compile
2019-01-11 11:36:44 +01:00
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
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
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 4132a49fbb Move inherent implementation into the modules (#924)
* Adds new `ProvideInherent` trait

Also implements the new trait for `srml/consensus` and `srml/timestamp`.

* Adds `impl_outer_inherent!` macro

* Reexport macros from `alloc`

* Introduce `RuntimeString` and fix `ProvideInherent` on `no_std`

* Replace `VersionString` with `RuntimeString`

* Improvements for `impl_outer_inherent!`

* Make `construct_runtime!` support `impl_outer_inherent!`

* Fixes after rebase

* Whitespace
2018-10-18 10:55:52 +02:00
Gav Wood 8bc5242c92 Compact format for block number, nonce, balance (#910)
* Try to make everything compact

* Make `Clone` work

* Fix

* Move contracts and balances over to compact encoding

* Session and timestamp are compact

* Sataking uses compact numbers

* Treasury now compact

* Compact Democracy

* Council is compact

* Fix
2018-10-16 22:47:30 +02:00
Bastian Köcher 8de663f105 Adds check_inherents function to the BlockerBuilder API (#912)
* Adds new `check_inherents` function to the `BlockBuilder` API

* Switch to `check_inherents` in `node-consensus`

* Remove `CheckedBlock`, because it is not required anymore

* Fixes after rebase

* Fixes compilation on stable
2018-10-16 20:30:04 +02:00
Bastian Köcher 2332d6dd04 More dependency cleanup (#825)
* Removes `rlp` dependency

* Enable warnings about unused crates in the CI

* Remove all the unused crates

* Make tests working again
2018-09-27 17:52:51 +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
Gav Wood 82d6ca3484 Switch to shiny new fast, RLP-less trie (#795)
* Bump codec

* Fix tests

* Patricia trie builds

* Introduce trie

* Some yak shaving.

* Some fixes

* Remove RLP ref

* Fixes

* It builds!

* Some tests fixed

* Another test fix

* Rejig more hashes

* substrate-trie::iterator_works test

* Update lock

* Polish

* Docs

* Undo incorrect "fix" for tests

* Fix nits
2018-09-25 16:32:22 +02:00
Gav Wood f71200ee3c Bump codec (#786)
* Bump codec

* Fix tests
2018-09-21 17:16:15 +02:00
Svyatoslav Nikolsky 7fa337afbc Light friendly storage tracking: changes trie + extending over ranges (#628)
* changes_trie

* changs_trie: continue

* changes_trie: adding tests

* fixed TODO

* removed obsolete ExtrinsicChanges

* encodable ChangesTrieConfiguration

* removed polkadot fle

* fixed grumbles

* ext_storage_changes_root returns u32

* moved changes trie root to digest

* removed commented code

* read storage values from native code

* fixed grumbles

* fixed grumbles

* missing comma
2018-09-18 09:14:41 +02:00
Gav Wood f10d8e177d Generalised Transaction Queue API (#741)
* First effort

* API versioning

* Introduce validate_transaction

* Introduce the API plus fixes.

* Docs

* Typo

* Add longevity parameter to transaction validity info.
2018-09-17 18:43:59 +02:00
Gav Wood 3f96419665 Remove unneeded code (#737) 2018-09-13 18:08:45 +02: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