Commit Graph

231 Commits

Author SHA1 Message Date
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
Maciej Hirsz 263786df05 Telemetry refactor (#757)
* Telemetry Refactor

* Cleanup

* Sleep after clearing Sender on error
2018-09-17 18:43:47 +02:00
Bastian Köcher 597ea41cd4 Implement construct_runtime! macro (#751)
* Make `system` module renamable in `impl_outer_event!`

* Implement `construct_runtime!` macro

This macro generates code for calling all the common `impl_outer_*` macros.

* Add documentation

* Fixes wrong declaration of `contract`

* Update dependencies to work on `no_std`

* One more `Cargo.lock` update

* Address comments
2018-09-17 17:27:22 +02:00
Guanghua Guo 11578a8319 Not use extern (#748)
* Not use extern

* Update Cargo.lock
2018-09-17 08:26:33 +02:00
Sergey Pepyakin 56def2a38b Build project with --locked on CI (#743)
* Add --locked to the cargo build

* Remove trailing spaces

* Update Cargo.lock
2018-09-15 10:06:20 +02:00
Gav Wood a7f8f0f1bd Remove redundant code and merge rest into rt-std (#735)
* Remove redundant code and merge rest into rt-std

* Update lib.rs
2018-09-13 14:54:24 +02:00
Arkadiy Paronyan 0ed48c89ab Remove dependency on the parity repo (#734) 2018-09-13 14:25:38 +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
Gav Wood 418a9bf243 Remove PoC-1 back-compat hacks (#709)
* Remove PoC-1 back-compat hacks

* Fix lingering Keccak references

* More keccak exorcism

* Fix test

* Final fixes
2018-09-11 15:17:07 +02:00
Sergey Pepyakin 6c1b2c27d1 Integrate contracts into substrate-demo runtime (#675)
* Introduce data and salt into ContractAddressFor

* Accept salt arg in ext_create.

* Integrate contracts into the demo runtime

* Make libcontract compile to wasm

* Remove salt parameter.

This now is concern of userspace.

* Rebuild binaries.
2018-09-10 19:45:19 +02:00
Bastian Köcher ba23d033a1 Implements json_metadata RPC call (#692)
* Adds `impl_json_metadata!` for generating all metadata of a runtime

* Adds `json_metadata` RPC call

* Adds simple test for the `json_metadata` RPC call

* Implements json metadata in the demo runtime

* Fix indent

* Adds missing copyright headers

* Dispatch json metadata renamings and improvements

* Replaces `format!` & `String` with `Vec<JSONMetadata`

* Implements `Encode` and `Decode` for JSONMetadata

* Make `impl_json_metadata!` compileable on `no_std`

* Adapt the client to decode the correct type for `json_metadata`

* Fixes compile error and warning

* Whitespace
2018-09-10 18:34:17 +02:00
Arkadiy Paronyan fea750511e Bring substrate-demo up to date (#658)
* Updating substrate-demo

* Consenus fixes

* Reverted toolchain change

* Adjusted timeout formula

* Simplfied proposal creation

* Fixed tests

* Fixed a few small issues

* 2017->2018

* Style

* More style

* Renamed demo executable to substrate

* Style

* Fixed compilation after merge

* Style
2018-09-10 17:54:32 +02:00
Gav Wood bcc26dd30a Council motions for approving treasury proposals (#694)
* Treasury in runtime, generic approve/reject

* Add logic for council origin

* Add tests.

* Configurable number of members in EnsureMembers

* Fix grumbles

* Fix spelling

* Comment
2018-09-10 16:02:59 +02:00
David 393c3b5af7 LocalCallExecutor and RemoteCallRequest generic over Hasher and NodeCodec (#573)
* LocalCallExecutor and RemoteCallRequest generic over Hasher and NodeCodec

* Fix client/db

* Use new triehash

* Use new triehash
Don't use ethereum-types from rlp

* New triehash

* Use new triehash

* fixes and rlp without ethereum-types

* Lockfile

* lockfile

* Rename enumerated_trie_root to keccak_rlp_enumerated_trie_root

* Rename ordered_trie_root -> keccak_rlp_ordered_trie_root
Rename trie_root -> keccak_rlp_trie_root

* Fix panic message

* Kick the ball one step up the ladder

* Normalize function signatures between wasm and native

* Sort out compilation and test errors

* Cleanup

* Constrain the wasm-version using an ExternTrieCrypto trait that is implemented only for KeccakHasher

* hashdb is not optional

* lockfile

* Runtimes

* Missing bounds

* wasm binaries

* lockfiles

* binaries

* LocalCallExecutor uses concrete hasher/codec

* Use binaries from master

* Externalities is concrete
RuntimeInfo is not generic

* whitespace grumble

* lockfile

* lockfile and binaries
2018-09-09 14:56:50 +02:00
Gav Wood 761bc9f763 New extrinsic dispatch model (#678)
* System and Balances switched to new call model

* Fixed up executive for new pardigm

* Consensus works with Origin

* Timestamp ported over

* Session now compatible

* Ported staking

* Treasury compatible

* Expunge MaybeEmpty

* Make democracy work

* Council compatible

* Remove some aux-dispatch stuff and fix balances

* Rename aux -> origin, fix contracts

* Fix test

* Fix example

* Update macro to remove superfluous cruft

* Make work with new macro

* Tests

* Fix some tests

* Tests

* Fix grumbles

* Final grumble
2018-09-07 19:28:18 +02:00
Bastian Köcher 6bc48fdafc Implement json metadata for outer events (#672)
Progress on: #535
2018-09-07 18:59:04 +02:00
Pierre Krieger abf64386bb Improvements to the Kademlia system (#688) 2018-09-07 18:56:38 +02:00
Pierre Krieger af3ad2109f Update to latest libp2p (#673) 2018-09-06 14:56:41 +02:00
Svyatoslav Nikolsky be7cb74b06 DigestItem trait (v2) (#650)
* DigestItem trait

* removed autoimpl in impl_outer_log

* StubDigestItem -> ()
2018-09-05 13:36:23 +02:00
David 5998a55cc3 Fetch parity-common dependencies from crates (#617)
* Fetch parity-common dependencies from crates

* Update triehash

* Fix code to fit latest triehash
Fetch kvdb-rocksdb from crates

* type params

* lockfile

* lockfiles

* wasm binaries and lockfile
2018-09-05 11:58:32 +02:00
Pierre Krieger 0d422878a3 Upgrade to libp2p master (#660) 2018-09-05 09:05:28 +02:00
Svyatoslav Nikolsky 8eb4589ca6 Replace old headers with CHT in light clients (#512)
* storage proofs

* CHT
2018-09-04 21:57:55 +02:00
Gav Wood 7657a2326f Introduce treasury and document (#646)
* Introduce treasury and document

* Revert bad changes

* More reversions

* Add example crate

- Remove HasPublicAux
- Rename Concrete -> Runtime

* Actually commit stuff

* Changes

* Propagate block number in finalise.

* Fix and build example

* Fixes.

* Fix compilation for treasury.

* Fix the treasury test

* Tests

* Fix.

* Fix tests

* Fix a few grumbles

* Fixes

* Fix grumbles
2018-09-04 17:29:06 +02:00
Gav Wood 69781a7ccc Off-the-table staking preference (#656) 2018-09-04 17:28:50 +02:00
Bastian Köcher 6d149c570d Implement function json_metadata in decl_module! (#654)
The new function `json_metadata` returns the module declaration
as a json string.

Progress on: #535
2018-09-04 11:57:26 +02:00
Pierre Krieger 360ffa2dbb Add a reputation system (#645)
* Add a reputation system

* Fix tests

* Don't try to dial peers to which we are already connected

* Use the master branch of libp2p
2018-09-04 08:52:20 +02:00
Guanqun Lu beee3d4092 WIP on chain heap (#639)
* move heap size on chain

* fix the interface change

* decode heap size

* fix code comments

* fix comment

* update Cargo.lock

* rename to heappages

* add one heap pages variable in runtime
2018-09-01 08:41:46 +02:00
Gav Wood 8281618e50 Separate out staking module into balances and payment (#629)
* Initial commit.

* Split out balances module

* Minimise Balances trait requirements

* Fix up balances, remove balances stuff from staking

* Split off and fix up staking module

* Fix executive tests

* Fix up democracy module

* make council work again

* Remove unneeded cruft from democracy

* Fix up contract module

* Fix up rest of tests

* Fix minor TODOs

* Fix tests

* Remove superfluous code

* Move offline inherents to consensus module.

Fixes #630

* Version needs Decode.

* Move Decode back

* Fix nits

* Refactor to allow custom message
2018-08-30 18:43:38 +02:00
Robert Habermeier a0069f5fe2 Forward-port BFT fixes from v0.2 and restructure agreement cancelling (#619)
* more accurate consensus superseding logic

* mild revision to `can_build_on` logic

* fix a deadlock when spawning agreement as non-authority

* dropping BFT future before poll doesn't lead to service deadlock

* push cancel to BFTfuture rather than waiting for task
2018-08-28 12:28:28 +01:00
Gav Wood 278a054b81 Introduce Runtime Events (#607)
* Squashed commit.

New slashing mechanism (#554)  …
* Slashing improvements

- unstake when balance too low
- unstake after N slashes according to val prefs
- don't early-terminate session/era unless unstaked
- offline grace period before punishment
* Fix warning
* Cleanups and ensure slash_count decays
* Bump authoring version and introduce needed authoring stub
* Rename
* Fix offline tracker
* Fix offline tracker
* Renames
* Add test
* Tests
* Tests.
Remove accidental merge files.
Merge remote-tracking branch 'origin/master' into gav-new-pos
Version bump, fixes (#572)  …
* Bump version, don't propose invalid blocks
* Fix build.
* Fixes.
* More fixes.
* Fix tests.
* Fix more tests
* More tests fixed
Fix merge
Fix accidental merge bug
Fixes.
Staking failsafes  …
- Don't slash/unstake/change session when too few staking participants
- Introduce set_balance PrivCall
Make minimum validator count dynamic.
test fixes
Fix tests.
Fix tests
Fix tests, update readme.
Merge remote-tracking branch 'origin/master' into gav-new-pos
Test with release.
Use safe math when dealing with total stake
Fix test again.
Introduce events into runtime.
Fix tests
Add events for account new/reap
Integration-style tests for events.

* Remove old code
2018-08-28 12:11:40 +01:00
Guanghua Guo f5c684dca6 update substrate/extrinsic-pool (#616) 2018-08-28 10:54:22 +01:00
Gav Wood f59bcd15da New slashing logic (#570)
* New slashing mechanism (#554)

* Slashing improvements

- unstake when balance too low
- unstake after N slashes according to val prefs
- don't early-terminate session/era unless unstaked
- offline grace period before punishment

* Fix warning

* Cleanups and ensure slash_count decays

* Bump authoring version and introduce needed authoring stub

* Rename

* Fix offline tracker

* Fix offline tracker

* Renames

* Add test

* Tests

* Tests.

* Remove accidental merge files.

* Version bump, fixes (#572)

* Bump version, don't propose invalid blocks

* Fix build.

* Fixes.

* More fixes.

* Fix tests.

* Fix more tests

* More tests fixed

* Fix merge

* Fix accidental merge bug

* Fixes.

* Staking failsafes

- Don't slash/unstake/change session when too few staking participants
- Introduce set_balance PrivCall

* Make minimum validator count dynamic.

* test fixes

* Fix tests.

* Fix tests

* Fix tests, update readme.

* Test with release.

* Use safe math when dealing with total stake

* Fix test again.

* Fix grumbles.
2018-08-27 17:11:04 +02:00
Sergey Pepyakin 4e9f40840c Contract signatures checking (#478)
* Convert T in vm::Ext to a associated type

* WIP

* Fix BTreeMap

* Extract prepare module from vm.

* Move tests as well.

* Fix doc comment.

* macro for env defintion

* Fix prepare tests.

* Clean up

* Renamings

* Refactor scan_imports

* Improve docs

* Docs.

* Add some tests for sandbox module

* Clean up

* Use Error::Instantiate instead of ::Deserialize

* Add test for imports

* Add wrong sig import

* Clean up

* Rebuild binaries.

* Use "another_module" instead of obscure "vne"

Since "vne" looks like an actual typo
2018-08-27 16:09:10 +02:00
Arkadiy Paronyan 3514ae9807 More generic extrinsic pool (#579) 2018-08-20 14:54:03 +02:00
Sergey Pepyakin 3f366cc738 Implement it. (#569) 2018-08-19 18:50:42 +02:00
Robert Habermeier 3ef4463c3a [forward port] continue rounds (#583)
* keep rounds consistent when encountering bad block

* fix interval logic

* Fixed indentation
2018-08-17 22:12:37 +02:00
Robert Habermeier add49f1f79 Merge branch 'master' into split-substrate 2018-08-15 13:24:27 +02:00
Gav Wood 3d6aaab26c Refactor/substrate state machine generic (#553)
* Genric over hasher

* WIP start adding NodeCodec

* Add codec to TrieBackend

* Typechecks

* Fix error type

* Cleanup

* Tests build (and fail)

* Fix tests: don't use MemoryDB::default()

* Lockfile

* Address grumbles

* Teach environmental! about generics

* Add Finder artifacts

* whitespace

* Add a toy impl of Hasher and plug it in to Externalities

* Use `uint` and `fixed-hash` from `parity-common`
Remove unused U512
Add test to ensure H256 impls heapsizeof

* lock file updates

* Make hashes Encodable/Decodable

* lock file updates

* Impl FromIterator for TestExternalities so we can collect() and use map!

* Use rustc-hex from crates
Use rlp from master so dependencies do not mess up the scope

* Fix tests in runtime-io

* lockfile shenanigans

* Add a BlakeHasher impl

* Use BlakeHasher in runtime-io

* lockfile updates

* ws

* Add a Blake2/RLP-flavoured NodeCodec

* Use Blake-flavoured Hasher and NodeCodec

* lockfile

* Implement PartialEq and Default for TestExternalities

* Add note about limitations of environmental!

* Make it compile, but this is probably broken

* Derive Debug so tests in executor can work

* Make executor use BlakeHasher

* ws

* WIP make client generic

* typechecks

* cleanup

* client tests pass

* Fix client/db

* cleanup

* Fix network

* Fix rpc

* Fix service

* Make TestExternalities work better au lieu d'un HashMap

* Fix tests in council

* Fix tests in contract

* Fix tests in council

* Fix democracy

* Add comment about odd-looking reexports in tests

* Don't need to load branch

* Fix staking

* Fix session

* Some polkadot fixes and lockfile

* Fix executive

* fixup lockfile

* Fix polkadot/api

* Fix polkadot/service

* Fix polkadot/runtime tests

* Fix tests in test-runtime

* Test fixes

* Fix missing component in the `std` feature

* Use PhantomData and Result from core

* Fix paths
Use core

* load heapsize on wasm

* implement `HeapSizeOf` for wasm

* Add toy impl of `blake2_256` for no_std

* lockfile

* Use kvdb* from parity-common and fix errors

* rebuilt lockfile

* Add dummy impl of `on_advance_round` for rhododendron::Context

* Fix build after merge

* Add HeapSizeOf bound where needed

* Sort out dependencies for no_std

* Add HeapSizeOf bound where needed

* use temp branch pending PR merges

* Remove unneeded tests

* Lock file and wasm artifacts

* lockfile

* Use magic commit for libp2p

* Cleanup

* Implement blake2_256 for no_std

* Back on parity-common master

* missing type params

* Update Cargo.lock

* whitespace

* Rename concrete Rlp node codec "RlpCodec" and use everywhere
Implement a Keccak-flavoured Rlp NodeCodec and use everywhere
Add a KeccakHasher

* Switch to use KeccakHasher

* Lock file and runtimes

* fixup lockfile

* Fix outstanding issue using concrete types (thanks @gnunicorn)

* Cleanup

* More cleanup

* Comment out Blake2 Hasher

* implement ext_keccak256

* Address todo: FetchChecker is generic

* all tests passing
2018-08-15 13:13:11 +02:00
Guanqun Lu bfbe1fe18b send memory usage and cpu usage to telemetry (#499)
* send memory usage and cpu usage to telemetry

Fixes #443, however, it doesn't send IO usage, as it's not available in
this crate.

* fixes according to Gav's comments

* fix grumbles, send basictypes in telemetry
2018-08-15 10:04:44 +02:00
Robert Habermeier 934829c052 get everything building 2018-08-14 18:59:32 +02:00
Tomasz Drwięga 41b7b2a943 RPC: Pending Extrinsics (#563)
* Expose extrinsics in pool.

* Add test.

* Use latest transaction pool.

* Fix compilation.
2018-08-14 18:51:30 +02:00
Pierre Krieger 68c1fc0b66 Update libp2p (#559) 2018-08-14 13:14:04 +02:00
Svyatoslav Nikolsky c346af29e0 Fetching storage proofs by light client (#252)
* storage proofs

* fixed grumbles

* Update lib.rs
2018-08-12 12:48:40 +02:00
Robert Habermeier e8f21cf0c9 Vote out offline authorities (#524)
* notify when an authority appears to have missed their block

* Runtime API

* offline tracker

* Move to consensus

* generating reports of offline indices

* stubbed-out evaluation logic

* Slashing data pathwat

* usize -> u32

* Slash bad validators.

* update to rhododendron 0.3

* fix compilation of polkadot-consensus

* Support offline noting in checked_block

* include offline reports in block authorship voting

* do not vote validators offline after some time

* add test for offline-tracker

* fix test build

* bump spec version

* update wasm

* Only allow validators that are possible to slash

* Fix grumble

* More idiomatic

* New Wasm.

* update rhododendron

* improve logging and reduce round time exponent

* format offline validators in ss58
2018-08-11 11:29:30 +02:00
Pierre Krieger 3128f258ba Update libp2p and some log (#532)
* Update libp2p and some log and yamux

* Replace trace! with info!

* Only have one log message on disconnect
2018-08-10 13:00:16 +02:00
Gav Wood 36122833a1 Remove safe-mix (#521) 2018-08-09 15:26:01 +02:00
Pierre Krieger 6f4a401afa Some networking cleanups (#504)
* Some networking cleanups

* Fix tests

* Fix wrong port in new_local
2018-08-08 20:05:40 +02:00
Tomasz Drwięga 96b3a8f92f Derivable Encode & Decode (#509)
* Derive macro for simple structs.

* Derive Encode/Decode wherever we can.

* Derive for enums.

* Support discriminant.

* Get rid of some repetition.

* Support custom indices.

* Derive codec for enums wherever possible.

* Fix no_std

* WASM rebuilt

* Avoid excessive import.

* Fix compilation.

* Address review grumbles.
2018-08-08 17:47:22 +02:00
Robert Habermeier 21346f34f8 Availability/Extrinsic store (#465) 2018-08-06 11:55:55 +02:00