Skip to content

Commit

Permalink
stake pallet (#159)
Browse files Browse the repository at this point in the history
* init

* orml utils leaks substrate v2 dependencies so it had to be removed

* init author pallet

* standalone runtime but not node

* remove Account workaround in author pallet and decode directly into AccountId from inherent

* remove dependency on pallet sessions, add leave nominators runtime method, and revert previous unnecessary changes

* fmt

* add empty genesis

* constant issuance

* standalone node still fails to build

* fix Cargo.lock

* add canonical validator set as storage item bc no longer using session

* author pallet ensures block author is in the validator set tracked in stake before setting author

* bump versions, panic in on finalize if author is not set, change input param for IsValidator to ref

* add RoundIndex type to polkadotjs type jsons

* reorg storage visibility identifiers

* make all storage items private for now, revert polkadotjs type attempt bc it didnt do anything

* need to publish new version of moonbeam-types-bundle in order for integration tests to recognize RoundIndex is u32

* type registration still fails

* Fixes CI for moonbeam type bundle

* revert block author set requirement

Co-authored-by: Joshy Orndorff <admin@joshyorndorff.com>
Co-authored-by: Crystalin <alan@purestake.com>
  • Loading branch information
3 people authored Jan 9, 2021
1 parent ccb5b63 commit e72de06
Show file tree
Hide file tree
Showing 23 changed files with 1,684 additions and 801 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ jobs:
run: cargo test --release --verbose --all
- name: Typescript tests (against standalone node)
run: |
cd tests
cd moonbeam-types-bundle
npm install
cd ../tests
npm install
npm run test;
- name: Save parachain binary
Expand Down
36 changes: 35 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions moonbeam-types-bundle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const moonbeamDefinitions = {
nonce: "U256",
balance: "u128",
},
RoundIndex: "u32",

This comment has been minimized.

Copy link
@joelamouche

joelamouche Jan 18, 2021

Contributor

So that's the only modification you added to the types, right @4meta5 ? Is this type relevant for the current version of the runtime (6) or for the next release (7) ?

},
},
{
Expand All @@ -43,6 +44,7 @@ export const moonbeamDefinitions = {
balance: "u128",
},
ExtrinsicSignature: "EthereumSignature",
RoundIndex: "u32",
},
},
],
Expand Down
3 changes: 2 additions & 1 deletion node/parachain/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use cumulus_primitives::ParaId;
use moonbeam_runtime::{
AccountId, BalancesConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig, GenesisConfig,
ParachainInfoConfig, SudoConfig, SystemConfig, WASM_BINARY,
ParachainInfoConfig, StakeConfig, SudoConfig, SystemConfig, WASM_BINARY,
};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
Expand Down Expand Up @@ -98,5 +98,6 @@ fn testnet_genesis(
accounts: BTreeMap::new(),
}),
pallet_ethereum: Some(EthereumConfig {}),
stake: Some(StakeConfig { stakers: vec![] }),
}
}
73 changes: 73 additions & 0 deletions node/standalone/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion node/standalone/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use moonbeam_runtime::{
AccountId, AuraConfig, BalancesConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig,
GenesisConfig, GrandpaConfig, SudoConfig, SystemConfig, WASM_BINARY,
GenesisConfig, GrandpaConfig, StakeConfig, SudoConfig, SystemConfig, WASM_BINARY,
};
use sc_service::ChainType;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
Expand Down Expand Up @@ -157,5 +157,6 @@ fn testnet_genesis(
accounts: BTreeMap::new(),
}),
pallet_ethereum: Some(EthereumConfig {}),
stake: Some(StakeConfig { stakers: vec![] }),
}
}
35 changes: 35 additions & 0 deletions pallets/author/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "author"
version = "0.1.0"
description = "Block Author tracking"
authors = ["PureStake"]
edition = "2018"
license = "Apache-2.0"
homepage = "https://substrate.dev"
repository = "https://github.com/paritytech/substrate/"
readme = "README.md"

[dependencies]
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
parity-scale-codec = { version = "1.0.0", default-features = false, features = ["derive"] }
sp-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

[features]
default = ["std"]
std = [
"frame-support/std",
"frame-system/std",
"parity-scale-codec/std",
"sp-authorship/std",
"sp-inherents/std",
"sp-runtime/std",
"sp-std/std",
]
Loading

0 comments on commit e72de06

Please sign in to comment.