Skip to content

Commit

Permalink
Release client v0.10.36, Centrifuge 1025 & Altair 1034 (#1749)
Browse files Browse the repository at this point in the history
* chore: reset FI on CFG

* refactor: use PalletInfoAccess API

* fix: bump FI storage version

* chore: cleanup Dev migrations

* chore: bump client version

* fix: orderbook benches

* fix: orderbook sync test & bench currency ids

* chore: update weights

* fix: breaking changes from weight updates

* refactor: split PoolFees trait into *Mutate and *Inspect

* fix: add default pool fees weights

* chore: cleanup unused imports

* fix: apply pool fees weights to txs
  • Loading branch information
wischli authored Mar 7, 2024
1 parent 3d0c285 commit 544ce02
Show file tree
Hide file tree
Showing 154 changed files with 5,881 additions and 4,268 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

13 changes: 12 additions & 1 deletion libs/traits/src/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,30 @@ pub enum PoolFeeBucket {
}

/// Trait to add fees to a pool
pub trait PoolFees {
pub trait PoolFeesMutate {
type PoolId;
type FeeInfo;

/// Add a new fee to the pool and bucket.
///
/// NOTE: Assumes call permissions are separately checked beforehand.
fn add_fee(pool_id: Self::PoolId, bucket: PoolFeeBucket, fee: Self::FeeInfo) -> DispatchResult;
}

/// Trait to get pool fees counts
pub trait PoolFeesInspect {
type PoolId;

/// Returns the maximum number of pool fees required for accurate weights
fn get_max_fee_count() -> u32;

/// Returns the maximum number of pool fees per bucket required for accurate
/// weights
fn get_max_fees_per_bucket() -> u32;

/// Returns the current amount of active fees for the given pool
fn get_pool_fee_count(pool: Self::PoolId) -> u32;

/// Returns the current amount of active fees for the given pool and bucket
/// pair
fn get_pool_fee_bucket_count(pool: Self::PoolId, bucket: PoolFeeBucket) -> u32;
Expand Down
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ is-it-maintained-open-issues = { repository = "centrifuge/centrifuge-chain" }

[package]
name = "centrifuge-chain"
version = "0.10.35"
version = "0.10.36"
description = "Centrifuge chain implementation in Rust."
build = "build.rs"
default-run = "centrifuge-chain"
Expand Down
4 changes: 2 additions & 2 deletions pallets/block-rewards/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ pub mod pallet {

/// Admin method to set the reward amount for a collator used for the
/// next sessions. Current session is not affected by this call.
#[pallet::weight(T::WeightInfo::set_collator_reward())]
#[pallet::weight(T::WeightInfo::set_collator_reward_per_session())]
#[pallet::call_index(1)]
pub fn set_collator_reward_per_session(
origin: OriginFor<T>,
Expand All @@ -300,7 +300,7 @@ pub mod pallet {

/// Admin method to set the treasury inflation rate for the next
/// sessions. Current session is not affected by this call.
#[pallet::weight(T::WeightInfo::set_total_reward())]
#[pallet::weight(T::WeightInfo::set_annual_treasury_inflation_rate())]
#[pallet::call_index(2)]
pub fn set_annual_treasury_inflation_rate(
origin: OriginFor<T>,
Expand Down
42 changes: 25 additions & 17 deletions pallets/block-rewards/src/weights.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//! Autogenerated weights for pallet_block_rewards
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION
//! 4.0.0-dev DATE: 2023-02-28, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH
//! RANGE: `[]` EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN:
//! Some("development"), DB CACHE: 1024
//! 4.0.0-dev DATE: 2024-03-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH
//! RANGE: `[]` WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner`, CPU: `AMD EPYC 7763 64-Core Processor`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN:
//! Some("centrifuge-dev"), DB CACHE: 1024
// Executed Command:
// target/release/centrifuge-chain
Expand Down Expand Up @@ -32,50 +34,56 @@ use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_block_rewards.
pub trait WeightInfo {
fn claim_reward() -> Weight;
fn set_collator_reward() -> Weight;
fn set_total_reward() -> Weight;
fn set_collator_reward_per_session() -> Weight;
fn set_annual_treasury_inflation_rate() -> Weight;
}

/// Weights for pallet_block_rewards using the Substrate node and recommended
/// hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn claim_reward() -> Weight {
Weight::from_parts(49_000_000, 0)
Weight::from_parts(90_960_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
}

fn set_collator_reward() -> Weight {
Weight::from_parts(8_000_000, 0)
fn set_collator_reward_per_session() -> Weight {
Weight::from_parts(9_327_000, 0)
.saturating_add(Weight::from_parts(0, 3582))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}

fn set_total_reward() -> Weight {
Weight::from_parts(9_000_000, 0)
.saturating_add(T::DbWeight::get().reads(2))
fn set_annual_treasury_inflation_rate() -> Weight {
Weight::from_parts(9_418_000, 0)
.saturating_add(Weight::from_parts(0, 3582))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
fn claim_reward() -> Weight {
Weight::from_parts(49_000_000, 0)
Weight::from_parts(90_960_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(3))
}

fn set_collator_reward() -> Weight {
Weight::from_parts(8_000_000, 0)
fn set_collator_reward_per_session() -> Weight {
Weight::from_parts(9_327_000, 0)
.saturating_add(Weight::from_parts(0, 3582))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}

fn set_total_reward() -> Weight {
Weight::from_parts(9_000_000, 0)
.saturating_add(RocksDbWeight::get().reads(2))
fn set_annual_treasury_inflation_rate() -> Weight {
Weight::from_parts(9_418_000, 0)
.saturating_add(Weight::from_parts(0, 3582))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
}
4 changes: 4 additions & 0 deletions pallets/foreign-investments/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ pub mod pallet {

use super::*;

/// The current storage version.
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);

#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
pub struct Pallet<T>(_);

/// Configure the pallet by specifying the parameters and types on which it
Expand Down
5 changes: 0 additions & 5 deletions pallets/oracle-collection/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub trait WeightInfo {
fn propose_update_collection_info(feeders: u32) -> Weight;
fn apply_update_collection_info(feeders: u32) -> Weight;
fn update_collection(feeders: u32, keys: u32) -> Weight;
fn set_collection_info() -> Weight;
}

impl WeightInfo for () {
Expand All @@ -32,8 +31,4 @@ impl WeightInfo for () {
fn update_collection(_: u32, _: u32) -> Weight {
Weight::zero()
}

fn set_collection_info() -> Weight {
Weight::zero()
}
}
4 changes: 2 additions & 2 deletions pallets/order-book/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use sp_runtime::{traits::checked_pow, FixedPointNumber};

use super::*;

const CURRENCY_IN: u32 = 1;
const CURRENCY_OUT: u32 = 2;
const CURRENCY_IN: u32 = 1001;
const CURRENCY_OUT: u32 = 1002;
const RATIO: u32 = 2; // x2
const FEEDER: u32 = 23;

Expand Down
2 changes: 1 addition & 1 deletion pallets/order-book/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
/// Create an order with the default min fulfillment amount.
#[pallet::call_index(0)]
#[pallet::weight(T::Weights::create_order())]
#[pallet::weight(T::Weights::place_order())]
pub fn place_order(
origin: OriginFor<T>,
currency_in: T::CurrencyId,
Expand Down
5 changes: 2 additions & 3 deletions pallets/order-book/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ pub const FEEDER: u64 = 0x42;
pub const INITIAL_A: Balance = token_a(1000);
pub const INITIAL_B: Balance = token_b(1000);

pub const CURRENCY_A: CurrencyId = CurrencyId::ForeignAsset(1);
pub const CURRENCY_B: CurrencyId = CurrencyId::ForeignAsset(2);
pub const CURRENCY_X: CurrencyId = CurrencyId::ForeignAsset(3);
pub const CURRENCY_A: CurrencyId = CurrencyId::ForeignAsset(1001);
pub const CURRENCY_B: CurrencyId = CurrencyId::ForeignAsset(1002);
pub const CURRENCY_A_DECIMALS: u32 = 9;
pub const CURRENCY_B_DECIMALS: u32 = 12;

Expand Down
4 changes: 2 additions & 2 deletions pallets/order-book/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
pub use frame_support::weights::Weight;

pub trait WeightInfo {
fn create_order() -> Weight;
fn place_order() -> Weight;
fn update_order() -> Weight;
fn cancel_order() -> Weight;
fn fill_order() -> Weight;
fn set_market_feeder() -> Weight;
}

impl WeightInfo for () {
fn create_order() -> Weight {
fn place_order() -> Weight {
Weight::zero()
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/pool-fees/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use cfg_traits::{
benchmarking::{PoolBenchmarkHelper, PoolFeesBenchmarkHelper},
changes::ChangeGuard,
fee::{PoolFeeBucket, PoolFees as _},
fee::{PoolFeeBucket, PoolFeesMutate as _},
};
use cfg_types::pools::PoolFeeEditor;
use frame_benchmarking::v2::*;
Expand Down
Loading

0 comments on commit 544ce02

Please sign in to comment.