Commit Graph

110 Commits

Author SHA1 Message Date
Gav Wood 828cd9580a Stash/controller model for staking (#1782)
* First steps to stash/controller separation

* More drafting

* More drafting

* Finish draft.

* Optimisation

* Remove accidental commit

* Make it build.

* Fix linked map for traits.

* Fix Option<_> variant.

*  Improve naming a tad

* Rebuild runtime

* Builds!

* First test.

* Bump RT version

* Minor fix

* Update Mock

* adds the correct reward testcase (+staking eras which was already ok)

* fixes the basic staking testcase to work properly (along with a small fix in the module)

* New logic to avoid controller transferring stash.

* Fix some build issues.

* adding some comments to tests

* Fix impls.

* adds a few more lines to explain the test case

* More fixes.

* gets the basic test up and running again

* Fix rest of build

* Rebuild wasm

* Fix docs.

* fix staking test with new chnages

* updating some tests, pending questions

* More working tests

* adds double staking test

* Docs

* remove invalid slashing test

* Payee stuff.

* Fix build

* Docs

* Fix test

* Fix a couple of tests

* Layout plan for finishing tests before Pragmen

* Add some working tests

* re-build staking and reward tests

* Add more tests

* fix offline grace test

* Nominator should have payee checked for cleanup

* adds more nomination tets

* adds validator prefs tests

* Fix and clean up some TODOs

* Fix a couple of issues

* Fix tests

* noting warnings from tests

* final fix of local tests

* Fix slot_stake bug

* Half baked test

* Add logic to limit `unstake_threshold` set in storage

* Make sure to check before writing!

Almost forgot this one

* Move a couple of comments

* fix last broken slot_stake test

* Ignore broken test
2019-03-02 14:31:48 +01:00
thiolliere b332c64e38 improve storage macro static checks (#1907) 2019-03-01 12:19:24 +01:00
Bastian Köcher 2e9b2be8fa Update parity-codec/-derive to 3.1 (#1900)
* Update parity-codec/-derive to 3.1

* Update wasm stuff
2019-03-01 09:04:53 +01:00
thiolliere 04fed82940 fix construct_runtime! macro error when no event (#1887)
* fix macro error when no event

* update impl version
2019-02-28 12:01:05 +01:00
thiolliere 72a8927ea3 replace some encode by using_encoded (#1863)
* replace some encode by using_encoded

* update runtime

* improve readibility
2019-02-26 09:26:11 +01:00
thiolliere dab5ad913f fix construct runtime module position bug (#1849)
* fix construct runtime module position

* Update srml/support/src/runtime.rs

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

* Update srml/support/src/runtime.rs

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

* Update srml/support/src/runtime.rs

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

* Update srml/support/src/runtime.rs

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

* Update srml/support/src/runtime.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
2019-02-25 11:41:40 +01:00
Jordan Beauchamp f5ab24804f Let StorageDoubleMap use borrowed key types (#1804)
* Let StorageDoubleMap use borrowed key types

* Bump impl version
2019-02-21 19:26:31 +01:00
thiolliere 19ac5e1e95 fix construct runtime macro (#1838)
if system wasn't the first module then it crashed
2019-02-21 10:04:40 +01:00
Gav Wood c3e6572886 Introduce new testnet ready for 0.10 (#1677)
* Introduce new testnet ready for 0.10

* Upgraded dd spec
2019-02-20 16:16:35 +01:00
thiolliere 8065116ba5 Improve fees module (#1821)
* remove amount associated
* make a new trait to bound some arithmetics to balances or assets:
  It also remove arithmetic bounds of srml-support::traits::Currency.

  To update your code then use srml_support::traits::ArithmeticType like:
  `type Currency: ArithmeticType + Currency<Self::AccountId, Balance=BalanceOf<Self>>; ` 
  with `type BalanceOf<T> = <<T as Trait>::Currency as ArithmeticType>::Type; `

* improve decl_storage when it explicit serde bound: basically don't try to be smarter than rust and just use where clause.
2019-02-19 17:13:59 +01:00
Tomasz Drwięga 9a2f1b2007 Fix linked map for trait types and Option (#1809)
* Fix linked map for traits.

* Fix Option<_> variant.

*  Improve naming a tad

* Rebuild runtime

* Encapsulate private data in the inner module.

* Bump impl version.

* Fix deriving codec in srml-example.

* Fix derivation without importing parity-codec-derive.

* Fix config() for map.
2019-02-18 19:23:00 +01:00
Stanislav Tkach 34e3487035 Migrate finality-grandpa to the 2018 edition (#1797) 2019-02-15 16:06:18 -03:00
Xiliang Chen fafffdb771 Transaction Fee Module (#1648)
* wip

* Split bytes fee charging and charging by amount into different traits.

* Move to edition 2018.

* Implemented charge fee traits for fees module.

* Implemented 'on_finalise' for fee module.

* Updated fees finalize impl.

* Renaming and documentation update.

* Added overflow & underflow check for fee calculation.

* Added mock and unit tests for fee module.

* More unit tests for fees module.

* Fixed srml-executive unit tests.

* Remove transaction base/bytes fee from balances module, fix unit tests.

* fix compile error

* Fixed unit test.

* Minor fixes.

* Bump spec version.

* Bump spec version.

* Updated fees module and runtime wasm.

* Fees module code style improvement; updated runtime wasm.

* Bump spec and impl version.
2019-02-15 11:21:38 +01:00
Stanislav Tkach ff5e4ca87e Migrate everything to the 2018 edition (#1758) 2019-02-13 11:45:59 +01:00
Gav Wood a61c218cc3 Introduce Ristretto signing (#1730)
* first draft of ristretto crypto module #1685

* adds better comments and code-style

* remove the last evil unwrap

* remove a mistakenly committed lockfile

* add a fresh new lockfile --will probably need a manual merge later

* fix an invalid old test vector

* Wire in ristretto

* Update comment

* Fix use.

* new Signature type api alias to be compatible with substrate

* Add new keyring, fix node executor tests

* Bump version.

* Remove all hashes.

* Update core/primitives/src/sr25519.rs

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

* Revert back to Ed25519 (until JS UI is ready)

* Fix test
2019-02-13 10:10:17 +01:00
Tomasz Drwięga 9e2710246f EnumerableStorageMap (#1763)
* Refactor decl_storage a bit to allow easier impl of linked map.

* A bunch of refactorings for storage generation.

- Rename StorageMap and ChildrenStorageMap to avoid confusion with generator::StorageMap.
- Separate implementation from the procedural macro code to clean it up.
- Make sure that genesis is initialised using the `StorageValue/StorageMap`
  generated implementations instead of going RAW.

* WiP: Writing test.

* Basic implementation.

* Implement enumeration.

* Fix non-std issues.

* fix warning

* Fix test-client.

* Address review grumbles - part 1

* Avoid cloning the key, relax Storage requirements.

* Rebuild runtime.

* Remove dangling todo.
2019-02-13 08:52:52 +01:00
Gav Wood 90a837d4b8 Add Proposed event (#1761)
* Add Proposed event.

* Bump and rebuild
2019-02-11 17:06:45 +01:00
Marcio Diaz b8bd49961a Adds new execution strategy nativeElseWasm (#1546)
* fix: adds new execution strategy nativeElseWasm and replace nativeWhenPossible with it

* feat: adds cmd line params for execution strategies

* fix: uses of cmd line execution strategies

* chore: remove white spaces

* chore: remove println

* chore: remove whitespace

* fix: generating functions with context

* feat: add function to generate with_context declarations

* fix: add implementation for with_context function calls

* fix: add execution context to call_api_at function

* fix: making use of context to select strategy for block_builder

* chore: cleaning up

* fix: merging issues

* fix tests

* add wasm files

* chore: small doc for context fields

* chore: delete redundant docs

* fix: use full path for ExecutionContext

* fix: add context functions from inside fold_item_impl

* chore: remove clone

* fix: moving generative function to utils, remove unused imports

* fix: add missing full path for ExecutionContext

* fix: merge issues

* update wasm files

* fix: update to keep up with changes in master

* chore: remove unused functions, clean up

* fix test

* fix grumbles

* fix: add more tests

* fix: some refactorings

* feat: add execution strategy to call

* chore: small improvements

* fix: add message to panic

* fix tests
2019-02-11 15:22:44 +01:00
Bastian Köcher f9975af020 Make sr-api-macros and srml-support renaming of crates (#1757)
Procedural do not support `$crate` to get access to the crate where the
macro is defined. We use a hack to re-export the crate under a known
name. With rust edition 2018, people started to rename their crates in
`Cargo.toml`, but that breaks the re-export. This commit introduces
`proc-maco-crate` that supports finding the requested crate name, even
if it was renamed.
2019-02-11 13:58:41 +01:00
Stanislav Tkach c860787db7 Migrate srml crates to the 2018 edition (#1755) 2019-02-11 11:42:36 +01:00
Gav Wood e5ac7f0957 Vesting schedules. (#1726)
* Vesting.

* Vesting stuff.

* Add new wasm blobs

* Bump runtime version

* Update lock

* Fix tests

* Bump version
2019-02-10 11:15:16 +01:00
Tomasz Drwięga 51a98f5c94 Unify bad signature error (#1717)
* Unify bad signature message.

* Update runtime.
2019-02-09 19:44:52 +01:00
Stanislav Tkach ca69ad4c30 Migrate smrl-treasury and srml-upgrade-key to the 2018 edition (#1725) 2019-02-09 18:06:20 +01:00
thiolliere e5dbcf6890 decouple balances from some modules (#1641)
* decouple balances from some module by creating a new traits in support/traits
* improve decl_event
2019-02-08 17:43:12 +01:00
Tomasz Drwięga 83f9e1e720 Allow modules to indicate full block. (#1687)
* Add transaction skipping.

* Update runtime.
2019-02-08 15:35:48 +01:00
Stanislav Tkach 31188dc013 Migrate rpc-servers, serializer, service and sr-io to the 2018 edition (#1732) 2019-02-08 13:10:05 +01:00
thiolliere 4792a3806c use custom ext::Opt for default_value in DeclStorageLine (#1722)
instead of ext::Seq
2019-02-07 16:35:29 +01:00
Arkadiy Paronyan 1dc15be5bd Check for block parent before verification. (#1714)
* Treat verification errors more seriously

* Track obsolete requests

* Check block parent before verification

* Style
2019-02-07 11:58:27 +01:00
Jordan Beauchamp fb0f4dfb03 Expose block random seed and timestamp to contract ABI (#1630)
* Expose block random seed and timestamp to contract ABI

* Add tests

* Bump spec version
2019-02-07 10:58:02 +01:00
Bastian Köcher 567122fab5 Moves node-template into substrate repo (#1637)
* Make runtime macros work without required `macro_use`

* Adds node-template

* Adds node-template-release tool

* Fixes building `node-template` and improve the release

* Add `profile.release` by release script to remove warning

* Adds script for releasing the node template

* Fixes compilation after master merge

* Port node-template to edition 2018

* Remove license

* Fixes compilation after master merge

* Add `node-template-release.sh` into the CI

* WIP Ci integrate node template (#1701)

* copy artifacts to s3 bucket latest path

* typo

* bucket name

* Update wasm files
2019-02-06 17:15:12 +01:00
Pierre Krieger b6fd967dfb Update libp2p to v0.3 (#1634)
* Update libp2p

* Some more diagnostics

* 30 seconds back to 5 seconds

* Bump libp2p-core and improve test

* Fix runtime Cargo.lock

* More work

* Finish upgrade to libp2p 0.3

* Add a maximum of 60 seconds for the rounds

* Remove env_logger

* Update Cargo.lock

* Update Cargo.lock in test-runtime

* Fix test compilation

* Make the test pass

* Add identify addresses to Kademlia

* Don't connect to nodes we're already connected to

* Add warning for non-Substrate nodes

* Fix external address not added

* Start in Enabled mode
2019-02-06 16:39:22 +01:00
Wei Tang 1d0049ee00 Update trie to v0.11 (#1704)
* Update trie to v0.11

* Update wasm runtimes
2019-02-06 14:50:52 +01:00
Gregory Terzian a2d2ed69ab Rewrite network protocol/service to use channels (#1340)
* rewrite network protocol/service to use channels

* remove use of unwrap

* re-introduce with_spec

* remove unnecessary mut

* remove unused param

* improve with_spec, add with_gossip

* rename job to task

* style: re-add comma

* remove extra string allocs

* rename use of channel

* turn TODO into FIXME

* remove mut in match

* remove Self in new

* pass headers by value to network service

* remove network sender from service

* remove TODO

* better expect

* rationalize use of network sender in ondemand
2019-02-06 12:54:02 +01:00
Bastian Köcher 190393d476 Make API backwards compatible with CC (#1697)
* Rework how a runtime api calls into the runtime

Now we generate a default implementation for each api call that calls
a generated method `method_runtime_api_impl`. This newly generated
method is the one that will be implemented by the `impl_runtime_apis`
macro in the runtime for the client side.

* Support `changed_in` to change runtime api function signatures

* Update documentation

* Fixes tests

* Implement checking the api version with a predicate

* Make the implementation backwards compatible with CC

* Update wasm files after merge

* Check for wasm runtime differences by building master and current branch

* Update spec_version and wasm files

* Fixes

* Revert my changes

* Remove `patch.crates-io` from test-runtime
2019-02-06 11:47:47 +01:00
Gav Wood fa2e323478 Add OnInitialise handler. (#1690)
* Add OnInitialise handler.

Closes #1686

* Fix typo

* Fix wasm build

* Add tests for initialise and finalise.
2019-02-06 10:01:28 +01:00
Gav Wood 0eeef28382 Offline/Slashing improvements (#1665)
* Initial logic

* Fix tests

* Don't punish at all when everyone skipped

* Typo

* Fix tests.

* Update srml/aura/src/lib.rs

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

* Simplification.

* Bump runtime verions
2019-02-05 22:11:40 +01:00
Bastian Köcher 471b7431bc Move CODE directly into TestExternalities (#1682)
* Move `CODE` directly into `TestExternalities`

This change allows tests to modify CODE in storage.

* Update more hashes

* Test

* Move `code` back into a field of `TestExternalities`

* Update wasm after master merge
2019-02-05 21:16:11 +01:00
Stanislav Tkach 1cb02c318b Migrate srml-assets, srml-aura, srml-balances and srml-consens to the 2018 edition (#1633) 2019-02-05 18:26:58 +01:00
Bastian Köcher ef4dc12a5d Don't panic if parameter can not be converted between node and native runtime (#1659)
* Don't panic if parameter can not be converted between node and native runtime

* FIxes after merge

* Use correct copyright year
2019-02-02 14:13:50 +01:00
Tomasz Drwięga ecdd33a367 Allow both consensus and runtime to limit block building (#1581)
* Limit block size in runtime,

* Add test for basic authorship.

* Store length of extrinsics instead of computing it.

* Don't rely on note_extrinsic

* Use hashed version of storage and write test.

* Recompile runtime.
2019-02-01 13:58:23 +01:00
Gav Wood a58de5d0ff Transaction signing payload is hashed first (#1624)
* Transaction signing payload is hashed first

* Fix tests

* Rebuild wasm

* Fix tests

* Only take payload hash when payload.len > 256 bytes.

* Fix tests
2019-01-31 18:39:20 +01:00
Sergei Pepyakin 80d4a0a21b Declare storage in contracts module (#1591)
* Declare storage in contracts module

This adds storage declarations of the contract module to the runtime metadata and this ultimately gives ability to inspect the storage of contract module (except contracts storage) for polkadot ui

* Bump the runtime version to 17.

* Rebuild the binaries.

* Rebuild

* Rebuild [2]
2019-01-31 12:19:28 +01:00
thiolliere 9de35fa7d5 update rhododendron trie-bench for parity-codec 3.0 (#1613)
* update rhd and tri

* .lock and wasm build
2019-01-31 11:04:41 +01:00
cheme ea2a03b7bb Merge metadata by module (#1428)
Clean up metadata format. Merge events metadata into runtime metadata. Remove low value info (internal macro identifier and counters).
2019-01-30 19:34:08 +01:00
Arkadiy Paronyan 742f030ddd Transactional updates in the state-db (#1616) 2019-01-30 16:58:25 +01:00
Tomasz Drwięga d2cfd7b9dc Allow runtime to return transaction validation error codes (#1534)
* Allow runtime to return more detailed transaction validation errors.

* Re-use ApplyError codes and update test-runtime.

* Fix pool tests.

* Revert using Compact for validity.
2019-01-29 19:06:05 +01:00
thiolliere 0078927ac5 update codec and grandpa (#1582)
* update codec

* use new codec

* update grandpa code

* build .lock and binaries
2019-01-28 14:16:17 +01:00
thiolliere f70fd6e450 set link-arg --export-table for wasm builds (#1598) 2019-01-28 12:41:52 +01:00
Gav Wood c132e84572 Additional externs for ecdsa recovery and keccak (#1583)
* Additional externs for ecdsa recovery and keccak

* Update core/executor/src/wasm_executor.rs

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

* Update core/executor/src/wasm_executor.rs

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

* Fix grumble

* Grumble.
2019-01-25 19:07:02 +00:00
Benjamin Kampmann ab4c70b379 Update dependencies (#1527)
* update to latest env_logger

* roundabout dependency update

* Update to latest vengen

* Update rand to 0.6

* Update to latest rng shuffle API

* Roundabout update of dependencies

* Update rustc_hex

* Update wasm

* Fix logging setup in tests

* revert to fix test
2019-01-25 12:44:41 +01:00