Skip to content

Commit

Permalink
Merge pull request #4082 from nervosnetwork/zhangsoledad/lc-mainnet
Browse files Browse the repository at this point in the history
chore: light client activation parameters
  • Loading branch information
zhangsoledad authored Jul 31, 2023
2 parents e9eddd1 + 2ad9fe5 commit 0a3f9b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion spec/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions spec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -506,7 +506,20 @@ impl ChainSpec {

fn softfork_deployments(&self) -> Option<HashMap<DeploymentPos, Deployment>> {
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 {
Expand Down

0 comments on commit 0a3f9b1

Please sign in to comment.