From 2ad9fe50027aac6bf2db9d699292aae5536dc7da Mon Sep 17 00:00:00 2001 From: zhangsoledad <787953403@qq.com> Date: Fri, 28 Jul 2023 10:29:55 +0800 Subject: [PATCH] chore: light client activation parameters --- spec/src/consensus.rs | 2 +- spec/src/lib.rs | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/spec/src/consensus.rs b/spec/src/consensus.rs index 284320c989..1b3d24cc0a 100644 --- a/spec/src/consensus.rs +++ b/spec/src/consensus.rs @@ -92,7 +92,7 @@ pub(crate) const SATOSHI_PUBKEY_HASH: H160 = h160!("0x62e907b15cbf27d5425399ebf6 // only affects genesis cellbase's satoshi lock cells. pub(crate) const SATOSHI_CELL_OCCUPIED_RATIO: Ratio = Ratio::new(6, 10); -// pub(crate) const MAINNET_ACTIVATION_THRESHOLD: Ratio = Ratio::new(9, 10); +pub(crate) const LC_MAINNET_ACTIVATION_THRESHOLD: Ratio = Ratio::new(8, 10); pub(crate) const TESTNET_ACTIVATION_THRESHOLD: Ratio = Ratio::new(3, 4); /// The struct represent CKB two-step-transaction-confirmation params diff --git a/spec/src/lib.rs b/spec/src/lib.rs index c04991975e..42a32ee5cc 100644 --- a/spec/src/lib.rs +++ b/spec/src/lib.rs @@ -12,8 +12,8 @@ use crate::consensus::{ build_genesis_dao_data, build_genesis_epoch_ext, Consensus, ConsensusBuilder, - SATOSHI_CELL_OCCUPIED_RATIO, SATOSHI_PUBKEY_HASH, TESTNET_ACTIVATION_THRESHOLD, - TYPE_ID_CODE_HASH, + LC_MAINNET_ACTIVATION_THRESHOLD, SATOSHI_CELL_OCCUPIED_RATIO, SATOSHI_PUBKEY_HASH, + TESTNET_ACTIVATION_THRESHOLD, TYPE_ID_CODE_HASH, }; use crate::versionbits::{ActiveMode, Deployment, DeploymentPos}; use ckb_constant::hardfork::{mainnet, testnet}; @@ -506,7 +506,20 @@ impl ChainSpec { fn softfork_deployments(&self) -> Option> { match self.name.as_str() { - mainnet::CHAIN_SPEC_NAME => None, + mainnet::CHAIN_SPEC_NAME => { + let mut deployments = HashMap::new(); + let light_client = Deployment { + bit: 1, + start: 8_282, // 2023/09/01 00:00:00 utc + timeout: 8_552, // 8_282 + 270 + min_activation_epoch: 8_648, // 2023/11/01 00:00:00 utc + period: 42, + active_mode: ActiveMode::Normal, + threshold: LC_MAINNET_ACTIVATION_THRESHOLD, + }; + deployments.insert(DeploymentPos::LightClient, light_client); + Some(deployments) + } testnet::CHAIN_SPEC_NAME => { let mut deployments = HashMap::new(); let light_client = Deployment {