-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Separate out staking module into balances and payment #629
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Few nits
@@ -0,0 +1,661 @@ | |||
// Copyright 2017 Parity Technologies (UK) Ltd. | |||
// This file is part of Substrate Demo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change this to Substrate?
#![cfg_attr(not(feature = "std"), no_std)] | ||
|
||
#[cfg(feature = "std")] | ||
extern crate serde; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extern crate can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly not - deriving Deserialize
requires it to be around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, weird, before posting this, I --check
ed everything.
extern crate substrate_runtime_io as runtime_io; | ||
extern crate substrate_runtime_primitives as primitives; | ||
extern crate substrate_runtime_consensus as consensus; | ||
extern crate substrate_runtime_sandbox as sandbox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extern crate can be removed.
extern crate substrate_primitives; | ||
extern crate substrate_runtime_io as runtime_io; | ||
extern crate substrate_runtime_primitives as primitives; | ||
extern crate substrate_runtime_consensus as consensus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extern crate can be removed.
extern crate substrate_runtime_primitives as primitives; | ||
extern crate substrate_runtime_consensus as consensus; | ||
extern crate substrate_runtime_sandbox as sandbox; | ||
extern crate substrate_runtime_session as session; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extern crate can be removed.
// | ||
// This balance is a "reserve" balance that other subsystems use in order to set aside tokens | ||
// that are still "owned" by the account holder, but which are unspendable. This is different | ||
// and wholly unrelated to the `Bondage` system used for staking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this remark about staking and Bondage
?
|
||
// PUBLIC DISPATCH | ||
|
||
/// Transfer some unlocked staking balance to another staker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to avoid terms stak{ing,er}
// This is the only balance that matters in terms of most operations on tokens. It is | ||
// alone used to determine the balance when in the contract execution environment. When this | ||
// balance falls below the value of `ExistentialDeposit`, then the "current account" is | ||
// deleted: specifically, `Bondage` and `FreeBalance`. Furthermore, `OnFreeBalanceZero` callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we reword this comment? There is no such thing as Bondage
now
Looks like #629 (comment) still not addressed |
@pepyakin ^^ |
* 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 paritytech#630 * Version needs Decode. * Move Decode back * Fix nits * Refactor to allow custom message
…rs-generic-over-hasher-and-rlpcodec * origin/master: (26 commits) Contract runtime polishing (#601) WIP on chain heap (#639) Events to track extrinsic success (#640) Install llvm-tools-preview component (#643) fix wasm executor compile error (#631) random fixes (#638) Empty becomes (), reflecting convention (#637) Allow to build_upon skipped entries, but don't walk back (#635) Separate out staking module into balances and payment (#629) Update .gitlab-ci.yml (#633) Do not attempt to rustup if in CI. This is taken care of by the base (#621) Avoid need for ident strings in storage (#624) rename to panic_handler as panic_implementation is deprecated in nightly (#626) 5 random fixes (#2) (#623) fix one typo in README (#627) Misspelled words (#625) Contracts: Per block gas limit (#506) Make sure to ban invalid transactions. (#615) (#620) Forward-port BFT fixes from v0.2 and restructure agreement cancelling (#619) Allow specifying listening multiaddresses (#577) ...
* master: (22 commits) Introduce treasury and document (#646) Off-the-table staking preference (#656) Implement function `json_metadata` in `decl_module!` (#654) Fix warnings in networking (#652) Add a reputation system (#645) Check for pruned block state (#648) Contract runtime polishing (#601) WIP on chain heap (#639) Events to track extrinsic success (#640) Install llvm-tools-preview component (#643) fix wasm executor compile error (#631) random fixes (#638) Empty becomes (), reflecting convention (#637) Allow to build_upon skipped entries, but don't walk back (#635) Separate out staking module into balances and payment (#629) Update .gitlab-ci.yml (#633) Do not attempt to rustup if in CI. This is taken care of by the base (#621) Avoid need for ident strings in storage (#624) rename to panic_handler as panic_implementation is deprecated in nightly (#626) 5 random fixes (#2) (#623) ...
* Update to substrate master * Update service/src/lib.rs Co-Authored-By: Bastian Köcher <[email protected]> * bump subsrate
* Fix duplicate validator key * Update wasm * Update according from review * Refactoring * Build wasm * Nit * Update substrate
Does what it says on the tin. Closes #211.
Despite the apparent extra 300 lines, this actually removes quite a lot of code. With a cunning move of the
PublicAux
type fromconsensus
intosystem
, we have massively reduced the dependency tree of modules.Now, we have
system
being the root dependency module:timestamp
,consensus
andbalances
are dependent on it. The entire on-chain governance and smart-contract system is dependent only onbalances
, while session-management is dependent onconsensus
andtimestamp
, andstaking
is dependent onsession
andbalances
. It's now possible to usebalances
within a PoA system without needing to bring in PoS concepts.One upshot of this is the hugely simplified mockups for tests in
democracy
,contract
andcouncil
modules. Since they are no longer dependent onconsensus
,session
,timestamp
andstaking
, all of those modules can be removed from the mock and everything becomes massively simpler.99% of this PR is just moved code and renaming to correct references. The only significant code change is balances now including a hook
IsAccountLiquid
which allows staking to impose its Bonding semantics on thetransfer
function.Needless to say, many storage items will have changed from
Staking XXX
toBalances XXX
. UI maintainers take note. (cc @jacogr )