@@ -36,8 +36,9 @@ use machine::EthereumMachine;
3636const SNAPSHOT_BLOCKS : u64 = 5000 ;
3737/// Maximum number of blocks allowed in an ethash snapshot.
3838const MAX_SNAPSHOT_BLOCKS : u64 = 30000 ;
39-
39+ /// Default number of blocks the difficulty bomb is delayed in EIP-{649,1234}
4040const DEFAULT_EIP649_DELAY : u64 = 3_000_000 ;
41+ const DEFAULT_EIP1234_DELAY : u64 = 2_000_000 ;
4142
4243/// Ethash specific seal
4344#[ derive( Debug , PartialEq ) ]
@@ -120,6 +121,12 @@ pub struct EthashParams {
120121 pub eip649_delay : u64 ,
121122 /// EIP-649 base reward.
122123 pub eip649_reward : Option < U256 > ,
124+ /// EIP-1234 transition block.
125+ pub eip1234_transition : u64 ,
126+ /// EIP-1234 bomb delay.
127+ pub eip1234_delay : u64 ,
128+ /// EIP-1234 base reward.
129+ pub eip1234_reward : Option < U256 > ,
123130 /// EXPIP-2 block height
124131 pub expip2_transition : u64 ,
125132 /// EXPIP-2 duration limit
@@ -152,6 +159,9 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
152159 eip649_transition : p. eip649_transition . map_or ( u64:: max_value ( ) , Into :: into) ,
153160 eip649_delay : p. eip649_delay . map_or ( DEFAULT_EIP649_DELAY , Into :: into) ,
154161 eip649_reward : p. eip649_reward . map ( Into :: into) ,
162+ eip1234_transition : p. eip1234_transition . map_or ( u64:: max_value ( ) , Into :: into) ,
163+ eip1234_delay : p. eip1234_delay . map_or ( DEFAULT_EIP1234_DELAY , Into :: into) ,
164+ eip1234_reward : p. eip1234_reward . map ( Into :: into) ,
155165 expip2_transition : p. expip2_transition . map_or ( u64:: max_value ( ) , Into :: into) ,
156166 expip2_duration_limit : p. expip2_duration_limit . map_or ( 30 , Into :: into) ,
157167 }
@@ -233,8 +243,10 @@ impl Engine<EthereumMachine> for Arc<Ethash> {
233243
234244 let mut rewards = Vec :: new ( ) ;
235245
236- // Applies EIP-649 reward.
237- let reward = if number >= self . ethash_params . eip649_transition {
246+ // Applies EIP-{649,1234} reward, defaults to block_reward.
247+ let reward = if number >= self . ethash_params . eip1234_transition {
248+ self . ethash_params . eip1234_reward . unwrap_or ( self . ethash_params . block_reward )
249+ } else if number >= self . ethash_params . eip649_transition {
238250 self . ethash_params . eip649_reward . unwrap_or ( self . ethash_params . block_reward )
239251 } else {
240252 self . ethash_params . block_reward
@@ -427,6 +439,9 @@ impl Ethash {
427439 if header. number ( ) < self . ethash_params . bomb_defuse_transition {
428440 if header. number ( ) < self . ethash_params . ecip1010_pause_transition {
429441 let mut number = header. number ( ) ;
442+ if number >= self . ethash_params . eip1234_transition {
443+ number = number. saturating_sub ( self . ethash_params . eip1234_delay ) ;
444+ }
430445 if number >= self . ethash_params . eip649_transition {
431446 number = number. saturating_sub ( self . ethash_params . eip649_delay ) ;
432447 }
@@ -510,6 +525,9 @@ mod tests {
510525 eip649_transition : u64:: max_value ( ) ,
511526 eip649_delay : 3_000_000 ,
512527 eip649_reward : None ,
528+ eip1234_transition : u64:: max_value ( ) ,
529+ eip1234_delay : 2_000_000 ,
530+ eip1234_reward : None ,
513531 expip2_transition : u64:: max_value ( ) ,
514532 expip2_duration_limit : 30 ,
515533 }
0 commit comments