Skip to content

Commit

Permalink
dApp Staking v3 - Shibuya integration (#1109)
Browse files Browse the repository at this point in the history
* dApp staking v3 - Shibuya integration

* Init

* Fix build

* Fix find/replace doc mess

* Migration & disable

* More integration

* Progress

* Adjusted integration

* Finished integration

* Additional modifications & cleanup

* Move comment

* Fixes

* Shibuya integration tests fix & proxy

* Renaming

* Integration test fixes & legacy support

* Adjust for benchmarks

* Remove chain-extension, small updates

* fixes

* Partial weights

* Minor changes

* Benchmark fixes

* dApp staking weights

* Weights, deps

* Remove redundant storage item

* Inflation params, resolve TODOs

* Optimize lengthy benchmark

* Integration test

* Sort out more TODOs

* Benchmark optimization

* Fix seed

* Remove spec version bump

* Fix integration test

* Weights update
  • Loading branch information
Dinonard authored Dec 20, 2023
1 parent b7983e9 commit 9fbbbaa
Show file tree
Hide file tree
Showing 40 changed files with 2,272 additions and 1,270 deletions.
42 changes: 8 additions & 34 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ members = [

"primitives",

"chain-extensions/dapps-staking",
"chain-extensions/pallet-assets",
"chain-extensions/xvm",
"chain-extensions/unified-accounts",
Expand Down Expand Up @@ -298,12 +297,10 @@ pallet-evm-precompile-dapps-staking = { path = "./precompiles/dapps-staking", de
pallet-evm-precompile-dapp-staking-v3 = { path = "./precompiles/dapp-staking-v3", default-features = false }
pallet-evm-precompile-unified-accounts = { path = "./precompiles/unified-accounts", default-features = false }

pallet-chain-extension-dapps-staking = { path = "./chain-extensions/dapps-staking", default-features = false }
pallet-chain-extension-xvm = { path = "./chain-extensions/xvm", default-features = false }
pallet-chain-extension-assets = { path = "./chain-extensions/pallet-assets", default-features = false }
pallet-chain-extension-unified-accounts = { path = "./chain-extensions/unified-accounts", default-features = false }

dapps-staking-chain-extension-types = { path = "./chain-extensions/types/dapps-staking", default-features = false }
xvm-chain-extension-types = { path = "./chain-extensions/types/xvm", default-features = false }
assets-chain-extension-types = { path = "./chain-extensions/types/assets", default-features = false }
unified-accounts-chain-extension-types = { path = "./chain-extensions/types/unified-accounts", default-features = false }
Expand Down
1 change: 0 additions & 1 deletion bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ shiden-runtime = { workspace = true, features = ["std"] }

# astar pallets dependencies
astar-primitives = { workspace = true }
pallet-dapp-staking-v3 = { workspace = true }

# frame dependencies
frame-system = { workspace = true, features = ["std"] }
Expand Down
6 changes: 2 additions & 4 deletions bin/collator/src/local/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use local_runtime::{
wasm_binary_unwrap, AccountId, AuraConfig, AuraId, BalancesConfig, BlockRewardConfig,
CouncilConfig, DappStakingConfig, DemocracyConfig, EVMConfig, GenesisConfig, GrandpaConfig,
GrandpaId, InflationConfig, InflationParameters, Precompiles, RewardDistributionConfig,
Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TreasuryConfig, VestingConfig,
AST,
Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TierThreshold, TreasuryConfig,
VestingConfig, AST,
};
use sc_service::ChainType;
use sp_core::{crypto::Ss58Codec, sr25519, Pair, Public};
Expand All @@ -32,8 +32,6 @@ use sp_runtime::{
Perbill, Permill,
};

use pallet_dapp_staking_v3::TierThreshold;

type AccountPublic = <Signature as Verify>::Signer;

/// Specialized `ChainSpec` for Shiden Network.
Expand Down
58 changes: 41 additions & 17 deletions bin/collator/src/parachain/chain_spec/shibuya.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
use cumulus_primitives_core::ParaId;
use sc_service::ChainType;
use shibuya_runtime::{
wasm_binary_unwrap, AccountId, AuraConfig, AuraId, Balance, BalancesConfig, BlockRewardConfig,
CollatorSelectionConfig, CouncilConfig, DemocracyConfig, EVMChainIdConfig, EVMConfig,
GenesisConfig, ParachainInfoConfig, Precompiles, RewardDistributionConfig, SessionConfig,
SessionKeys, Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TreasuryConfig,
VestingConfig, SBY,
wasm_binary_unwrap, AccountId, AuraConfig, AuraId, Balance, BalancesConfig,
CollatorSelectionConfig, CouncilConfig, DappStakingConfig, DemocracyConfig, EVMChainIdConfig,
EVMConfig, GenesisConfig, InflationConfig, InflationParameters, ParachainInfoConfig,
Precompiles, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig,
TechnicalCommitteeConfig, TierThreshold, TreasuryConfig, VestingConfig, SBY,
};
use sp_core::{sr25519, Pair, Public};

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

use super::{get_from_seed, Extensions};
Expand Down Expand Up @@ -114,17 +114,6 @@ fn make_genesis(
},
parachain_info: ParachainInfoConfig { parachain_id },
balances: BalancesConfig { balances },
block_reward: BlockRewardConfig {
// Make sure sum is 100
reward_config: RewardDistributionConfig {
treasury_percent: Perbill::from_percent(10),
base_staker_percent: Perbill::from_percent(20),
dapps_percent: Perbill::from_percent(20),
collators_percent: Perbill::from_percent(5),
adjustable_percent: Perbill::from_percent(45),
ideal_dapps_staking_tvl: Perbill::from_percent(40),
},
},
vesting: VestingConfig { vesting: vec![] },
session: SessionConfig {
keys: authorities
Expand Down Expand Up @@ -174,6 +163,41 @@ fn make_genesis(
},
democracy: DemocracyConfig::default(),
treasury: TreasuryConfig::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),
],
// TODO: adjust this if needed
tier_thresholds: vec![
TierThreshold::DynamicTvlAmount {
amount: 100 * SBY,
minimum_amount: 80 * SBY,
},
TierThreshold::DynamicTvlAmount {
amount: 50 * SBY,
minimum_amount: 40 * SBY,
},
TierThreshold::DynamicTvlAmount {
amount: 20 * SBY,
minimum_amount: 20 * SBY,
},
TierThreshold::FixedTvlAmount { amount: 10 * SBY },
],
slots_per_tier: vec![10, 20, 30, 40],
},
// TODO: adjust this if needed
inflation: InflationConfig {
params: InflationParameters::default(),
},
}
}

Expand Down
43 changes: 0 additions & 43 deletions chain-extensions/dapps-staking/Cargo.toml

This file was deleted.

Loading

0 comments on commit 9fbbbaa

Please sign in to comment.