Commit Graph

243 Commits

Author SHA1 Message Date
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 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 b3931d3e2a Remove redundant Ok(()) and explicitly specify StorageKey buffer type (#2188) 2019-04-03 11:59:03 +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
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
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
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
Amar Singh b1f9c31f21 Documentation for consensus module (#2043)
* first try

* resolve description of grandpa and add links to relevant docs

* Update srml/consensus/src/lib.rs

Co-Authored-By: AmarRSingh <asinghchrony@protonmail.com>

* Can do a relative link here

* Update srml/consensus/src/lib.rs

Co-Authored-By: AmarRSingh <asinghchrony@protonmail.com>

* Update srml/consensus/src/lib.rs

Co-Authored-By: AmarRSingh <asinghchrony@protonmail.com>

* Update srml/consensus/src/lib.rs

Co-Authored-By: AmarRSingh <asinghchrony@protonmail.com>

* formatting/style/semantics

* missed conflict

* style

* Update srml/consensus/src/lib.rs

* Update srml/consensus/src/lib.rs
2019-03-29 17:41:36 +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
Shawn Tabrizi 55788fdf77 Add documentation to the Sudo module (#2017)
* First draft of sudo module documentation

* add ignore tags to code blocks

* Suggested Updates

Still needs some more love with links

* Update lib.rs

* Add links to other modules

* Update lib.rs

* style

* missed parens
2019-03-29 17:05:34 +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
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
Nicole Zhu 665a0ac26a Documentation for Contract Module (#2045)
* Add: documentation for srml_contract, per @sergeis comments. TODO: make concise and add usage example

* Fix: minor spelling and grammar

* Add: Revisions to the doc clarification from @Sergei on trx revert behavior

* Edit: added spacing btw function list for better readability

* Remove: usage create contract example todo later

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicolezhuis@gmail.com>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicolezhuis@gmail.com>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicolezhuis@gmail.com>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicolezhuis@gmail.com>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicolezhuis@gmail.com>

* Edit: explained max gas limit revert behavior in greater detail

* Edit: incorporated first round of PRs, mostly syntax/styling

* Edit: incorporated Sergeis mental model, terms, and added usage examples

* Fix: staking module is no longer closely related to contract. Balances now manages the reaping of accounts

* Minor cleanup of links/text that are not ready to be shown

* Update srml/contract/src/lib.rs

made more concise

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Minor edits from PR

* Explained contract creation in more detail, fixed PR suggestions

* Linted according to contri guidelines

* Created a notable scenarios section, unlisted public functions in lieu of a direct link to the module

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/tests.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* Update srml/contract/src/lib.rs

Co-Authored-By: nczhu <nicole@parity.io>

* minor commit after pr feedback

* s/codehash/code_hash for consistency
2019-03-29 12:22:04 +01:00
zak 700ef193bd fixed some typo (#2140)
* fixed some typo

* Update traits.rs
2019-03-29 09:36:21 +01: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
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
Gautam Dhameja d6927c2f3e Documentation for system module (#1999)
* srml system docs

* updated docs

* fixed typo

* addressed initial review comments

* addressed review comments

* addressed review comments

* minor fixes in docs

* Various corrections, punctuation.

* updated docs

* minor edit

* fixed doc test

* Update srml/system/src/lib.rs
2019-03-28 15:09:44 +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
joe petrowski 2ca08a95ba Documentation for balances module (#1943)
* comment updates

* added rustdoc and readme

* clarified LockableCurrency trait

* Currency trait rustdocs

* fixed typo

* fixed suggestions round 1

* UpdateBalanceOutcome docs (open for discussion)

* rm description of enum, consolidation, rm ReclaimRebate

* type clarification, examples overhaul, adoc formatting

* adoc to md

* format change for rustdoc

* update links and fix typos

* typos and links

* updates according to comments

* new example

* small clarifications

* trait implementation section

* missing ```

* small changes, ready for review

* line width update

* small tweaks

* Update srml/balances/src/lib.rs

Co-Authored-By: joepetrowski <25483142+joepetrowski@users.noreply.github.com>

* Update srml/balances/src/lib.rs

Co-Authored-By: joepetrowski <25483142+joepetrowski@users.noreply.github.com>

* Update srml/balances/src/lib.rs

Co-Authored-By: joepetrowski <25483142+joepetrowski@users.noreply.github.com>

* Update srml/balances/src/lib.rs

Co-Authored-By: joepetrowski <25483142+joepetrowski@users.noreply.github.com>

* Update lib.rs

* address review by thiolliere

* remove common warning

* Update docs

* updated srml example
2019-03-26 17:00:29 +01:00
thiolliere a2222279ca improve decl storage doc (#2059)
* improve decl storage doc

* nocompile doc

* fix doc

* typo

* Update srml/support/procedural/src/lib.rs
2019-03-26 15:01:46 +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
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
thiolliere e6a4bb1be6 fix macro internal use with $crate (#2060) 2019-03-26 10:44:01 +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
Gav Wood 91c7c7188d Rename ensure_free_balance_is to make_free_balance_be (#2092) 2019-03-23 11:18:14 +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
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
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
Marcio Diaz 648b11e118 Delegation voting (#1827)
* feat: add on-chain delegation voting

* fix: add recursion limit to delegated_votes

* fix: tests

* fix: count votes before limit exceeded
2019-03-18 18:33:36 +01:00
Shawn Tabrizi b513326ea7 Remove upgrade-key module from SRML (#2018)
* Remove upgrade-key from SRML. Update chain spec builder text

* bump spec_version, rebuild wasm

* Remove upgrade-key from SRML. Update chain spec builder text

* bump spec_version, rebuild wasm

* Rebase, Rebuild

* Rebuild wasm
2019-03-18 15:00:30 +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