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

feat: 🎸 add parachain-staking #1269

Open
wants to merge 38 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0db3c43
feat: 🎸 add buy-back
yooml Jun 4, 2024
171f9e9
Bifrost v0.10.001
SunTiebing Jun 4, 2024
fcc6100
feat: 🎸 benchmark
yooml Jun 5, 2024
08aa1c2
Merge pull request #1257 from bifrost-finance/add-buy-back
SunTiebing Jun 5, 2024
5b892b4
SLPx mint support commission id (#1261)
SunTiebing Jun 11, 2024
66b0ab0
Add vtoken exchange rate rpc (#1260)
SunTiebing Jun 11, 2024
d87b49b
fix: 🐛 add event (#1263)
yooml Jun 11, 2024
fec4a12
add update_currency_metadata function (#1259)
SunTiebing Jun 11, 2024
96aa7fb
add the use of Vec (#1264)
SunTiebing Jun 12, 2024
a62b6e0
Upgrade to Polkadot-SDK v1.7.0 (#1262)
hqwangningbo Jun 12, 2024
489fc9c
feat: 🎸 add metadata-hash-extension (#1265)
yooml Jun 13, 2024
3fe0b79
Fix compile (#1266)
hqwangningbo Jun 13, 2024
7b0aaaf
Fix/fix vtoken voting unlock (#1267)
SunTiebing Jun 13, 2024
3fd0543
feat: 🎸 add parachain-staking
yooml Jun 17, 2024
c2cd21f
feat: 🎸 add bifrost-polkadot-testnet
yooml Jun 18, 2024
67f4a23
refactor: 💡 rm pallet-collator-selection
yooml Jun 18, 2024
10a7bfc
fix: 🐛 rm collatorSelection
yooml Jun 20, 2024
260fd0c
fix: 🐛 add parachainStaking into chain_spec
yooml Jun 25, 2024
424ef48
fix: 🐛 balances
yooml Jun 25, 2024
fa3c3ce
[skip ci]: remove latest tag
TomatoAres Jun 26, 2024
2a8a1f4
feat: 🎸 add membership
yooml Jun 26, 2024
8bddb97
[skip ci]:add chain-spec
TomatoAres Jun 26, 2024
2208804
[skip ci]Update Dockerfile for testnet
TomatoAres Jun 27, 2024
44d1f09
[skip ci] update chain spec
TomatoAres Jul 29, 2024
93d59db
[skip ci] update chain spec
TomatoAres Jul 29, 2024
df1af36
Bifrost v0.15.0
SunTiebing Oct 29, 2024
70ea90a
Migrated benchmarking of asset-registry from v1 to v2. (#1486)
MJLNSN Oct 31, 2024
90774f7
Feat/ban vbnc transfer (#1487)
SunTiebing Oct 31, 2024
b0a58c0
Feat/flexible fee ban vbnc (#1488)
SunTiebing Oct 31, 2024
b60ba06
Add XcmWeightTrader, XcmPaymentApi and DryRunApi #1484 (#1490)
hqwangningbo Nov 5, 2024
1d5d157
Merge 'vO.15.0' into 'add-parachain-staking'
SunTiebing Nov 8, 2024
b57141f
fix clippy
SunTiebing Nov 10, 2024
4b47a8a
fix code fmt
SunTiebing Nov 10, 2024
7c8bdf0
Fix merge issues: update Dockerfile to use the main network configura…
SunTiebing Nov 11, 2024
c829a54
add bifrost_parachain_staking InitGenesisMigration
SunTiebing Nov 11, 2024
442c013
Update parameter configurations and implement data migration.
SunTiebing Nov 11, 2024
101bdc8
remove unused files
SunTiebing Nov 11, 2024
2be6e13
add latest tag
SunTiebing Nov 11, 2024
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
23 changes: 12 additions & 11 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ pallet-authority-discovery = { git = "https://github.com/parityt
pallet-authorship = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }
pallet-bounties = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }
pallet-collator-selection = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }
pallet-collective = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }
pallet-conviction-voting = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }
Expand Down Expand Up @@ -253,6 +252,7 @@ substrate-fixed = { git = "https://github.com/encoint
xcm = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", package = "staging-xcm", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", package = "staging-xcm-builder", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", package = "staging-xcm-executor", default-features = false }
xcm-fee-payment-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0", default-features = false }

# polkadot-sdk (client)
cumulus-client-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.13.0" }
Expand Down
2 changes: 1 addition & 1 deletion node/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bifrost-cli"
version = "0.14.0"
version = "0.15.0"
authors = ["Liebi Technologies <[email protected]>"]
description = "Bifrost Parachain Node"
build = "build.rs"
Expand Down
139 changes: 84 additions & 55 deletions pallets/asset-registry/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,40 @@
use super::*;
use crate::Pallet as AssetRegistry;
use bifrost_primitives::CurrencyId;
use frame_benchmarking::{benchmarks, v1::BenchmarkError};
use frame_benchmarking::v2::*;
use frame_support::{assert_ok, traits::UnfilteredDispatchable};
use sp_runtime::traits::UniqueSaturatedFrom;

benchmarks! {
register_token_metadata {
let origin = T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
#[benchmarks]
mod benchmarks {
use super::*;

#[benchmark]
fn register_token_metadata() -> Result<(), BenchmarkError> {
let origin =
T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let metadata = AssetMetadata {
name: b"Bifrost Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
decimals: 12,
minimal_balance: BalanceOf::<T>::unique_saturated_from(0u128),
};

let call = Call::<T>::register_token_metadata {
metadata: Box::new(metadata.clone())
};
}: {call.dispatch_bypass_filter(origin)?}
verify {
assert_eq!(CurrencyMetadatas::<T>::get(Token2(0)), Some(metadata.clone()))
let call = Call::<T>::register_token_metadata { metadata: Box::new(metadata.clone()) };

#[block]
{
call.dispatch_bypass_filter(origin)?;
}

assert_eq!(CurrencyMetadatas::<T>::get(Token2(0)), Some(metadata.clone()));
Ok(())
}

register_vtoken_metadata {
let origin = T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
#[benchmark]
fn register_vtoken_metadata() -> Result<(), BenchmarkError> {
let origin =
T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let metadata = AssetMetadata {
name: b"Bifrost Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
Expand All @@ -62,27 +72,28 @@ benchmarks! {
Box::new(metadata.clone())
));

let call = Call::<T>::register_vtoken_metadata {
token_id: 0
};
}: {call.dispatch_bypass_filter(origin)?}
verify {
assert_eq!(
CurrencyMetadatas::<T>::get(CurrencyId::VToken2(0)),
Some(v_metadata.clone())
)
let call = Call::<T>::register_vtoken_metadata { token_id: 0 };

#[block]
{
call.dispatch_bypass_filter(origin)?;
}

assert_eq!(CurrencyMetadatas::<T>::get(CurrencyId::VToken2(0)), Some(v_metadata.clone()));
Ok(())
}

register_location {
let origin = T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
#[benchmark]
fn register_location() -> Result<(), BenchmarkError> {
let origin =
T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let metadata = AssetMetadata {
name: b"Bifrost Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
decimals: 12,
minimal_balance: BalanceOf::<T>::unique_saturated_from(0u128),
};
let versioned_location = VersionedLocation::V4(Location::new(1, [Parachain(2001)]));

let versioned_location = VersionedLocation::V4(Location::new(1, [Parachain(2001)]));
let location: xcm::v4::Location = versioned_location.clone().try_into().unwrap();

assert_ok!(AssetRegistry::<T>::register_token_metadata(
Expand All @@ -92,24 +103,28 @@ benchmarks! {

let call = Call::<T>::register_location {
currency_id: Token2(0),
location:Box::new(versioned_location.clone()),
weight:Weight::from_parts(2000_000_000, u64::MAX),
location: Box::new(versioned_location.clone()),
weight: Weight::from_parts(2000_000_000, u64::MAX),
};
}: {call.dispatch_bypass_filter(origin)?}
verify {
assert_eq!(
LocationToCurrencyIds::<T>::get(location.clone()),
Some(Token2(0))
);

#[block]
{
call.dispatch_bypass_filter(origin)?;
}

assert_eq!(LocationToCurrencyIds::<T>::get(location.clone()), Some(Token2(0)));
assert_eq!(CurrencyIdToLocations::<T>::get(Token2(0)), Some(location));
assert_eq!(
CurrencyIdToLocations::<T>::get(Token2(0)),
Some(location)
CurrencyIdToWeights::<T>::get(Token2(0)),
Some(Weight::from_parts(2000_000_000, u64::MAX))
);
assert_eq!(CurrencyIdToWeights::<T>::get(Token2(0)), Some(Weight::from_parts(2000_000_000, u64::MAX)));
Ok(())
}

force_set_location {
let origin = T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
#[benchmark]
fn force_set_location() -> Result<(), BenchmarkError> {
let origin =
T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
let metadata = AssetMetadata {
name: b"Bifrost Native Coin".to_vec(),
symbol: b"BNC".to_vec(),
Expand All @@ -118,22 +133,29 @@ benchmarks! {
};
let versioned_location = VersionedLocation::V4(Location::new(1, [Parachain(2001)]));

let location: xcm::v3::Location = versioned_location.clone().try_into().unwrap();

assert_ok!(AssetRegistry::<T>::register_token_metadata(
origin.clone(),
Box::new(metadata.clone())
));

let call = Call::<T>::force_set_location {
currency_id: Token2(0),
location:Box::new(versioned_location.clone()),
weight:Weight::from_parts(2000_000_000, u64::MAX),
location: Box::new(versioned_location.clone()),
weight: Weight::from_parts(2000_000_000, u64::MAX),
};
}: {call.dispatch_bypass_filter(origin)?}

update_currency_metadata {
let origin = T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
#[block]
{
call.dispatch_bypass_filter(origin)?;
}

Ok(())
}

#[benchmark]
fn update_currency_metadata() -> Result<(), BenchmarkError> {
let origin =
T::RegisterOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;

assert_ok!(AssetRegistry::<T>::register_token_metadata(
origin.clone(),
Expand All @@ -149,12 +171,15 @@ benchmarks! {
currency_id: CurrencyId::Token2(0),
asset_name: Some(b"Token Name".to_vec()),
asset_symbol: Some(b"TN".to_vec()),
asset_decimals : Some(12),
asset_minimal_balance : Some(BalanceOf::<T>::unique_saturated_from(1000u128)),
asset_decimals: Some(12),
asset_minimal_balance: Some(BalanceOf::<T>::unique_saturated_from(1000u128)),
};

}: {call.dispatch_bypass_filter(origin)?}
verify {
#[block]
{
call.dispatch_bypass_filter(origin)?;
}

assert_eq!(
CurrencyMetadatas::<T>::get(CurrencyId::Token2(0)),
Some(AssetMetadata {
Expand All @@ -164,12 +189,16 @@ benchmarks! {
minimal_balance: BalanceOf::<T>::unique_saturated_from(1000u128),
})
);
Ok(())
}

impl_benchmark_test_suite!(
AssetRegistry,
crate::mock::ExtBuilder::default().build(),
crate::mock::Runtime
);

// This line generates test cases for benchmarking, and could be run by:
// `cargo test -p pallet-example-basic --all-features`, you will see one line per case:
// `test benchmarking::bench_sort_vector ... ok`
// `test benchmarking::bench_accumulate_dummy ... ok`
// `test benchmarking::bench_set_dummy_benchmark ... ok` in the result.
//
// The line generates three steps per benchmark, with repeat=1 and the three steps are
// [low, mid, high] of the range.
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext_benchmark(), crate::mock::Runtime);
}
Loading