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

dApp Staking v3 & Tokenomics 2.0 - Shiden Integration #1161

Merged
merged 14 commits into from
Feb 6, 2024
19 changes: 12 additions & 7 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astar-collator"
version = "5.30.0"
version = "5.31.0"
description = "Astar collator implementation in Rust."
build = "build.rs"
default-run = "astar-collator"
Expand Down
2 changes: 0 additions & 2 deletions bin/collator/src/parachain/chain_spec/shibuya.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ fn make_genesis(
Permill::from_percent(30),
Permill::from_percent(40),
],
// TODO: adjust this if needed
tier_thresholds: vec![
TierThreshold::DynamicTvlAmount {
amount: 100 * SBY,
Expand All @@ -194,7 +193,6 @@ fn make_genesis(
],
slots_per_tier: vec![10, 20, 30, 40],
},
// TODO: adjust this if needed
inflation: InflationConfig {
params: InflationParameters::default(),
},
Expand Down
51 changes: 37 additions & 14 deletions bin/collator/src/parachain/chain_spec/shiden.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
use cumulus_primitives_core::ParaId;
use sc_service::ChainType;
use shiden_runtime::{
wasm_binary_unwrap, AccountId, AuraId, Balance, BlockRewardConfig, EVMConfig,
ParachainInfoConfig, Precompiles, RewardDistributionConfig, Signature, SystemConfig, SDN,
wasm_binary_unwrap, AccountId, AuraId, Balance, DappStakingConfig, EVMConfig, InflationConfig,
InflationParameters, ParachainInfoConfig, Precompiles, Signature, SystemConfig, TierThreshold,
SDN,
};
use sp_core::{sr25519, Pair, Public};

use sp_runtime::{
traits::{IdentifyAccount, Verify},
Perbill,
Permill,
};

use super::{get_from_seed, Extensions};
Expand Down Expand Up @@ -111,17 +112,6 @@ fn make_genesis(
},
parachain_info: ParachainInfoConfig { parachain_id },
balances: shiden_runtime::BalancesConfig { balances },
block_reward: BlockRewardConfig {
// Make sure sum is 100
reward_config: RewardDistributionConfig {
treasury_percent: Perbill::from_percent(40),
base_staker_percent: Perbill::from_percent(25),
dapps_percent: Perbill::from_percent(25),
collators_percent: Perbill::from_percent(10),
adjustable_percent: Perbill::from_percent(0),
ideal_dapps_staking_tvl: Perbill::from_percent(0),
},
},
vesting: shiden_runtime::VestingConfig { vesting: vec![] },
session: shiden_runtime::SessionConfig {
keys: authorities
Expand Down Expand Up @@ -160,6 +150,39 @@ fn make_genesis(
assets: Default::default(),
parachain_system: Default::default(),
transaction_payment: Default::default(),
dapp_staking: DappStakingConfig {
reward_portion: vec![
Permill::from_percent(40),
Permill::from_percent(30),
Permill::from_percent(20),
Permill::from_percent(10),
],
slot_distribution: vec![
Permill::from_percent(10),
Permill::from_percent(20),
Permill::from_percent(30),
Permill::from_percent(40),
],
tier_thresholds: vec![
TierThreshold::DynamicTvlAmount {
amount: 30000 * SDN,
minimum_amount: 20000 * SDN,
},
TierThreshold::DynamicTvlAmount {
amount: 7500 * SDN,
minimum_amount: 5000 * SDN,
},
TierThreshold::DynamicTvlAmount {
amount: 20000 * SDN,
minimum_amount: 15000 * SDN,
},
TierThreshold::FixedTvlAmount { amount: 5000 * SDN },
],
slots_per_tier: vec![10, 20, 30, 40],
},
inflation: InflationConfig {
params: InflationParameters::default(),
},
}
}

Expand Down
78 changes: 39 additions & 39 deletions pallets/dapp-staking-migration/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
//! Autogenerated weights for pallet_dapp_staking_migration
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-12-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-02-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `devserver-01`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024
//! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shiden-dev"), DB CACHE: 1024

// Executed Command:
// ./target/release/astar-collator
// benchmark
// pallet
// --chain=shibuya-dev
// --chain=shiden-dev
// --steps=50
// --repeat=20
// --pallet=pallet_dapp_staking_migration
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./benchmark-results/shibuya-dev/dapp_staking_migration_weights.rs
// --output=./benchmark-results/shiden-dev/dapp_staking_migration_weights.rs
// --template=./scripts/templates/weight-template.hbs

#![cfg_attr(rustfmt, rustfmt_skip)]
Expand Down Expand Up @@ -65,7 +65,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// Storage: DappStaking IntegratedDApps (r:1 w:1)
/// Proof: DappStaking IntegratedDApps (max_values: Some(65535), max_size: Some(121), added: 2101, mode: MaxEncodedLen)
/// Proof: DappStaking IntegratedDApps (max_values: Some(65535), max_size: Some(116), added: 2096, mode: MaxEncodedLen)
/// Storage: DappStaking CounterForIntegratedDApps (r:1 w:1)
/// Proof: DappStaking CounterForIntegratedDApps (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: DappStaking NextDAppId (r:1 w:1)
Expand All @@ -74,8 +74,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `558`
// Estimated: `6112`
// Minimum execution time: 46_832_000 picoseconds.
Weight::from_parts(47_613_000, 6112)
// Minimum execution time: 48_037_000 picoseconds.
Weight::from_parts(49_209_000, 6112)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
Expand All @@ -85,8 +85,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3551`
// Minimum execution time: 6_296_000 picoseconds.
Weight::from_parts(6_626_000, 3551)
// Minimum execution time: 3_226_000 picoseconds.
Weight::from_parts(3_424_000, 3551)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: DappsStaking Ledger (r:2 w:1)
Expand All @@ -103,10 +103,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Proof: DappStaking CurrentEraInfo (max_values: Some(1), max_size: Some(112), added: 607, mode: MaxEncodedLen)
fn migrate_ledger_success() -> Weight {
// Proof Size summary in bytes:
// Measured: `1748`
// Measured: `1749`
// Estimated: `6472`
// Minimum execution time: 70_686_000 picoseconds.
Weight::from_parts(71_976_000, 6472)
// Minimum execution time: 69_988_000 picoseconds.
Weight::from_parts(70_437_000, 6472)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
Expand All @@ -116,21 +116,21 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3731`
// Minimum execution time: 2_801_000 picoseconds.
Weight::from_parts(3_072_000, 3731)
// Minimum execution time: 3_019_000 picoseconds.
Weight::from_parts(3_197_000, 3731)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: DappsStaking Ledger (r:6 w:5)
/// Proof: DappsStaking Ledger (max_values: None, max_size: Some(266), added: 2741, mode: MaxEncodedLen)
/// The range of component `x` is `[1, 5]`.
fn cleanup_old_storage_success(x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `699 + x * (39 ±0)`
// Measured: `700 + x * (40 ±0)`
// Estimated: `3731 + x * (2741 ±0)`
// Minimum execution time: 7_303_000 picoseconds.
Weight::from_parts(6_916_878, 3731)
// Standard Error: 7_249
.saturating_add(Weight::from_parts(675_810, 0).saturating_mul(x.into()))
// Minimum execution time: 6_873_000 picoseconds.
Weight::from_parts(6_629_732, 3731)
// Standard Error: 7_063
.saturating_add(Weight::from_parts(688_886, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(x.into())))
Expand All @@ -140,8 +140,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_094_000 picoseconds.
Weight::from_parts(2_182_000, 0)
// Minimum execution time: 2_144_000 picoseconds.
Weight::from_parts(2_233_000, 0)
}
}

Expand All @@ -152,7 +152,7 @@ impl WeightInfo for () {
/// Storage: System Account (r:1 w:1)
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
/// Storage: DappStaking IntegratedDApps (r:1 w:1)
/// Proof: DappStaking IntegratedDApps (max_values: Some(65535), max_size: Some(121), added: 2101, mode: MaxEncodedLen)
/// Proof: DappStaking IntegratedDApps (max_values: Some(65535), max_size: Some(116), added: 2096, mode: MaxEncodedLen)
/// Storage: DappStaking CounterForIntegratedDApps (r:1 w:1)
/// Proof: DappStaking CounterForIntegratedDApps (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: DappStaking NextDAppId (r:1 w:1)
Expand All @@ -161,8 +161,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `558`
// Estimated: `6112`
// Minimum execution time: 46_832_000 picoseconds.
Weight::from_parts(47_613_000, 6112)
// Minimum execution time: 48_037_000 picoseconds.
Weight::from_parts(49_209_000, 6112)
.saturating_add(RocksDbWeight::get().reads(6_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
Expand All @@ -172,8 +172,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3551`
// Minimum execution time: 6_296_000 picoseconds.
Weight::from_parts(6_626_000, 3551)
// Minimum execution time: 3_226_000 picoseconds.
Weight::from_parts(3_424_000, 3551)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: DappsStaking Ledger (r:2 w:1)
Expand All @@ -190,10 +190,10 @@ impl WeightInfo for () {
/// Proof: DappStaking CurrentEraInfo (max_values: Some(1), max_size: Some(112), added: 607, mode: MaxEncodedLen)
fn migrate_ledger_success() -> Weight {
// Proof Size summary in bytes:
// Measured: `1748`
// Measured: `1749`
// Estimated: `6472`
// Minimum execution time: 70_686_000 picoseconds.
Weight::from_parts(71_976_000, 6472)
// Minimum execution time: 69_988_000 picoseconds.
Weight::from_parts(70_437_000, 6472)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
Expand All @@ -203,21 +203,21 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3731`
// Minimum execution time: 2_801_000 picoseconds.
Weight::from_parts(3_072_000, 3731)
// Minimum execution time: 3_019_000 picoseconds.
Weight::from_parts(3_197_000, 3731)
.saturating_add(RocksDbWeight::get().reads(1_u64))
}
/// Storage: DappsStaking Ledger (r:6 w:5)
/// Proof: DappsStaking Ledger (max_values: None, max_size: Some(266), added: 2741, mode: MaxEncodedLen)
/// The range of component `x` is `[1, 5]`.
fn cleanup_old_storage_success(x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `699 + x * (39 ±0)`
// Measured: `700 + x * (40 ±0)`
// Estimated: `3731 + x * (2741 ±0)`
// Minimum execution time: 7_303_000 picoseconds.
Weight::from_parts(6_916_878, 3731)
// Standard Error: 7_249
.saturating_add(Weight::from_parts(675_810, 0).saturating_mul(x.into()))
// Minimum execution time: 6_873_000 picoseconds.
Weight::from_parts(6_629_732, 3731)
// Standard Error: 7_063
.saturating_add(Weight::from_parts(688_886, 0).saturating_mul(x.into()))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(x.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(x.into())))
Expand All @@ -227,7 +227,7 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_094_000 picoseconds.
Weight::from_parts(2_182_000, 0)
// Minimum execution time: 2_144_000 picoseconds.
Weight::from_parts(2_233_000, 0)
}
}
Loading
Loading