Expanse Byzantium update w/ correct metropolis difficulty increment divisor (#7463)
* Byzantium Update for Expanse Here the changes go. Hope I didnt miss anything. * expip2 changes - update duration limit * Fix missing EXPIP-2 fields * Format numbers as hex * Fix compilation errors * Group expanse chain spec fields together * Set metropolisDifficultyIncrementDivisor for Expanse * Revert #7437 * Add Expanse block 900_000 hash checkpoint
This commit is contained in:
@@ -90,6 +90,10 @@ pub struct EthashParams {
|
||||
pub eip649_delay: u64,
|
||||
/// EIP-649 base reward.
|
||||
pub eip649_reward: Option<U256>,
|
||||
/// EXPIP-2 block height
|
||||
pub expip2_transition: u64,
|
||||
/// EXPIP-2 duration limit
|
||||
pub expip2_duration_limit: u64,
|
||||
}
|
||||
|
||||
impl From<ethjson::spec::EthashParams> for EthashParams {
|
||||
@@ -118,6 +122,8 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
|
||||
eip649_transition: p.eip649_transition.map_or(u64::max_value(), Into::into),
|
||||
eip649_delay: p.eip649_delay.map_or(DEFAULT_EIP649_DELAY, Into::into),
|
||||
eip649_reward: p.eip649_reward.map(Into::into),
|
||||
expip2_transition: p.expip2_transition.map_or(u64::max_value(), Into::into),
|
||||
expip2_duration_limit: p.expip2_duration_limit.map_or(30, Into::into),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,7 +360,13 @@ impl Ethash {
|
||||
self.ethash_params.difficulty_bound_divisor
|
||||
};
|
||||
|
||||
let duration_limit = self.ethash_params.duration_limit;
|
||||
let expip2_hardfork = header.number() >= self.ethash_params.expip2_transition;
|
||||
let duration_limit = if expip2_hardfork {
|
||||
self.ethash_params.expip2_duration_limit
|
||||
} else {
|
||||
self.ethash_params.duration_limit
|
||||
};
|
||||
|
||||
let frontier_limit = self.ethash_params.homestead_transition;
|
||||
|
||||
let mut target = if header.number() < frontier_limit {
|
||||
@@ -363,8 +375,7 @@ impl Ethash {
|
||||
} else {
|
||||
*parent.difficulty() + (*parent.difficulty() / difficulty_bound_divisor)
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
trace!(target: "ethash", "Calculating difficulty parent.difficulty={}, header.timestamp={}, parent.timestamp={}", parent.difficulty(), header.timestamp(), parent.timestamp());
|
||||
//block_diff = parent_diff + parent_diff // 2048 * max(1 - (block_timestamp - parent_timestamp) // 10, -99)
|
||||
let (increment_divisor, threshold) = if header.number() < self.ethash_params.eip100b_transition {
|
||||
|
||||
@@ -65,6 +65,11 @@ pub fn new_classic<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(params.into(), include_bytes!("../../res/ethereum/classic.json"))
|
||||
}
|
||||
|
||||
/// Create a new Expanse mainnet chain spec.
|
||||
pub fn new_expanse<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(params.into(), include_bytes!("../../res/ethereum/expanse.json"))
|
||||
}
|
||||
|
||||
/// Create a new Musicoin mainnet chain spec.
|
||||
pub fn new_musicoin<'a, T: Into<SpecParams<'a>>>(params: T) -> Spec {
|
||||
load(params.into(), include_bytes!("../../res/ethereum/musicoin.json"))
|
||||
|
||||
@@ -385,5 +385,7 @@ pub fn get_default_ethash_params() -> EthashParams {
|
||||
eip649_transition: u64::max_value(),
|
||||
eip649_delay: 3_000_000,
|
||||
eip649_reward: None,
|
||||
expip2_transition: u64::max_value(),
|
||||
expip2_duration_limit: 30,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user