Commit Graph

134 Commits

Author SHA1 Message Date
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
Svyatoslav Nikolsky d58b23f759 fix tests by rebuilding wasm(s) (#1463) 2019-01-17 08:22:45 +01:00
Gav Wood c9f047fe84 Split Indices module from Balances (#1404)
* Indices module

* Remove indices stuff from balances

* Rejob node, move Lookup into system.

* Fix up some modules.

* Fix democracy tests

* Fix staking tests

* Fix more tests

* Final test fixes

* Bump runtime versions

* Assets uses compact dispatchers

* Contracts module uses indexed addressing

* Democracy has more compact encoding

* Example now demonstrates compact eencoding

* Sudo uses indexed address

* Upgrade key also uses indexed lookups

* Assets more compact types.

* Fix test

* Rebuild runtime, whitespace

* Remove TOODs

* Remove TODOs

* Add a couple of tests back to balances.

* Update lib.rs

* Update lib.rs
2019-01-16 15:57:19 +01:00
Marcio Diaz 9151349b2d Make use of NLL in client crate (#1436)
* fix: set edition to 2018 in Cargo.toml.

* fix: refactor function to make use of NLL.

* fix: result of applying 'cargo fix --edition' command.

* fix: removes extern crate

* fix: remove module uses from lib.rs

* fix: tests imports
2019-01-16 11:49:26 +01:00
Sergei Pepyakin a73280728f Update wabt to to not require python dependency (#1420) 2019-01-14 21:53:09 +01:00
Svyatoslav Nikolsky 616716cb4b GRANDPA finality proof draft (#1268)
* grandpa finality proof

* prove GrandpaApi::grandpa_authorities using parent block + some docs

* create justification when consensus data is changed

* generate justifications periodically

* test for ConsensusChanges
2019-01-11 19:25:03 +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
Gav Wood d6ef5f9215 Urgent safety fix for #1371 (runtime version) 2019-01-10 16:06:19 +01:00
Gav Wood 37fa74b891 Updates for CC's recent upgrade (#1381)
* Updates for CC's recent upgrade

- Version bump to 0.9.2
- Runtime version bump to v14
- Avoid misuse of error return type for system_health RPC

* Fix tests
2019-01-10 11:34:25 +01:00
Gav Wood fc5fdab5f2 Cherry updates (#1373)
- Introduce compact extrinsics into Cherry
- Remove UpgradeKey from Cherry (Sudo is enough)
- Remove networkId from Cherry properties
2019-01-09 12:52:16 +01:00
kyegupov 079eb39559 Test compiled wasm code in test-runtime (#1364)
* Test compiled wasm code in test-runtime

* Drop lazy_static

* Move substrate-executor to dev-dependencies
2019-01-09 11:27:53 +01:00
Arkadiy Paronyan b104c02eb6 State cache and other performance optimizations (#1345)
* State caching

* Better code caching

* Execution optimizaton

* More optimizations

* Updated wasmi

* Caching test

* Style

* Style

* Reverted some minor changes

* Style and typos

* Style and typos

* Removed panics on missing memory
2019-01-08 13:13:13 +01:00
Shawn Tabrizi c4010edb75 Updating parking_lot dependencies to 0.7.1 (#1361) 2019-01-08 11:15:42 +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
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
Bastian Köcher d15cc63370 Make deposit_event work with none generic events (#1309)
* Make `deposit_event` work with none generic events

`fn deposit_event() = default` will now be used for none generic events
`fn deposit_event<T>() = default` is now for generic events.

* Update wasm files

* Fixes some spelling mistakes

* Update wasm and fix new module
2018-12-22 17:37:05 +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
Gav Wood 353a87732d Bump to v0.9.1 (#1307) 2018-12-20 20:30:54 +01:00
cheme 23634b6b95 Include default values in storage metadata (#1264)
* Add a 'default' field to metadata. It contains code to generate the
default value.

* wasm update

* Make 'default' field an `Option`

* Boxed fn is not static, that won't be fine

* static fn won't do it to as it cannot get T param, will try fat trait

* Fat pointer over phantom data compatible with static instantiation

* DecodeDifferent is cool, using it for decoding.

* using once cell to do what would require copying lazy_static internals.

* Remove cache when no_std (non compatible deps)

* wasm bins update

* Fuse tooling struct and enum derive.
2018-12-20 14:31:03 +01:00
Wei Tang 66ad1ed974 Avoid duplicate depencency declare via package re-export (#1287)
* node/runtime: Avoid duplicate dependency via package reexport

* core/test-runtime: Avoid duplicate dependency via package reexport

* Update lock file
2018-12-19 17:47:10 +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
Bastian Köcher 090ca9ee7c Upgrade sysinfo to fix compilation on windows (#1267) 2018-12-17 11:10:50 +01:00
Sergei Pepyakin 39a2afc44f Update wabt to 0.7 (#1276) 2018-12-16 21:07:15 +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
Sergei Pepyakin ce91da6b89 srml-contract: introduce ext_caller external function (#1255)
* Implement ext_caller.

* Rebuild wasm.

* Update COMPLEIXTY.md
2018-12-12 14:00:21 +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
Bastian Köcher acf1b77bcd Make decl_module not require a return type for functions (#1230)
If no return type is specified, `Result` is added and
`Ok(())` is returned by default.

Closes: #1182
2018-12-10 13:36:37 +01:00
Wei Tang 52ba9a5605 Update fixed-hash pin version and fix cargo locks (#1241) 2018-12-10 11:58:06 +01:00
Bastian Köcher 1f6719346f Make runtime api generate version and identifier information (#1226)
* Make `decl_runtime_apis!` implement `RuntimeApiInfo` for all runtime
apis

* Make the runtime side generate the info constants as well

* Make `RuntimeApiInfo` implementation use the correct generics

* Adds a test for the runtime api info stuff

* Remove duplicated code by using block from `test-client`

* Adds `compile_fail` tests for `api_version`

* Adds documentation for `api_version`

* Make `impl_runtime_apis!` generate `RUNTIME_API_VERSIONS`

* Update documentation and tests for `RUNTIME_API_VERSIONS`

* Implement `has_api` by using the `RuntimeApiInfo`

* Make `impl_runtime_apis` check that trait identifiers are unique

* Prefix all runtime api function with the corresponding trait

So `execute_block` will be called `Core_execute_block`.
This makes it possible to have traits implement a function with the
same name.

* Rebase master

* Update after master rebase
2018-12-10 11:48:07 +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 1dc56b48ab Make AuthorityId serialize/deserialize to/from ss58 (#1180)
* Make `AuthorityId` serialize/deserialize to/from `ss58`

* Updates the wasm files
2018-11-30 16:52:48 +01: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
Guanghua Guo 309f627d5c Delete unused extern (#1178) 2018-11-30 07:27:30 +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
Bastian Köcher 41aec063df Make grandpa export its calls (#1153) 2018-11-22 17:13:43 +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