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

Release v0.10.34 #1573

Merged
merged 23 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4490d8f
feat: add usdc migration
wischli Sep 27, 2023
477b342
chore: bump dev spec_version
wischli Sep 27, 2023
0bc39bb
chore: bump centrifuge spec_version
wischli Sep 27, 2023
d41f4f3
fix: foreign investments bench
wischli Sep 27, 2023
47569ef
chore: bump root toml version
wischli Sep 27, 2023
e277015
feat: add LP Celo wrapped USDC
wischli Sep 27, 2023
ca9070f
fmt: fix
wischli Sep 28, 2023
d448891
Merge remote-tracking branch 'origin/main' into release-v0.10.34
wischli Sep 28, 2023
4649fb3
feat: rm StumpInboundQueue
wischli Sep 28, 2023
0f187e3
refactor: move LP config to separate file
wischli Sep 28, 2023
c2c5bb5
fix: remove UpdateTrancheInvestmentLimit msg
wischli Sep 28, 2023
049007b
Merge remote-tracking branch 'origin/main' into release-v0.10.34
wischli Sep 28, 2023
d64b21f
chore: add foreign investments to CODEOWNERS
wischli Sep 28, 2023
68ceafd
chore: update centrifuge benchmarks
wischli Sep 28, 2023
a0a7edc
chore: update defensive manual LP benchmarks
wischli Sep 28, 2023
ed46f62
chore: update altair weights
wischli Sep 28, 2023
1cd69de
fix: add missing benches to altair runtime
wischli Sep 28, 2023
00d4466
fix: add missing PolkadotXcm bench to cfg runtime
wischli Sep 28, 2023
2007529
chore: update weights again
wischli Sep 28, 2023
b9899e0
fix: enable LiquidityRewards benches in runtimes
wischli Sep 28, 2023
e2fa794
fix: missing param loans bench apply_transfer_debt
wischli Sep 28, 2023
1698109
fix: upgrade script
wischli Sep 29, 2023
0a9ef1c
fix: anemoy migration catalyst + remove USDC suffix
wischli Sep 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pallets/restricted-tokens/* @mustermeiszer
pallets/data-collector/* @lemunozm
pallets/fees/* @lemunozm
pallets/transfer-allowlist/* @mustermeiszer
pallets/foreign-investments/* @wischli

## Changes to specific libraries
libs/mock-builder/* @lemunozm
Expand All @@ -38,7 +39,7 @@ libs/traits/src/changes.rs @lemunozm
libs/traits/src/data.rs @lemunozm

## Changes to runtime
runtime/common/* @mustermeiszer @NunoAlexandre @hieronx @lemunozm
runtime/common/* @mustermeiszer @NunoAlexandre @hieronx @lemunozm @wischli
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope it's fine I have added myself here.

runtime/altair/* @mustermeiszer @NunoAlexandre @hieronx @wischli
runtime/centrifuge/* @mustermeiszer @NunoAlexandre @hieronx @wischli

Expand Down
6 changes: 3 additions & 3 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
@@ -1,6 +1,6 @@
[package]
name = "centrifuge-chain"
version = "0.10.28"
version = "0.10.34"
authors = ["Centrifuge <admin@centrifuge.io>"]
description = "Centrifuge chain implementation in Rust."
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion libs/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub mod tokens;
pub mod xcm;

/// The EVM Chain ID
/// The type should accomodate all chain ids listed on <https://chainlist.org/>.
/// The type should accommodate all chain ids listed on <https://chainlist.org/>.
pub type EVMChainId = u64;

/// A raw para ID
Expand Down
112 changes: 70 additions & 42 deletions libs/types/src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,48 +324,6 @@ impl From<LiquidityPoolsWrappedToken> for DomainAddress {
}
}

pub const LP_ETH_USDC_CURRENCY_ID: CurrencyId = CurrencyId::ForeignAsset(100001);

pub const ETHEREUM_MAINNET_CHAIN_ID: EVMChainId = 1;
pub const GOERLI_CHAIN_ID: EVMChainId = 5;

pub const ETHEREUM_USDC: [u8; 20] = hex_literal::hex!("a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48");
pub const GOERLI_USDC: [u8; 20] = hex_literal::hex!("07865c6e87b9f70255377e024ace6630c1eaa37f");

/// The metadata for the LpEthUSDC token
// TODO(nuno): once used in the Centrifuge migration registering it,
// move it directly to the `chain_spec` > development genesis where it is also
// used.
pub fn lp_eth_usdc_metadata(
pallet_index: PalletIndex,
chain_id: EVMChainId,
usdc_contract: [u8; 20],
) -> AssetMetadata<Balance, CustomMetadata> {
AssetMetadata {
decimals: 6,
name: "LP Ethereum Wrapped USDC".as_bytes().to_vec(),
symbol: "LpEthUSDC".as_bytes().to_vec(),
existential_deposit: 1000,
location: Some(VersionedMultiLocation::V3(MultiLocation {
parents: 0,
interior: xcm::v3::Junctions::X3(
PalletInstance(pallet_index),
GlobalConsensus(NetworkId::Ethereum { chain_id }),
AccountKey20 {
network: None,
key: usdc_contract,
},
),
})),
additional: CustomMetadata {
transferability: CrossChainTransferability::LiquidityPools,
mintable: false,
permissioned: false,
pool_currency: true,
},
}
}

pub mod before {
use cfg_primitives::{PoolId, TrancheId};
use codec::{Decode, Encode, MaxEncodedLen};
Expand Down Expand Up @@ -407,6 +365,76 @@ pub mod before {
}
}

pub mod usdc {
use sp_std::vec::Vec;

use super::*;

pub const MIN_SWAP_ORDER_AMOUNT: Balance = 10_000_000;
pub const DECIMALS: u32 = 6;
pub const EXISTENTIAL_DEPOSIT: Balance = 1000;

pub const CURRENCY_ID_DOT_NATIVE: CurrencyId = CurrencyId::ForeignAsset(6);
pub const CURRENCY_ID_LP_ETH: CurrencyId = CurrencyId::ForeignAsset(100_001);
pub const CURRENCY_ID_LP_ETH_GOERLI: CurrencyId = CurrencyId::ForeignAsset(100_001);
pub const CURRENCY_ID_LP_BASE: CurrencyId = CurrencyId::ForeignAsset(100_002);
pub const CURRENCY_ID_LP_ARB: CurrencyId = CurrencyId::ForeignAsset(100_003);
pub const CURRENCY_ID_LP_CELO: CurrencyId = CurrencyId::ForeignAsset(100_004);

pub const CHAIN_ID_ETHEREUM_MAINNET: EVMChainId = 1;
pub const CHAIN_ID_ETH_GOERLI_TESTNET: EVMChainId = 5;
pub const CHAIN_ID_BASE_MAINNET: EVMChainId = 8453;
pub const CHAIN_ID_ARBITRUM_MAINNET: EVMChainId = 42_161;
pub const CHAIN_ID_CELO_MAINNET: EVMChainId = 42_220;

pub const CONTRACT_ETHEREUM: [u8; 20] =
hex_literal::hex!("a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48");
pub const CONTRACT_ETH_GOERLI: [u8; 20] =
hex_literal::hex!("07865c6e87b9f70255377e024ace6630c1eaa37f");
pub const CONTRACT_BASE: [u8; 20] =
hex_literal::hex!("833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
pub const CONTRACT_ARBITRUM: [u8; 20] =
hex_literal::hex!("af88d065e77c8cC2239327C5EDb3A432268e5831");
pub const CONTRACT_CELO: [u8; 20] =
hex_literal::hex!("37f750B7cC259A2f741AF45294f6a16572CF5cAd");

/// The metadata generator for the LP wrapped USDC currencies
// TODO(future): If no further LP wrapped USDC variants are expected, move this
// to `chain_spec.rs`.
pub fn lp_wrapped_usdc_metadata(
name: Vec<u8>,
symbol: Vec<u8>,
pallet_index: PalletIndex,
chain_id: EVMChainId,
contract_address_usdc: [u8; 20],
pool_currency: bool,
) -> AssetMetadata<Balance, CustomMetadata> {
AssetMetadata {
decimals: DECIMALS,
name,
symbol,
existential_deposit: EXISTENTIAL_DEPOSIT,
location: Some(VersionedMultiLocation::V3(MultiLocation {
parents: 0,
interior: xcm::v3::Junctions::X3(
PalletInstance(pallet_index),
GlobalConsensus(NetworkId::Ethereum { chain_id }),
AccountKey20 {
network: None,
key: contract_address_usdc,
},
),
})),
additional: CustomMetadata {
transferability: CrossChainTransferability::LiquidityPools,
mintable: false,
permissioned: false,
pool_currency,
},
}
}
}

#[cfg(test)]
mod tests {
use frame_support::parameter_types;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl WeightInfo for () {
// NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve`
// This one has one read and one write for sure and possible one
// read for `AdminOrigin`
Weight::from_parts(17_000_000, 5991)
Weight::from_parts(30_117_000, 5991)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
Expand All @@ -35,7 +35,7 @@ impl WeightInfo for () {
// NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve`
// This one has one read and one write for sure and possible one
// read for `AdminOrigin`
Weight::from_parts(17_000_000, 5991)
Weight::from_parts(30_117_000, 5991)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
Expand Down
17 changes: 9 additions & 8 deletions pallets/liquidity-pools-gateway/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl WeightInfo for () {
// NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve`
// This one has one read and one write for sure and possible one
// read for `AdminOrigin`
Weight::from_parts(17_000_000, 5991)
Weight::from_parts(30_117_000, 5991)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
Expand All @@ -44,7 +44,7 @@ impl WeightInfo for () {
// NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve`
// This one has one read and one write for sure and possible one
// read for `AdminOrigin`
Weight::from_parts(17_000_000, 5991)
Weight::from_parts(30_117_000, 5991)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
Expand All @@ -55,7 +55,7 @@ impl WeightInfo for () {
// NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve`
// This one has one read and one write for sure and possible one
// read for `AdminOrigin`
Weight::from_parts(17_000_000, 5991)
Weight::from_parts(30_117_000, 5991)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
Expand All @@ -66,7 +66,7 @@ impl WeightInfo for () {
// NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve`
// This one has one read and one write for sure and possible one
// read for `AdminOrigin`
Weight::from_parts(17_000_000, 5991)
Weight::from_parts(30_117_000, 5991)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}
Expand All @@ -77,20 +77,21 @@ impl WeightInfo for () {
// NOTE: Reasonable weight taken from `PoolSystem::set_max_reserve`
// This one has one read and one write for sure and possible one
// read for `AdminOrigin`
Weight::from_parts(17_000_000, 5991)
Weight::from_parts(30_117_000, 5991)
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(1))
}

fn process_msg() -> Weight {
// TODO: BENCHMARK AND USE REAL WEIGHTS
// NOTE: Defensive hardcoded weight taken from pool_system::execute_epoch. Will
// be replaced with real benchmark soon.
//
// NOTE: For reference this weight compared to our maximum weight
// * This weight { ref_time: 4333558693, proof_size: 91070 }
// * Maximum weight { ref_time: 500000000000, proof_size: 5242880 }
//
Weight::from_parts(78_019_565, 19974)
.saturating_add(Weight::from_ref_time(38_884_782).saturating_mul(N))
Weight::from_parts(124_979_771, 19974)
.saturating_add(Weight::from_ref_time(58_136_652).saturating_mul(N))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(N)))
.saturating_add(RocksDbWeight::get().writes(8))
Expand Down
42 changes: 24 additions & 18 deletions pallets/liquidity-pools/src/defensive_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ const N: u64 = 4;

impl WeightInfo for () {
fn set_domain_router() -> Weight {
// TODO: BENCHMARK AND USE REAL WEIGHTS
Weight::from_parts(78_019_565, 19974)
.saturating_add(Weight::from_ref_time(38_884_782).saturating_mul(N))
// NOTE: Defensive hardcoded weight taken from pool_system::execute_epoch. Will
// be replaced with real benchmark soon.
Weight::from_parts(124_979_771, 19974)
.saturating_add(Weight::from_ref_time(58_136_652).saturating_mul(N))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(N)))
.saturating_add(RocksDbWeight::get().writes(8))
Expand All @@ -39,9 +40,10 @@ impl WeightInfo for () {
}

fn add_pool() -> Weight {
// TODO: BENCHMARK AND USE REAL WEIGHTS
Weight::from_parts(78_019_565, 19974)
.saturating_add(Weight::from_ref_time(38_884_782).saturating_mul(N))
// NOTE: Defensive hardcoded weight taken from pool_system::execute_epoch. Will
// be replaced with real benchmark soon.
Weight::from_parts(124_979_771, 19974)
.saturating_add(Weight::from_ref_time(58_136_652).saturating_mul(N))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(N)))
.saturating_add(RocksDbWeight::get().writes(8))
Expand All @@ -50,9 +52,10 @@ impl WeightInfo for () {
}

fn add_tranche() -> Weight {
// TODO: BENCHMARK AND USE REAL WEIGHTS
Weight::from_parts(78_019_565, 19974)
.saturating_add(Weight::from_ref_time(38_884_782).saturating_mul(N))
// NOTE: Defensive hardcoded weight taken from pool_system::execute_epoch. Will
// be replaced with real benchmark soon.
Weight::from_parts(124_979_771, 19974)
.saturating_add(Weight::from_ref_time(58_136_652).saturating_mul(N))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(N)))
.saturating_add(RocksDbWeight::get().writes(8))
Expand All @@ -61,9 +64,10 @@ impl WeightInfo for () {
}

fn update_token_price() -> Weight {
// TODO: BENCHMARK AND USE REAL WEIGHTS
Weight::from_parts(78_019_565, 19974)
.saturating_add(Weight::from_ref_time(38_884_782).saturating_mul(N))
// NOTE: Defensive hardcoded weight taken from pool_system::execute_epoch. Will
// be replaced with real benchmark soon.
Weight::from_parts(124_979_771, 19974)
.saturating_add(Weight::from_ref_time(58_136_652).saturating_mul(N))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(N)))
.saturating_add(RocksDbWeight::get().writes(8))
Expand All @@ -72,9 +76,10 @@ impl WeightInfo for () {
}

fn update_member() -> Weight {
// TODO: BENCHMARK AND USE REAL WEIGHTS
Weight::from_parts(78_019_565, 19974)
.saturating_add(Weight::from_ref_time(38_884_782).saturating_mul(N))
// NOTE: Defensive hardcoded weight taken from pool_system::execute_epoch. Will
// be replaced with real benchmark soon.
Weight::from_parts(124_979_771, 19974)
.saturating_add(Weight::from_ref_time(58_136_652).saturating_mul(N))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(N)))
.saturating_add(RocksDbWeight::get().writes(8))
Expand All @@ -83,9 +88,10 @@ impl WeightInfo for () {
}

fn transfer() -> Weight {
// TODO: BENCHMARK AND USE REAL WEIGHTS
Weight::from_parts(78_019_565, 19974)
.saturating_add(Weight::from_ref_time(38_884_782).saturating_mul(N))
// NOTE: Defensive hardcoded weight taken from pool_system::execute_epoch. Will
// be replaced with real benchmark soon.
Weight::from_parts(124_979_771, 19974)
.saturating_add(Weight::from_ref_time(58_136_652).saturating_mul(N))
.saturating_add(RocksDbWeight::get().reads(8))
.saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(N)))
.saturating_add(RocksDbWeight::get().writes(8))
Expand Down