Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vesting pallet #3028

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Dockerfile-bootstrap-node
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ COPY rust-toolchain.toml /code/rust-toolchain.toml

COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY shared /code/shared
COPY test /code/test

Expand Down
1 change: 0 additions & 1 deletion Dockerfile-bootstrap-node.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ COPY rust-toolchain.toml /code/rust-toolchain.toml

COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY shared /code/shared
COPY test /code/test

Expand Down
1 change: 0 additions & 1 deletion Dockerfile-farmer
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ COPY rust-toolchain.toml /code/rust-toolchain.toml

COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY shared /code/shared
COPY test /code/test

Expand Down
1 change: 0 additions & 1 deletion Dockerfile-farmer.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ COPY rust-toolchain.toml /code/rust-toolchain.toml

COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY shared /code/shared
COPY test /code/test

Expand Down
1 change: 0 additions & 1 deletion Dockerfile-node
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ COPY rust-toolchain.toml /code/rust-toolchain.toml

COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY shared /code/shared
COPY test /code/test

Expand Down
1 change: 0 additions & 1 deletion Dockerfile-node.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ COPY rust-toolchain.toml /code/rust-toolchain.toml

COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY shared /code/shared
COPY test /code/test

Expand Down
1 change: 0 additions & 1 deletion Dockerfile-runtime
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ COPY rust-toolchain.toml /code/rust-toolchain.toml

COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY shared /code/shared
COPY test /code/test

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ The structure of this repository is the following:
- `subspace-node` is an implementation of the node for Subspace protocol
- `subspace-farmer` is a CLI farmer app
- `domains` contains client and runtime code for decoupled execution and domains
- `orml` contains a fork of orml vesting pallet with modified dependencies

## How to run

Expand Down
6 changes: 1 addition & 5 deletions crates/subspace-malicious-operator/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::num::NonZeroU32;
use subspace_runtime::{
AllowAuthoringBy, CouncilConfig, DemocracyConfig, DomainsConfig, EnableRewardsAt,
HistorySeedingConfig, MaxDomainBlockSize, MaxDomainBlockWeight, RewardsConfig,
RuntimeConfigsConfig, SubspaceConfig, VestingConfig,
RuntimeConfigsConfig, SubspaceConfig,
};
use subspace_runtime_primitives::{
AccountId, Balance, BlockNumber, CouncilDemocracyConfigParams, SSC,
Expand Down Expand Up @@ -172,7 +172,6 @@ pub fn dev_config() -> Result<GenericChainSpec, String> {
(get_account_id_from_seed("Alice//stash"), 1_000 * SSC),
(get_account_id_from_seed("Bob//stash"), 1_000 * SSC),
],
vec![],
GenesisParams {
enable_rewards_at: EnableRewardsAt::Manually,
allow_authoring_by: AllowAuthoringBy::Anyone,
Expand Down Expand Up @@ -206,8 +205,6 @@ pub fn dev_config() -> Result<GenericChainSpec, String> {
fn subspace_genesis_config(
sudo_account: AccountId,
balances: Vec<(AccountId, Balance)>,
// who, start, period, period_count, per_period
vesting: Vec<(AccountId, BlockNumber, BlockNumber, u32, Balance)>,
genesis_params: GenesisParams,
genesis_domain_params: GenesisDomainParams,
) -> subspace_runtime::RuntimeGenesisConfig {
Expand Down Expand Up @@ -238,7 +235,6 @@ fn subspace_genesis_config(
phantom: PhantomData,
},
rewards: rewards_config,
vesting: VestingConfig { vesting },
council: CouncilConfig::default(),
democracy: DemocracyConfig::default(),
runtime_configs: RuntimeConfigsConfig {
Expand Down
132 changes: 3 additions & 129 deletions crates/subspace-node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,62 +35,14 @@ use subspace_runtime::{
AllowAuthoringBy, BalancesConfig, CouncilConfig, DemocracyConfig, DomainsConfig,
EnableRewardsAt, HistorySeedingConfig, MaxDomainBlockSize, MaxDomainBlockWeight, RewardsConfig,
RuntimeConfigsConfig, RuntimeGenesisConfig, SubspaceConfig, SudoConfig, SystemConfig,
VestingConfig, WASM_BINARY,
WASM_BINARY,
};
use subspace_runtime_primitives::time::MILLISECS_PER_BLOCK;
use subspace_runtime_primitives::{
AccountId, Balance, BlockNumber, CouncilDemocracyConfigParams, SSC,
};

const SUBSPACE_TELEMETRY_URL: &str = "wss://telemetry.subspace.network/submit/";

/// List of accounts which should receive token grants, amounts are specified in SSC.
const TOKEN_GRANTS: &[(&str, u128)] = &[
(
"5Dns1SVEeDqnbSm2fVUqHJPCvQFXHVsgiw28uMBwmuaoKFYi",
2_000_000,
),
(
"5DxtHHQL9JGapWCQARYUAWj4yDcwuhg9Hsk5AjhEzuzonVyE",
1_000_000,
),
("5EHhw9xuQNdwieUkNoucq2YcateoMVJQdN8EZtmRy3roQkVK", 69_427),
("5GBWVfJ253YWVPHzWDTos1nzYZpa9TemP7FpQT9RnxaFN6Sz", 167_708),
("5F9tEPid88uAuGbjpyegwkrGdkXXtaQ9sGSWEnYrfVCUCsen", 111_111),
("5DkJFCv3cTBsH5y1eFT94DXMxQ3EmVzYojEA88o56mmTKnMp", 244_444),
("5G23o1yxWgVNQJuL4Y9UaCftAFvLuMPCRe7BCARxCohjoHc9", 174_994),
("5D9pNnGCiZ9UqhBQn5n71WFVaRLvZ7znsMvcZ7PHno4zsiYa", 337_500),
("5H2Kq1qWrisf7aXUvdGrQB9j9zhiGt6MdaGSSBpFCwynBT9p", 13_834),
("5Ci12WM1YqPjSAMNubucNejuSqwChfRSKDpFfFhtshomNSG1", 250_000),
("5FAS1mdyp1yomAzJaJ74ZgJbzicQmZ8ajRyxPZ2x4wseGkY2", 104_175),
("5E4vk2Ant4y6KiKoGMezrhhFwSanspjh8Fxa9HmWmjWrFyry", 66_700),
("5GsCx12U1zMu7bMZHXjb1rhMFR8YK9VUj6hQHWyaw1ReYt8D", 33_333),
("5F72mz79TjkWQEjuefPCMabFarGVLvW4haPTYsrzewxrbuD7", 12_222),
("5Fn9BF7pyiefhAwanXFyW4T5sXNQGJ9kzLAR1DpF8iYmc7aw", 6_667),
("5CdMyLvrxdTNTVZYAgN9NCQbNmwYW32vojsBZZfkEcxYbjUR", 33_333),
("5Fgjk1nMYCEcoP9QvjMDVzDjBzJfo5X2ZssSbWn5PesfyPJh", 100_000),
("5CUutLkRAMr14dsqFzRFgByD6gv9U8iqL67CZ7huxXtoXKdB", 22_222),
("5EqPLjjBob7Y6FCUMKMPfgQyb2BZ8y2CcNVQrZ5wSF3aDpTX", 3_333),
("5HKZUKYjQQ8H47z1HchLgLWZ8EfguFDDqh2KJqxBLoUggtCp", 9_167),
("5D7E29Ut5P5RDczpakVSVvTV3vEh6v5B3oofEzcJ2xKUks78", 12_473),
("5DRUS33oYrkPjM8SpLDKPiNG8R4sHvvZ8R2QZTcSgSCByjyR", 17_778),
("5H6d5Wh5tmbrksPbHyoaonYCF7u71YuBRL7e8a8mHsphxxbT", 10_417),
("5CXYUjQv42aYhbdCL98QgKP82RyxPGEvHJZw9yBEJ5CE53um", 100_000),
("5FsxXZCHHcRUhek6whnEMkgXuumeWVVn8SFeUVhGNGdKzq6e", 9_583),
("5GhHwuJoK1b7uUg5oi8qUXxWHdfgzv6P5CQSdJ3ffrnPRgKM", 567_378),
("5DydwBX2uLjnVKjg1zAWS3z27ukbr99PiXteQSg96bb1k6p7", 190_000),
("5FND87MkPEVvwMP3sq88n1MFxHuLDrHkBdCNeuc23ibjHME4", 288_889),
("5G4BCrTj6xZHkTwFtPmK4sjNEXc8w12ZjLLU8awsb5CDBz4d", 260_000),
("5GW7F86K47JArVGB5eSoUHoA9WADAxwts7P9yicAmQnf6cmK", 137_500),
("5DXfPcXUcP4BG8LBSkJDrfFNApxjWySR6ARfgh3v27hdYr5S", 440_000),
("5CXSdDJgzRTj54f9raHN2Z5BNPSMa2ETjqCTUmpaw3ECmwm4", 330_000),
("5DqKxL7bQregQmUfFgzTMfRKY4DSvA1KgHuurZWYmxYSCmjY", 200_000),
("5CfixiS93yTwHQbzzfn8P2tMxhKXdTx7Jam9htsD7XtiMFtn", 27_800),
("5FZe9YzXeEXe7sK5xLR8yCmbU8bPJDTZpNpNbToKvSJBUiEo", 18_067),
("5FZwEgsvZz1vpeH7UsskmNmTpbfXvAcojjgVfShgbRqgC1nx", 27_800),
("5EqBwtqrCV427xCtTsxnb9X2Qay39pYmKNk9wD9Kd62jLS97", 75_000),
];

/// Additional subspace specific genesis parameters.
struct GenesisParams {
enable_rewards_at: EnableRewardsAt<BlockNumber>,
Expand Down Expand Up @@ -136,48 +88,11 @@ pub fn gemini_3h_compiled() -> Result<GenericChainSpec, String> {
AccountId::from_ss58check("5DNwQTHfARgKoa2NdiUM51ZUow7ve5xG9S2yYdSbVQcnYxBA")
.expect("Wrong root account address");

let mut balances = vec![(sudo_account.clone(), 1_000 * SSC)];
let vesting_schedules = TOKEN_GRANTS
.iter()
.flat_map(|&(account_address, amount)| {
let account_id = AccountId::from_ss58check(account_address)
.expect("Wrong vesting account address");
let amount: Balance = amount * SSC;

// TODO: Adjust start block to real value before mainnet launch
let start_block = 100_000_000;
let one_month_in_blocks =
u32::try_from(3600 * 24 * 30 * MILLISECS_PER_BLOCK / 1000)
.expect("One month of blocks always fits in u32; qed");

// Add balance so it can be locked
balances.push((account_id.clone(), amount));

[
// 1/4 of tokens are released after 1 year.
(
account_id.clone(),
start_block,
one_month_in_blocks * 12,
1,
amount / 4,
),
// 1/48 of tokens are released every month after that for 3 more years.
(
account_id,
start_block + one_month_in_blocks * 12,
one_month_in_blocks,
36,
amount / 48,
),
]
})
.collect::<Vec<_>>();
let balances = vec![(sudo_account.clone(), 1_000 * SSC)];
patch_domain_runtime_version(
serde_json::to_value(subspace_genesis_config(
sudo_account.clone(),
balances,
vesting_schedules,
GenesisParams {
enable_rewards_at: EnableRewardsAt::Manually,
allow_authoring_by: AllowAuthoringBy::RootFarmer(
Expand Down Expand Up @@ -257,48 +172,11 @@ pub fn devnet_config_compiled() -> Result<GenericChainSpec, String> {
AccountId::from_ss58check("5CXTmJEusve5ixyJufqHThmy4qUrrm6FyLCR7QfE4bbyMTNC")
.expect("Wrong root account address");

let mut balances = vec![(sudo_account.clone(), Balance::MAX / 2)];
let vesting_schedules = TOKEN_GRANTS
.iter()
.flat_map(|&(account_address, amount)| {
let account_id = AccountId::from_ss58check(account_address)
.expect("Wrong vesting account address");
let amount: Balance = amount * SSC;

// TODO: Adjust start block to real value before mainnet launch
let start_block = 100_000_000;
let one_month_in_blocks =
u32::try_from(3600 * 24 * 30 * MILLISECS_PER_BLOCK / 1000)
.expect("One month of blocks always fits in u32; qed");

// Add balance so it can be locked
balances.push((account_id.clone(), amount));

[
// 1/4 of tokens are released after 1 year.
(
account_id.clone(),
start_block,
one_month_in_blocks * 12,
1,
amount / 4,
),
// 1/48 of tokens are released every month after that for 3 more years.
(
account_id,
start_block + one_month_in_blocks * 12,
one_month_in_blocks,
36,
amount / 48,
),
]
})
.collect::<Vec<_>>();
let balances = vec![(sudo_account.clone(), Balance::MAX / 2)];
patch_domain_runtime_version(
serde_json::to_value(subspace_genesis_config(
sudo_account.clone(),
balances,
vesting_schedules,
GenesisParams {
enable_rewards_at: EnableRewardsAt::Manually,
allow_authoring_by: AllowAuthoringBy::FirstFarmer,
Expand Down Expand Up @@ -362,7 +240,6 @@ pub fn dev_config() -> Result<GenericChainSpec, String> {
(get_account_id_from_seed("Alice//stash"), 1_000 * SSC),
(get_account_id_from_seed("Bob//stash"), 1_000 * SSC),
],
vec![],
GenesisParams {
enable_rewards_at: EnableRewardsAt::Manually,
allow_authoring_by: AllowAuthoringBy::Anyone,
Expand Down Expand Up @@ -399,8 +276,6 @@ pub fn dev_config() -> Result<GenericChainSpec, String> {
fn subspace_genesis_config(
sudo_account: AccountId,
balances: Vec<(AccountId, Balance)>,
// who, start, period, period_count, per_period
vesting: Vec<(AccountId, BlockNumber, BlockNumber, u32, Balance)>,
genesis_params: GenesisParams,
genesis_domain_params: GenesisDomainParams,
council_democracy_config_params: CouncilDemocracyConfigParams<BlockNumber>,
Expand Down Expand Up @@ -463,7 +338,6 @@ fn subspace_genesis_config(
phantom: PhantomData,
},
rewards: rewards_config,
vesting: VestingConfig { vesting },
council: CouncilConfig::default(),
democracy: DemocracyConfig::default(),
runtime_configs: RuntimeConfigsConfig {
Expand Down
5 changes: 1 addition & 4 deletions crates/subspace-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ frame-support = { default-features = false, git = "https://github.com/subspace/p
frame-system = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "5626154d0781ac9a6ffd5a6207ed237f425ae631" }
frame-system-benchmarking = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "5626154d0781ac9a6ffd5a6207ed237f425ae631", optional = true }
frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "5626154d0781ac9a6ffd5a6207ed237f425ae631" }
orml-vesting = { version = "0.9.1", default-features = false, path = "../../orml/vesting" }
pallet-balances = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "5626154d0781ac9a6ffd5a6207ed237f425ae631" }
pallet-collective = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "5626154d0781ac9a6ffd5a6207ed237f425ae631" }
pallet-democracy = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "5626154d0781ac9a6ffd5a6207ed237f425ae631" }
pallet-domains = { version = "0.1.0", default-features = false, path = "../pallet-domains" }
pallet-history-seeding = { version = "0.1.0", default-features = false,path = "../pallet-history-seeding" }
pallet-history-seeding = { version = "0.1.0", default-features = false, path = "../pallet-history-seeding" }
pallet-messenger = { version = "0.1.0", path = "../../domains/pallets/messenger", default-features = false }
pallet-mmr = { default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "5626154d0781ac9a6ffd5a6207ed237f425ae631" }
pallet-offences-subspace = { version = "0.1.0", default-features = false, path = "../pallet-offences-subspace" }
Expand Down Expand Up @@ -90,7 +89,6 @@ std = [
"frame-system/std",
"frame-system-benchmarking?/std",
"frame-system-rpc-runtime-api/std",
"orml-vesting/std",
"pallet-balances/std",
"pallet-collective/std",
"pallet-democracy/std",
Expand Down Expand Up @@ -146,7 +144,6 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"frame-system-benchmarking",
"frame-system-benchmarking/runtime-benchmarks",
"orml-vesting/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-domains/runtime-benchmarks",
Expand Down
19 changes: 1 addition & 18 deletions crates/subspace-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use frame_support::weights::constants::ParityDbWeight;
use frame_support::weights::{ConstantMultiplier, Weight};
use frame_support::{construct_runtime, parameter_types, PalletId};
use frame_system::limits::{BlockLength, BlockWeights};
use frame_system::{EnsureNever, EnsureRoot};
use frame_system::EnsureRoot;
use pallet_collective::{EnsureMember, EnsureProportionAtLeast};
pub use pallet_rewards::RewardPoint;
pub use pallet_subspace::{AllowAuthoringBy, EnableRewardsAt};
Expand Down Expand Up @@ -887,21 +887,6 @@ impl pallet_runtime_configs::Config for Runtime {
type WeightInfo = pallet_runtime_configs::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
// This value doesn't matter, we don't use it (`VestedTransferOrigin = EnsureNever` below).
pub const MinVestedTransfer: Balance = 0;
}

impl orml_vesting::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type MinVestedTransfer = MinVestedTransfer;
type VestedTransferOrigin = EnsureNever<AccountId>;
type WeightInfo = ();
type MaxVestingSchedules = ConstU32<2>;
type BlockNumberProvider = System;
}

mod mmr {
use super::Runtime;
pub use pallet_mmr::primitives::*;
Expand Down Expand Up @@ -954,8 +939,6 @@ construct_runtime!(
Domains: pallet_domains = 12,
RuntimeConfigs: pallet_runtime_configs = 14,

Vesting: orml_vesting = 13,

Mmr: pallet_mmr = 30,
SubspaceMmr: pallet_subspace_mmr = 31,

Expand Down
3 changes: 0 additions & 3 deletions orml/README.md

This file was deleted.

Loading
Loading