Skip to content

Commit

Permalink
reset halley genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
nkysg committed Apr 13, 2024
1 parent 5a55127 commit 94b5a14
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion chain/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod service;
pub const FORCE_UPGRADE_PACKAGE: Dir = include_dir!("package");

pub const MAIN_FORCE_UPGRADE_BLOCK_NUMBER: BlockNumber = 17000000;
pub const HALLEY_FORCE_UPGRADE_BLOCK_NUMBER: BlockNumber = 520;
pub const HALLEY_FORCE_UPGRADE_BLOCK_NUMBER: BlockNumber = 300;
/// XXX FIXME YSG FORCE_UPGRADE
pub static FORCE_UPGRADE_BLOCK_MAP: Lazy<BTreeMap<BlockNumber, WriteSet>> = Lazy::new(|| {
let mut maps = BTreeMap::new();
Expand Down
31 changes: 18 additions & 13 deletions cmd/db-exporter/src/force_deploy_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ pub fn force_deploy_output(
eprintln!("network only support main, barnard, halley");
return Ok(());
}
let net = ChainNetwork::new_builtin(net);
let network = ChainNetwork::new_builtin(net);
let db_storage = DBStorage::new(to_dir.join("starcoindb/db"), RocksdbConfig::default(), None)?;
let storage = Arc::new(Storage::new(StorageInstance::new_cache_and_db_instance(
CacheStorage::new(None),
db_storage,
))?);
let (chain_info, _) = Genesis::init_and_check_storage(&net, storage.clone(), to_dir.as_ref())?;
let (chain_info, _) =
Genesis::init_and_check_storage(&network, storage.clone(), to_dir.as_ref())?;
let _chain = BlockChain::new(
net.time_service(),
network.time_service(),
chain_info.head().id(),
storage.clone(),
None,
Expand All @@ -92,15 +93,19 @@ pub fn force_deploy_output(
let seq_num = statedb.get_sequence_number(addr)?;
// let time = net.time_service().now_secs() + DEFAULT_EXPIRATION_TIME;

let time = if net == ChainNetwork::from(BuiltinNetworkID::Main) {
// main block num 16912223
1710453679
} else if net == ChainNetwork::from(BuiltinNetworkID::Barnard) {
// main block num 16912223
1710453679
} else {
// halley block num 177
1712936669
let time = match net {
BuiltinNetworkID::Main => {
// main block num 16912223
1710453679
}
BuiltinNetworkID::Barnard => {
// main block num 16912223
1710453679
}
_ => {
// halley block num 177
1712936669
}
};
println!("time {}", time);
let txn = account.sign_txn(RawUserTransaction::new(
Expand All @@ -111,7 +116,7 @@ pub fn force_deploy_output(
1,
// net.time_service().now_secs() + DEFAULT_EXPIRATION_TIME,
time,
net.chain_id(),
network.chain_id(),
STC_TOKEN_CODE_STR.to_string(),
));
let upgrade_strategy_path =
Expand Down
2 changes: 1 addition & 1 deletion config/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ pub static G_HALLEY_CONFIG: Lazy<GenesisConfig> = Lazy::new(|| {
GenesisConfig {
genesis_block_parameter: GenesisBlockParameterConfig::Static(GenesisBlockParameter {
parent_hash: HashValue::sha3_256_of(b"starcoin_halley"),
timestamp: 1712902820000,
timestamp: 1712999622000,
difficulty: 100.into(),
}),
version: Version { major: 1 },
Expand Down
Binary file modified genesis/generated/halley/genesis
Binary file not shown.

0 comments on commit 94b5a14

Please sign in to comment.