Commit Graph

54 Commits

Author SHA1 Message Date
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
Sergey Pepyakin 5b28147d27 Update wasmi (#1119)
* Update wasmi to 0.4.2

* Add simple benchmarks.
2018-11-16 17:16:42 +01:00
Bastian Köcher 0628ce94bb Make sure to call the runtime trait functions (#1129)
* Make sure to call the runtime trait functions

The runtime trait functions export their functions as extern c
functions. These functions itself call the trait functions. This commit
makes sure that the trait functions are called and not functions with
the same name that are implemented for the runtime.

* Update the wasm files
2018-11-16 16:14:49 +01:00
Robert Habermeier 5d5bbcccfb rename fg-primitives to more verbose name (#1123) 2018-11-16 08:36:04 +01:00
Bastian Köcher 276ec5f85d Try to get grandpa tests compiling again (#1121)
* Revert "start to refactor block import wrapper a bit"

This reverts commit b919de49e1a82422a0870b66100832d531174771.

* Refactor grandpa stuff to get tests almost compiling

* Fixes after rebase

* Fixes merge compile errors
2018-11-16 07:44:51 +01:00
Robert Habermeier 913513d983 Merge branch 'rh-grandpa-dynamic2' of github.com:paritytech/substrate 2018-11-15 17:49:36 +01:00
Bastian Köcher 3cd2739f66 Fixes GrandpaApi implementation and usage 2018-11-15 17:34:55 +01:00
Svyatoslav Nikolsky fa84cec382 Fetch changes trie roots + CHT-based proof for these roots (#896)
* build CHT for changes tries roots

* collect chnages tries roots proof in key_changes_proof

* flush check_changes_proof

* fixed compilation

* LightDataChecker now has a ref to the blockchain

* continue passing proofs

* new light db tests

* more CHT tests

* more tests for key changes proof when headers are missing

* lost files
2018-11-14 16:06:10 +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
Svyatoslav Nikolsky 6e3c56c135 Changes tries: support forks (#950)
* forks support in changes trie storage

* moved convert_hash to primitives

* optimize ChangesTrieRootsStorage::root when anchor is canonicalized
2018-11-13 12:17:14 +01:00
Luke Schoen 037f9dde10 docs: Extends #999. Remove disused package readmes. Rename to sr-metadata. Fix Readme Rustdoc names (#1016)
* docs: Remove safe-mix since is no longer local dependency

* docs: Fix existing packages link. Still only includes Substrate Core

* docs: Remove empty package Readmes. Remove old docs links. Rename to Readme

* docs: Remove link to old docs

* misc: Merge latest from master. Renaem to sr-metadata. Fix list of RustDoc package names

* Rename substrate-metadata to sr-metadata, since it is in the "srml" subdirectory

* Change example to use package name that opens all packages in RustDocs

* Fix list of packages names that are available to open in RustDocs

* fix typo

* fix ordering of CLI options and add missing backslash
2018-11-12 21:18:06 +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
Gav Wood 57b2896332 Remove unneeded Serde requirements (#1076)
* Remove superfluous serde requirements.

* Try to ensure hash is serde

* Fixups

* Building again

* Attempt to reenable Block (doesn't build)

* Fixes compilation for node cli

* Fixes test compilation

* Fix wasm

* Fix tests

* Remove unneeded changes

* Fix up comments

* Reenable some code

* Compile error when origin misused.

* Remove unnecessary includes of `serde_derive`

* Cleanups
2018-11-12 18:40:18 +01:00
David 7eef5cc3f8 Update substrate to use libp2p master as of nov 9 (#1095)
* WIP

* Use latest lip2p master
2018-11-09 13:32:29 +00: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
Sergey Pepyakin 9072fce658 srml-contract: Sandbox mem IO according to COMPLEXITY.md (#939)
* Sandbox mem IO according to COMPLEXITY.md

* Fix tests.

* Update root hash for deploying contract test.
2018-11-05 19:23:16 +01:00
Guanghua Guo c3809fe962 Delete unuse extern (#941) 2018-11-02 21:05:37 +01:00
Sergey Pepyakin ac4a188e15 Use the upstream version of integer-sqrt. (#1041) 2018-10-31 15:40:59 +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
Bastian Köcher d3f2a00793 Multiple improvements to the decl_module! macro (#953)
* General `decl_module` improvements

* Make `deposit_event` implementable by `decl_module!`

* Make `decl_module!` implement calls directly

* Regenerate the wasm file after master rebase
2018-10-26 12:34:25 +02:00
Bastian Köcher f8896f954d Make decl_storage! assume less about the environment (#956) 2018-10-25 09:44:47 +02:00
Bastian Köcher 6244b6a3b9 Encode Metadata once instead of two times (#946) 2018-10-25 09:36:57 +02:00
Bastian Köcher 1ba73e0e88 Make decl_module! implement OnFinalise (#947) 2018-10-23 09:58:15 +02:00
Gav Wood 8a9ffeaea2 Add runtime so that cargo install works (#940) 2018-10-20 23:01:49 +02:00
Gav Wood 583c24f017 Add Assets module (#925)
* Add Assets module

* Fixes

* Fix

* Update comments

* Support `GenesisConfig` without any fields

Fixes: #923

* Do not generate an empty `GenesisConfig`, instead generate no `GenesisConfig`
2018-10-20 12:43:00 +02:00
Svyatoslav Nikolsky ca38fd72f6 Moved DigestItem impl to impl_outer_log (#932)
* moved DigestItem impl to impl_outer_log

* Enable backtrace collecting on the CI

* internal module is not required in impl_outer_log

* Revert "internal module is not required in impl_outer_log"

This reverts commit 5430446971cdf5fd5735863b86cd08a11d35d1dd.

* Revert "moved DigestItem impl to impl_outer_log"

This reverts commit 8872bbee963dbb4316251222f5c0757303fb3f52.

* Revert "Revert "moved DigestItem impl to impl_outer_log""

This reverts commit 47afd59682f8828665bd9cfb293b40ce4c4787af.

* Revert "Revert "internal module is not required in impl_outer_log""

This reverts commit 9ae640010c00ef134099d5b6a4430d330be134b2.

* More diagnostics

* check if only 1 test fails

* test is back + some "traces"

* removed some traces

* removed "traces"
2018-10-19 09:47:09 +02: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
Benjamin Kampmann ac4bcf879f Generalize the Consensus Infrastructure (#883)
* Split out Consensus
* Supply ImportQueue through network-service
  - simplify ImportQueue.import_blocks
  - remove Deadlock on import_block
  - Adding Verifier-Trait
  - Implement import_queue provisioning in service; allow cli to import
* Allow to actually customize import queue
* Consensus Gossip: Cache Message hash per Topic
2018-10-16 13:40:33 +02:00
Bastian Köcher 6b4b8b8f8e Runtime API clean up (#892)
* Rename `NewTxQueue` to `TaggedTransactionQueue`

* Remove `BlockBuilder` API and support adding documentation to the API functions

* Adds new `BlockBuilder` API

* Fixes compilation with new `BlockBuilder` API

* Some more cleanup

* Cargo.lock update

* Try to fix on stable
2018-10-09 14:01:23 +02:00
Bastian Köcher 2c65ad6c7b Refactor the runtime API to use traits. (#878)
* Add missing `As` imports.

* Adds new API traits that will be used by the client and runtime

* Switch consensus to new API's

* Switches transaction-pool to new API's

* Move runtime api stuff into its own crate

* Adds `impl_apis!` macro for implementing the new API traits

* Make `metadata` return directly a blob

* Runtime replace `impl_stubs!` with `impl_apis!`

* Switches to none feature based approach for declaring the different API traits

* Fixes compilation error

* Fixes errors

* Make the `decl_apis!` trait usable from the outside

* Make the `test-client` use the new API traits

* Remove last `impl_stubs!` bits and move some of them into wasm executor for tests

* A little bit more documentation
2018-10-09 10:58:29 +02:00
guanqun 1cc0e3b6ea Enhance decl storage (#777)
* enhance macro decl_storage()

* update the state root hash

* fix one comment
2018-10-05 14:20:32 +02:00
Arkadiy Paronyan a5a7dd2480 Fixed transaction propagation (#850) 2018-09-30 16:48:41 +01: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
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
Arkadiy Paronyan 29c9719568 Support authoring for multiple runtime versions (#816) 2018-09-27 13:56:40 +01:00
Sergey Pepyakin 98e0a3a55a Contracts: Add transfer event (#801) 2018-09-25 20:49:18 +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
Gav Wood 25393abef8 Rewards & slashes proportional to the least-slashable validator (#781)
* Initial stuff

* Treasury now mints based on lowest staked.

* Tests build

* Fix tests

* Fix hashes

* Fix tests & grumble
2018-09-21 09:10:16 +02:00
Gav Wood 67bf1a6eaa Transaction eras (#758)
* Initial groundwork

* A mess.

* Integrate

* Fix tests

* Unit tests

* Tests for unchecked_extrisnic

* fix tab

* Improve binary format.

* fix tests

* Rename extrinsic-pool -> transaction-pool

Closes #770

* Implement unimplemented.

* typo
2018-09-20 14:01:01 +02:00
Bastian Köcher 5d64be26c3 Replace JSON metadata with custom metadata structures (#766)
* Move module metadata from json string to custom metadata

* Revisit the metadata structures

1. Move the structures into the metadata crate.
2. Switch to using Cow/MaybeOwnedArray to support Encode/Decode

* Adapt to new metadata structures

* Convert event json metadata to new metadata structures

* Convert storage json metadata to new metadata structures

* Convert runtime metadata from json to new metadata structs

* Implements new metadata structures in client and runtime

* Fixes errors on `no_std`

* Fixes errors after rebasing master

* Do not use `Cow` anymore in metadata

Also replace `String` with our own type definition `StringBuf`.
This fixes compilation on `no_std`.

* Wrap `RuntimeMetadata` in `RuntimeMetadataVersioned` to support versioning

* Move metadata into `srml` and make core unaware of the implementation
2018-09-20 07:35:32 +02:00
Bastian Köcher 3c0da110f3 Bkchr impl macros scope (#774)
* Fixes compilation of sandbox tests

* Make `impl_outer_log!` scope independent
2018-09-20 00:02:29 +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
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
Gav Wood 3f96419665 Remove unneeded code (#737) 2018-09-13 18:08:45 +02:00