Commit Graph

225 Commits

Author SHA1 Message Date
Tomasz Drwięga c2065aafd6 Remove limitation to 256 transactions, don't construct a vector. (#2321)
* Remove limitation to 256 transactions, don't construct requires vector.

* Bump impl version.
2019-04-19 13:22:53 +02:00
thiolliere 450c03d03e Fix contract child usage (#2299)
* Fix contract child usage

* bump implementation version
2019-04-16 18:09:34 +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
DemiMarie-parity ae916c6c5e Add basic BABE consensus type (#2165)
* Add basic BABE consensus type

* Update core/consensus/babe/slots/Cargo.toml

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

* Fix parameterization and run `rustfmt`

* Respond to review comments

* Update various Cargo.lock files

* Revert "Update various Cargo.lock files"

This reverts commit af53d7624752a744320e9cbb25749fdd8e6f46d2.

* `BabeSealSignature` → `BabeSeal`

* Move slot code to its own crate

This was highly non-trivial, due to cyclic dependencies.

* Remove redundancy between AuRa and BABE

Some of the code duplication was removed using a macro.

* Fix build error

* Avoid non-`#[doc(hidden)]` re-exports

Also, bump some library versions in `Cargo.toml`.

* Remove dead code in AuRa

* Remove impl_slot macro

It was more trouble than it was worth.

Also, delete useless dependencies on Serde.

* AuRa and BABE need different DB keys

* Bring back `aura::Network`, but deprecate it.

* Improve docs and add `slot_duration` inherent method

* Add docs to `substrate_consensus_aura::SlotDuration`

* Add missing documentation and #![forbid(missing_docs, unsafe_code)]

* Add a #![forbid(missing_docs)]

* Remove dependency of `test-runtime` on `slots`

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

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

* Remove wrongly added file

* Fix copyright notice

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

* Bump `impl_version` and `spec_version`

* Fix deprecation version; remove spurious carets

* Update Cargo.lock

* Update dependencies
2019-04-15 07:41:07 +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
Andrew Jones 1e0c1d8850 Introduce ext_println to contract runtime (#2239)
* Implement `ext_println` in contract runtime

* Only allow contracts to import `ext_println` on dev chains

* Configure dev chain to allow contracts with `ext_println`

* Increment spec version

* Docs

* Rename config to the more specific enable_println
2019-04-11 15:49:17 +02:00
Bastian Köcher 0afc357a97 Throw a compile error for on_finalise and on_initialise (#2236) 2019-04-09 10:31:18 +02:00
Andrew Jones 03f3fb1442 Contract import/export validation (#2203)
* Reject validation of contract with unknown exports

* Validate imports eagerly

* Increment spec version
2019-04-06 13:23:56 +02:00
Bastian Köcher dce0b4ea49 Use storage_root of newly calculated header (#2216)
Instead of calculating the `storage_root` a second time, we just can
take the `storage_root` from the new header.
2019-04-05 17:50:38 +01:00
Xiliang Chen cb7a8161f5 code cleanup (#2206) 2019-04-04 16:55:55 +02:00
Bastian Köcher 671c0a5e11 Enable std feature for all dependencies in node-runtime (#2193) 2019-04-03 14:31:09 +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
Andrew Jones 4c115e3f2d Replace Vec<u8> with [u8; 32] for contract storage key (#2184)
* Replace Vec<u8> with [u8; 32] for contract storage key

* Read storage keys from sandbox memory into fixed size buffer

* Increment `impl_version`
2019-04-03 10:12:54 +02:00
thiolliere c98db99d80 implement contract events (#2161)
* implement contract events

* update runtime

* renaming

* update test code hash

* improve complexity details

* add deposit event base cost

* add test

* Revert "add deposit event base cost"

This reverts commit 58ec010c0f4f4f0e16935ad41da32aedd17a8c57.

* update test

* Revert "update test"

This reverts commit 6fe61a593ccf0d41f09a0b97472b28ed8751a999.

* Revert "Revert "add deposit event base cost""

This reverts commit 145e8a9bac15313a4c380aa66b94fd4d36fa3f6d.

* Fix format a bit
2019-04-03 08:20:01 +02:00
Robert Habermeier e6cc49cf63 ensure imbalances are properly accounted for (#2183)
* ensure imbalances are properly accounted for

* bump runtime version

* Update node/runtime/src/lib.rs
2019-04-03 08:16:58 +02:00
Kian Peymani b7eeb28de9 Fix Staking Accuracy issues. (#2180)
* Nasty patch for election

* cleanup

* a few more comments.

* minor fixes

* Improve comment
2019-04-02 17:57:56 +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
thiolliere a0e6d96de0 keep track storage bytes (#2154)
* refactor

* fix accountinfo creation + impl mem_stored

* add comment

* improve syntax

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

* rename current_mem_stored -> storage_size

* more explaination + more readable code

* bump impl version of node + builds

* delete builds
2019-04-01 19:14:55 +02:00
Gav Wood b5cab356e0 Remove runtime. 2019-04-01 15:49:24 +02:00
Bastian Köcher 137409f02a Remove execute_extrinsics_without_checks as it will not be required (#2145)
This functionality was added by me for Cumulus, but after better
understanding Cumulus, this will not be required.
2019-04-01 15:37:58 +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
DemiMarie-parity 63c3dd5a45 Fix compile errors in test suite (#2151) 2019-03-29 21:30:28 +01: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
Kian Peymani 958cc7efea Extended Balance Type for Staking's Election (#2134)
* First draft of extended balance type

* Test cleanup.

* Update staking docs.

* Add a good failing test case for quintill

* Bring back saturating.

* Some final fixes

* A few more.

* Update wasm; Bump spec;

* Re-bump.

* Custom lossy conversion from currency to vote

* remove print

* Fix reverse conversion issue.

* void. Re-trigger ci.
2019-03-29 16:30:15 +01:00
Gav Wood 086d55397b Proxy voting (#2137)
* Proxy voting in democracy

* Proxy voting for council elections

* Bump and build

* Kill proxy when account dead

* Rebuild wasm

* Fix democraxy delegation locking

* Update srml/council/src/seats.rs

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

* Update to use mutate
2019-03-29 16:07:04 +01:00
Gav Wood 5c9f306eb3 Use a context prefix for SS58 hash (#2141)
* Update to final ss58 spec

* Fix tests

* Rebuild
2019-03-29 15:44:57 +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
Xiliang Chen ea868b6e30 allow trailling comma in decl_event (#2117)
* allow trailling comma in decl_event

* Update srml/support/src/event.rs

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

* Update srml/support/src/event.rs

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

* Update srml/support/src/event.rs

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

* Update srml/support/src/event.rs

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

* Update srml/support/src/event.rs

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

* bump version and update wasm
2019-03-29 08:19:35 +01: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
thiolliere f9d0da0a18 storage doublemap in decl_storage (#1918)
* factorization

* introduce GenericUnhashedStorage

* implement generator and storage

* impl double map in storage macro

* improve StorageDoubleMapXX methods

* remove storage from example and impl test

* remove old comments

* wasm compatible

* improve imports

* rename storages

* update runtime impl version

* make code less verbose

* impl hash config for second key in double map

hash available are all of Hashable trait

* use double map in decl_storage for contract

* fix double map config issue

* add hasher into metadata

* update impl version and build wasm

* doc

* add attrs

* update metadata version

* update runtime version

* fix unused storage
2019-03-28 17:40:50 +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
thiolliere 29001cb469 Decouple contract from balances (#2081)
* decouple contract from balance

* update impls and builds

* set fees in contract module

* builds
2019-03-28 13:46:30 +01:00
Gav Wood 039acb9518 Fix subtle indices bug (#2128)
* Fix subtle indices bug

* Also fix balances divide by zero.
2019-03-27 17:46:30 +01:00
Shawn Tabrizi 1c1609342c Introduce ReservableCurrency Trait in Balances Module (#2124)
* Introduce `ReservableCurrency`

* Update Docs for `ReservableCurrency`

* Update Tests

* Bump spec and rebuild wasm

* Extra: Add a note to `slash()`

Discussion in Riot clarified the behavior of `slash()` and `can_slash()`. Trying to sneak clarifying comments about it into this PR

* Update lib.rs

* Don't drop the periods!

CC @shawntabrizi
2019-03-27 16:48:37 +01:00
Kian Peymani da124d74d1 Replace Overflow-Prone Operations in Staking with Saturating Arithmetic (#2115)
* Improve a few doc string

* Replace overflow-prone operation with saturating.

* Remove whitespace.

* Update wasm; Bump spec;

* Bump impl again.

* Fix review comments.
2019-03-26 14:39:14 +01:00
André Silva cee2166e4f srml: consensus: kill storage (#2098)
* srml: consensus: kill storage items

* srml: consensus: add test for set and kill storage

* runtime: bump spec_version update wasm blobs
2019-03-25 23:39:23 +00: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
Gav Wood 3ee0e69463 bond_extra should be authorised only from stash (#2096)
* bond_extra should be authorised only from stash, lest the controller
gets compromised.

* Fix tests

* Fix grumbles

* Pass compact balances
2019-03-25 19:35:28 +01:00
thiolliere 620e8dc8b9 impl MakePayment for balances instances (#2055) 2019-03-25 15:19:15 +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
Gav Wood 6fa40ec199 Fix up the offline validator API to accept controller (#2090) 2019-03-23 08:16:22 +01:00
Kian Peymani 564c954aa7 Self-Vote for Staking (among others.) (#2078)
* initial doc for the staking module

* Remove md style links.

* Remove todos.

* Add rust code types

* Rename and fix review notes.

* Add new md file

* Final touches.

* Migrate compleatly to rustdoc

* Update link

* Fix heading

* Final touches wrt the new template.

* Remove empty prereq.

* Fix more reviews

* Some final nits.

* Fix some side issues.

* Fix another set of reviews

* Fix + stabilize leftover reivews.

* Remove unused test parameters

* Fix typo.

* Merge redundant loops

* Adds phantom self-vote

* Fix broken tests.

* Refactor some names to match the reference.

* Remove redundant inner loops from election round.

* Introduce phragmen post-processing.

* Some fixes and todos.

* Fix some tests with new phragmen params

* Fix test

* Bump spec

* Fix wasm build

* Fix tests and phragmen fallback. Avoid double-controlling

* Fix and rebuild wasm

* Whitespaces, whitespaces everywhere.

* Rebuild

* Disable post-processing.

* Identify by stash, not controller account.

* Couple of fixes

* Fix first test

* Fix invulnerability_should_work

* Fix a couple more tests

* Fix more tests

* Fix more tests

* Fix more tests

* Fix some tests

* Fix update-ledger.

* Fix update-ledger.

* Fix another test

* Fix another test

* Fix rest of staking tests

* Remove printlns

* Rebuild wasm

* Fix & tests for auth/val syncing

* Fix up threading for tests

* Remove superfluous asserts
2019-03-22 21:41:33 +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
Gav Wood df65a92c91 Rebuild, add a couple of tests and fix theoretical issue (#2056)
* Rebuild, add a couple of tests and fix theoretical issue

* Update lib.rs
2019-03-21 13:56:31 +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