From 8f08de1753ecaee95dcdf3744ad2bd9a4f4ea414 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Wed, 18 Jan 2023 10:28:01 +0800 Subject: [PATCH] Burn parachain backing RING (#218) --- tool/state-processor/src/configuration.rs | 10 ++++++++++ tool/state-processor/src/system/README.md | 8 ++++---- tool/state-processor/src/system/mod.rs | 9 +++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tool/state-processor/src/configuration.rs b/tool/state-processor/src/configuration.rs index d8438691e..4e4589a0a 100644 --- a/tool/state-processor/src/configuration.rs +++ b/tool/state-processor/src/configuration.rs @@ -5,22 +5,32 @@ pub const ROOT: [u8; 20] = [0x72, 0x6f, 0x6f, 0x74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 pub trait Configurable { const NAME: &'static str; + // This account's balance will be burned. + // Please make sure no one transfer balance to this account. + const PARACHAIN_BACKING: &'static str; } impl Configurable for () { const NAME: &'static str = ""; + const PARACHAIN_BACKING: &'static str = ""; } pub struct Darwinia; impl Configurable for Darwinia { const NAME: &'static str = "darwinia"; + const PARACHAIN_BACKING: &'static str = + "0x1000000000000000000000000000000000000000000000000000000000000000"; } pub struct Crab; impl Configurable for Crab { const NAME: &'static str = "crab"; + const PARACHAIN_BACKING: &'static str = + "0x64766d3a0000000000000035a314e53e2fddfeca7b743042aacfb1abaf0adea3"; } pub struct Pangolin; impl Configurable for Pangolin { const NAME: &'static str = "pangolin"; + const PARACHAIN_BACKING: &'static str = + "0x64766d3a000000000000008c585f9791ee5b4b23fe82888ce576dbb69607ebe9"; } diff --git a/tool/state-processor/src/system/README.md b/tool/state-processor/src/system/README.md index 8eb034bde..868188c05 100644 --- a/tool/state-processor/src/system/README.md +++ b/tool/state-processor/src/system/README.md @@ -14,11 +14,12 @@ - use all previous data to build the new accounts and calculate total issuances - merge solo and para account infos - how to deal with the account references? - TODO + - burn parachain backing ring - set `Balances::TotalIssuance` - compare the calculated one with the storage one - - remove para backing account - TODO - - check remaining sum - TODO - - XCM relate - TODO + - remove para backing account + - check remaining sum + - XCM related things - create KTON asset details - set accounts - if is EVM address @@ -30,7 +31,6 @@ - insert to `AccountMigration::Accounts` - set KTON total issuances - compare the calculated one with the storage one - - check remaining sum - TODO - some remaining accounts, bridge endpoint accounts - TODO - special accounts - TODO diff --git a/tool/state-processor/src/system/mod.rs b/tool/state-processor/src/system/mod.rs index 2b2fa4296..8d20f1d99 100644 --- a/tool/state-processor/src/system/mod.rs +++ b/tool/state-processor/src/system/mod.rs @@ -86,6 +86,14 @@ where ring_total_issuance += v.data.reserved; }); + log::info!("burn parachain backing ring"); + if let Some(a) = accounts.get_mut(&blake2_128_concat_to_string( + array_bytes::hex2array_unchecked::<_, 32>(S::PARACHAIN_BACKING), + )) { + ring_total_issuance -= a.ring; + a.ring = 0; + } + log::info!("`ring_total_issuance({ring_total_issuance})`"); log::info!("`ring_total_issuance_storage({ring_total_issuance_storage})`"); @@ -226,6 +234,7 @@ where ); } }); + log::info!("total_remaining_ring({total_remaining_ring})"); log::info!("total_remaining_kton({total_remaining_kton})");