Commit Graph

59 Commits

Author SHA1 Message Date
Pierre Krieger 3f06fe32f3 Update to libp2p v0.7.0 (#2343)
* Update to libp2p master

* Fix tests

* More tests fixing
2019-04-23 18:46:30 +01: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
Tomasz Drwięga 08fda211d8 Fix MultiSigner, simplify tests (#2033)
* Fix MultiSigner, use `into_signed_tx`

* Rebuild.
2019-04-23 17:18:32 +01:00
Xiliang Chen c4cbfb355c Move scripts to scripts folder and update readme (#2331)
* Move scripts to scripts folder and update readme

* Update node-template/README.md

Co-Authored-By: xlc <xlchen1291@gmail.com>

* Update node-template/README.md

Co-Authored-By: xlc <xlchen1291@gmail.com>

* Update node-template/README.md

Co-Authored-By: xlc <xlchen1291@gmail.com>

* Update node-template/README.md

Co-Authored-By: xlc <xlchen1291@gmail.com>

* Update node-template/README.md

Co-Authored-By: xlc <xlchen1291@gmail.com>

* Update node-template/README.md

Co-Authored-By: xlc <xlchen1291@gmail.com>

* remove release flag
2019-04-23 08:50:31 +02:00
Bastian Köcher 12823383a2 Make correct feature selection in node-template Cargo.toml (#2306) 2019-04-19 13:55:04 +02:00
Bastian Köcher 72840bd71e Add StorageValue::append and speed-up deposit_event (#2282)
* Adds deposit event benchmark

* Add `StorageValue::append`

`StorageValue::append` can be used by types that implement `EncodeAppend` to speed-up situations where you just want to append
an item to storage without wanting to decode all previous items.

* Stay at 100 events

* Fixes compilation

* Use correct year and increase spec version
2019-04-16 13:17:02 +02:00
Kian Peymani dcb1cafe2a Remove unused imports/ doc comments. (#2276)
* Remove unused imports/ doc comments

* Better doc for node template.
2019-04-14 12:42:45 +02:00
Shawn Tabrizi 600d0cafaa Update template-node to node-template (#2265)
* Update `template-node` to `node-template`

For substrate-up scripts

* Remove random artifact
2019-04-12 11:53:35 +02:00
Andrew Jones 7f59cdb900 Replace error-chain for client error (#2231)
* WIP: convert client error

* Remove error_chain for client error

* Ignore tx-pool error deprecation warning

* Update Cargo.lock files

* Fix tests

* Increment impl_version

* Derive From impls, remove allow(missing_docs)

* Remove space

* Remove redundant into()s

* Blockchain Error source

* Bump impl version
2019-04-11 21:33:43 +02:00
Xiliang Chen 19d77cbc23 update authers for rest of the node-template cargo.toml files (#2242) 2019-04-10 10:26:29 +02:00
Xiliang Chen cb766e5f5d update name and authors to placeholder text for node-template (#2222)
* update name and authors to placeholder text

* revert package name change
2019-04-09 07:22:20 +02:00
Bastian Köcher e902c54399 Switch to derive(Encode, Decode) for Call (#2178)
* Add some tests

* More tests

* Switch to `derive(Encode, Decode)` for `Call`

* Update lock files

* Simplify the macro cases
2019-04-03 11:59:57 +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
cheme 669e79181e no_std support for substrate trie (#2146)
* no_std trie compile in test_runtime (require to set nightly feature due
to the way hashbrown currently works).

* No nightly with hashmap_core.

* using crate elastic-array

* switch to publish trie crates

* fix default array decl

* bump impl_version for ci

* set all semver when possible wasm, and remove redundant code.

* Actually test use_trie function

* impl version +1

* Bump impl version
2019-04-02 12:49:04 +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
Bastian Köcher 345145326b Implement support for renaming runtime api functions (#2160)
* Implement support for renaming runtime api functions

* Redelete the wasm files

* FIxes test

* Fix test correctly...

* Bring back old `authorities`

* Tag as deprecated

* Fixes compilation on WASM

* Add missing method implementations

* Fixes tests

* Increase `spec_version`
2019-04-02 10:05:35 +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
Stanislav Tkach cbfc36b39f Move authorities interface from Core to consensus (#1412)
* Move authorities interface from Core to consensus

f

* notify all caches of block insert + create with up-to-date best_fin

* merged authorities_are_cached from light_grandpa_import2

* Add ProvideCache trait

* Create helper function for 'get_cache'

* Fix some formatting

* Bump impl version

* Resolve wasm conflicts

* Apply review comments

* Use try_for_each

* Move authorities interface from Core to consensus

f

* notify all caches of block insert + create with up-to-date best_fin

* merged authorities_are_cached from light_grandpa_import2

* Add ProvideCache trait

* Create helper function for 'get_cache'

* Fix some formatting

* Bump impl version

* Resolve wasm conflicts

* Apply review comments

* Use try_for_each

* Move authorities interface from Core to consensus

f

* notify all caches of block insert + create with up-to-date best_fin

* merged authorities_are_cached from light_grandpa_import2

* Add ProvideCache trait

* Create helper function for 'get_cache'

* Fix some formatting

* Bump impl version

* Resolve wasm conflicts

* Apply review comments

* Use try_for_each

* Increment impl_version

* Update lib.rs
2019-03-29 17:41:22 +01: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
Arkadiy Paronyan 7046e13de2 Use prefixed keys for trie node. (#2130)
* Account for pending insertions when pruning

* Prefixed trie storage

* Comments

* Prefixed trie storage

* Fixed tests

* Fixed tests

* Bumped runtime version

* Bumped runtime version again
2019-03-28 18:46:21 +01: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
Tomasz Drwięga ff4523cbec Make some txpool logs a bit more compact (#1995)
* Improve logging for transaction pool.

* Change Debug in node-template runtime.

* Fix hexdisplay.

* Add some additional logging.

* Rebuild wasm
2019-03-27 23:36:18 +01:00
Shawn Tabrizi b32653d0a8 Update AccountId to use sr25519 in node-template (#2119) 2019-03-27 10:50:14 +01:00
thiolliere 571d094313 improve docs (#2068)
* improve decl_storage instance doc

* use decl_event doc accordignly

* automate doc and while allow to extend it on event

* some missed ones

* Update srml/example/src/lib.rs

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

* Update srml/support/procedural/src/storage/transformation.rs
2019-03-26 14:35:57 +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
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
Xiliang Chen 36d90ff272 expose linked map info to metadata (#2037)
* expose linked map info to metadata

* Make it non breaking change

* another way

* change to option 1

* bump metadata version

* fix test

* bump version and update wasm
2019-03-23 11:17:29 +01:00
cheme dd47be51c3 Switch contract storage to child trie (#2002) 2019-03-22 18:01:06 +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
kaiyu f6f15b618e Use local executor (#2054) 2019-03-21 13:57:20 +01: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 3501746fa9 Fix lazy initialisation bug for parametizability (#2046)
remove lazy and compute prefix at compile time
2019-03-19 18:05:07 +01:00
thiolliere 96d1f841cb fix indexing event breakage (#2030)
* fix instance event indexing breakage

* fix infinite loop

* update runtime impl version, and builds

* Revert "Remove unnecessary restrictions in executive module (#2024)"

This reverts commit e9f17771b0.
2019-03-18 14:18:24 +01:00
Gautam Dhameja 218536a825 updated link for example module in template (#2020) 2019-03-18 10:01:48 +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
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
郭光华 3149136367 Fix telemetry panic error in node-template (#1958) 2019-03-12 13:19:42 +01:00
Gav Wood 9f3b4468db Make subkey support Sr25519 crypto (#1933)
* Make subkey support Sr25519 crypto.

* Rebuild runtime.

* Build and rejig locks.

* Fix grumbles

* Derivations

* Introduce tests
2019-03-07 17:10:17 +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
Hero Bird 128d164f2b Make use of parity-codec "derive" crate feature (#1919)
* Make use of parity-codec "derive" crate feature

* Bump impl_version

* Update wasm files and Cargo.lock files

* Transferred to parity_codec derive feature for the rest of the crates

* Update wasm binaries and lock files

* Update core and node wasm binaries
2019-03-05 09:00:37 +01: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
thiolliere 8065116ba5 Improve fees module (#1821)
* remove amount associated
* make a new trait to bound some arithmetics to balances or assets:
  It also remove arithmetic bounds of srml-support::traits::Currency.

  To update your code then use srml_support::traits::ArithmeticType like:
  `type Currency: ArithmeticType + Currency<Self::AccountId, Balance=BalanceOf<Self>>; ` 
  with `type BalanceOf<T> = <<T as Trait>::Currency as ArithmeticType>::Type; `

* improve decl_storage when it explicit serde bound: basically don't try to be smarter than rust and just use where clause.
2019-02-19 17:13:59 +01:00
Tomasz Drwięga 9a2f1b2007 Fix linked map for trait types and Option (#1809)
* Fix linked map for traits.

* Fix Option<_> variant.

*  Improve naming a tad

* Rebuild runtime

* Encapsulate private data in the inner module.

* Bump impl version.

* Fix deriving codec in srml-example.

* Fix derivation without importing parity-codec-derive.

* Fix config() for map.
2019-02-18 19:23:00 +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
Gautam Dhameja 7708490b27 Added demo module to show explicit imports of macros (#1770)
* added demo module to node template

* updated comments

* replaced demo with updated template module

* Personal preferences here

* fixed comment inside macro
2019-02-13 16:45:43 +01:00
Stanislav Tkach ff5e4ca87e Migrate everything to the 2018 edition (#1758) 2019-02-13 11:45:59 +01:00