Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Byzantium Update for Expanse #7146

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions ethcore/res/ethereum/expanse.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
"eip150Transition": "0x927C0",
"eip160Transition": "0x927C0",
"eip161abcTransition": "0x927C0",
"eip161dTransition": "0x927C0"
"eip161dTransition": "0x927C0",
"eip649Reward": "0x3782DACE9D900000",
"eip100bTransition": 800000,
"eip649Transition": 800000,
"expip2DurationLimit": "0x1E",
"expip2Transition": 800000
}
}
},
Expand All @@ -31,7 +36,11 @@
"subprotocolName": "exp",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"eip155Transition": "0x927C0"
"eip155Transition": "0x927C0",
"eip140Transition": 800000,
"eip211Transition": 800000,
"eip214Transition": 800000,
"eip658Transition": 800000
},
"genesis": {
"seal": {
Expand Down Expand Up @@ -61,6 +70,10 @@
"0000000000000000000000000000000000000002": { "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0000000000000000000000000000000000000003": { "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0000000000000000000000000000000000000004": { "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0000000000000000000000000000000000000005": { "builtin": { "name": "modexp", "activate_at": 800000, "pricing": { "modexp": { "divisor": 20 } } } },
"0000000000000000000000000000000000000006": { "builtin": { "name": "alt_bn128_add", "activate_at": 800000, "pricing": { "linear": { "base": 500, "word": 0 } } } },
"0000000000000000000000000000000000000007": { "builtin": { "name": "alt_bn128_mul", "activate_at": 800000, "pricing": { "linear": { "base": 40000, "word": 0 } } } },
"0000000000000000000000000000000000000008": { "builtin": { "name": "alt_bn128_pairing", "activate_at": 800000, "pricing": { "alt_bn128_pairing": { "base": 100000, "pair": 80000 } } } },
"bb94f0ceb32257275b2a7a9c094c13e469b4563e": {
"balance": "10000000000000000000000000"
},
Expand Down
15 changes: 13 additions & 2 deletions ethcore/src/ethereum/ethash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ pub struct EthashParams {
pub eip649_delay: u64,
/// EIP-649 base reward.
pub eip649_reward: Option<U256>,
/// EXPIP-2 duration limit
pub expip2_duration_limit: u64,
/// EXPIP-2 block height
pub expip2_transition: u64,
}

impl From<ethjson::spec::EthashParams> for EthashParams {
Expand Down Expand Up @@ -355,7 +359,14 @@ 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
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

};


let frontier_limit = self.ethash_params.homestead_transition;

let mut target = if header.number() < frontier_limit {
Expand Down Expand Up @@ -520,7 +531,7 @@ mod tests {
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, start_reward, block_number);
assert_eq!(15, eras);
assert_eq!(U256::from_str("271000000000000").unwrap(), reward);

let block_number = 250000000;
let (eras, reward) = ecip1017_eras_block_reward(eras_rounds, start_reward, block_number);
assert_eq!(49, eras);
Expand Down