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

Bifrost v0.12.0 #1286

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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
97 changes: 79 additions & 18 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ cumulus-primitives-utility = { version = "0.8.0", default-featur
cumulus-test-relay-sproof-builder = { version = "0.8.0", default-features = false }
frame-benchmarking = { version = "29.0.0", default-features = false }
frame-executive = { version = "29.0.0", default-features = false }
frame-metadata-hash-extension = { version = "0.1.0", default-features = false }
frame-support = { version = "29.0.0", default-features = false }
frame-system = { version = "29.0.0", default-features = false }
frame-system-benchmarking = { version = "29.0.0", default-features = false }
Expand Down Expand Up @@ -181,7 +182,7 @@ polkadot-parachain-primitives = { version = "7.0.0", default-featur
polkadot-primitives = { version = "8.0.0", default-features = false }
polkadot-runtime-common = { version = "8.0.0", default-features = false }
polkadot-runtime-parachains = { version = "8.0.0", default-features = false }
sp-api = { version = "27.0.0", default-features = false }
sp-api = { version = "27.0.1", default-features = false }
sp-application-crypto = { version = "31.0.0", default-features = false }
sp-arithmetic = { version = "24.0.0", default-features = false }
sp-authority-discovery = { version = "27.0.0", default-features = false }
Expand Down Expand Up @@ -266,7 +267,7 @@ sp-rpc = { version = "27.0.0" }
substrate-build-script-utils = { version = "11.0.0" }
substrate-frame-rpc-system = { version = "29.0.0" }
substrate-prometheus-endpoint = { version = "0.17.0" }
substrate-wasm-builder = { version = "18.0.0" }
substrate-wasm-builder = { version = "18.0.1" }
try-runtime-cli = { version = "0.39.0" }
xcm-emulator = { version = "0.6.0" }
xcm-simulator = { version = "8.0.0" }
Expand Down
4 changes: 2 additions & 2 deletions node/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bifrost-cli"
version = "0.11.0"
version = "0.12.0"
authors = ["Liebi Technologies <[email protected]>"]
description = "Bifrost Parachain Node"
build = "build.rs"
Expand Down Expand Up @@ -77,4 +77,4 @@ with-bifrost-kusama-runtime = ["bifrost-service/with-bifrost-kusama-runtime"]
with-bifrost-polkadot-runtime = ["bifrost-service/with-bifrost-polkadot-runtime"]
with-all-runtime = ["with-bifrost-runtime"]
try-runtime = ["bifrost-service/try-runtime", "try-runtime-cli/try-runtime"]
fast-runtime = ["bifrost-service/fast-runtime"]
fast-runtime = ["bifrost-service/fast-runtime"]
1 change: 0 additions & 1 deletion node/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,3 @@ fast-runtime = [
"bifrost-kusama-runtime/fast-runtime",
"bifrost-polkadot-runtime/fast-runtime",
]

3 changes: 2 additions & 1 deletion pallets/vtoken-voting/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ mod benchmarks {
whitelist_account!(caller);
let origin = RawOrigin::Signed(caller);
let vtoken = VKSM;
let class = 0u16;
let poll_index = 0u32;
let vote = account_vote::<T>(100u32.into());
let derivative_index = 0u16;
Expand Down Expand Up @@ -208,7 +209,7 @@ mod benchmarks {
)?;

#[extrinsic_call]
_(origin, vtoken, poll_index, derivative_index);
_(origin, vtoken, class, poll_index, derivative_index);

Ok(())
}
Expand Down
10 changes: 5 additions & 5 deletions pallets/vtoken-voting/src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![allow(ambiguous_glob_reexports)]
#![allow(unused_imports)]

use crate::{AccountVote, BalanceOf, Config, DerivativeIndex, PollIndex};
use crate::{AccountVote, BalanceOf, Config, DerivativeIndex, PollClass, PollIndex};
use parity_scale_codec::{Decode, Encode};
use sp_runtime::{traits::StaticLookup, RuntimeDebug};
use sp_std::prelude::*;
Expand Down Expand Up @@ -61,23 +61,23 @@ pub enum ConvictionVoting<T: Config> {
#[codec(index = 0)]
Vote(#[codec(compact)] PollIndex, AccountVote<BalanceOf<T>>),
#[codec(index = 3)]
Unlock(u16, <T::Lookup as StaticLookup>::Source),
Unlock(PollClass, <T::Lookup as StaticLookup>::Source),
#[codec(index = 4)]
RemoveVote(Option<u16>, PollIndex),
RemoveVote(Option<PollClass>, PollIndex),
}

pub trait ConvictionVotingCall<T: Config> {
fn vote(poll_index: PollIndex, vote: AccountVote<BalanceOf<T>>) -> Self;

fn remove_vote(class: Option<u16>, poll_index: PollIndex) -> Self;
fn remove_vote(class: Option<PollClass>, poll_index: PollIndex) -> Self;
}

impl<T: Config> ConvictionVotingCall<T> for RelayCall<T> {
fn vote(poll_index: PollIndex, vote: AccountVote<BalanceOf<T>>) -> Self {
Self::ConvictionVoting(ConvictionVoting::Vote(poll_index, vote))
}

fn remove_vote(class: Option<u16>, poll_index: PollIndex) -> Self {
fn remove_vote(class: Option<PollClass>, poll_index: PollIndex) -> Self {
Self::ConvictionVoting(ConvictionVoting::RemoveVote(class, poll_index))
}
}
Expand Down
4 changes: 3 additions & 1 deletion pallets/vtoken-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ use xcm::v4::{prelude::*, Weight as XcmWeight};
const CONVICTION_VOTING_ID: LockIdentifier = *b"vtvoting";

type PollIndex = u32;
type PollClass = u16;

pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;

Expand Down Expand Up @@ -557,6 +558,7 @@ pub mod pallet {
pub fn remove_delegator_vote(
origin: OriginFor<T>,
vtoken: CurrencyIdOf<T>,
#[pallet::compact] class: PollClass,
#[pallet::compact] poll_index: PollIndex,
#[pallet::compact] derivative_index: DerivativeIndex,
) -> DispatchResult {
Expand All @@ -570,7 +572,7 @@ pub mod pallet {
response: Default::default(),
};
let remove_vote_call =
<RelayCall<T> as ConvictionVotingCall<T>>::remove_vote(None, poll_index);
<RelayCall<T> as ConvictionVotingCall<T>>::remove_vote(Some(class), poll_index);
let (weight, extra_fee) = T::XcmDestWeightAndFee::get_operation_weight_and_fee(
CurrencyId::to_token(&vtoken).map_err(|_| Error::<T>::NoData)?,
XcmOperationType::RemoveVote,
Expand Down
4 changes: 4 additions & 0 deletions pallets/vtoken-voting/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ fn notify_vote_with_no_data_works() {
#[test]
fn notify_remove_delegator_vote_success_works() {
new_test_ext().execute_with(|| {
let class = 0;
let poll_index = 3;
let vtoken = VKSM;
let mut query_id = 0;
Expand Down Expand Up @@ -939,6 +940,7 @@ fn notify_remove_delegator_vote_success_works() {
assert_ok!(VtokenVoting::remove_delegator_vote(
RuntimeOrigin::signed(ALICE),
vtoken,
class,
poll_index,
derivative_index,
));
Expand Down Expand Up @@ -967,6 +969,7 @@ fn notify_remove_delegator_vote_success_works() {
#[test]
fn notify_remove_delegator_vote_fail_works() {
new_test_ext().execute_with(|| {
let class = 0;
let poll_index = 3;
let vtoken = VKSM;
let mut query_id = 0;
Expand Down Expand Up @@ -1014,6 +1017,7 @@ fn notify_remove_delegator_vote_fail_works() {
assert_ok!(VtokenVoting::remove_delegator_vote(
RuntimeOrigin::signed(ALICE),
vtoken,
class,
poll_index,
derivative_index,
));
Expand Down
Loading