@@ -36,8 +36,9 @@ use machine::EthereumMachine;
36
36
const SNAPSHOT_BLOCKS : u64 = 5000 ;
37
37
/// Maximum number of blocks allowed in an ethash snapshot.
38
38
const MAX_SNAPSHOT_BLOCKS : u64 = 30000 ;
39
-
39
+ /// Default number of blocks the difficulty bomb is delayed in EIP-{649,1234}
40
40
const DEFAULT_EIP649_DELAY : u64 = 3_000_000 ;
41
+ const DEFAULT_EIP1234_DELAY : u64 = 2_000_000 ;
41
42
42
43
/// Ethash specific seal
43
44
#[ derive( Debug , PartialEq ) ]
@@ -120,6 +121,12 @@ pub struct EthashParams {
120
121
pub eip649_delay : u64 ,
121
122
/// EIP-649 base reward.
122
123
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 > ,
123
130
/// EXPIP-2 block height
124
131
pub expip2_transition : u64 ,
125
132
/// EXPIP-2 duration limit
@@ -152,6 +159,9 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
152
159
eip649_transition : p. eip649_transition . map_or ( u64:: max_value ( ) , Into :: into) ,
153
160
eip649_delay : p. eip649_delay . map_or ( DEFAULT_EIP649_DELAY , Into :: into) ,
154
161
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) ,
155
165
expip2_transition : p. expip2_transition . map_or ( u64:: max_value ( ) , Into :: into) ,
156
166
expip2_duration_limit : p. expip2_duration_limit . map_or ( 30 , Into :: into) ,
157
167
}
@@ -233,8 +243,10 @@ impl Engine<EthereumMachine> for Arc<Ethash> {
233
243
234
244
let mut rewards = Vec :: new ( ) ;
235
245
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 {
238
250
self . ethash_params . eip649_reward . unwrap_or ( self . ethash_params . block_reward )
239
251
} else {
240
252
self . ethash_params . block_reward
@@ -427,6 +439,9 @@ impl Ethash {
427
439
if header. number ( ) < self . ethash_params . bomb_defuse_transition {
428
440
if header. number ( ) < self . ethash_params . ecip1010_pause_transition {
429
441
let mut number = header. number ( ) ;
442
+ if number >= self . ethash_params . eip1234_transition {
443
+ number = number. saturating_sub ( self . ethash_params . eip1234_delay ) ;
444
+ }
430
445
if number >= self . ethash_params . eip649_transition {
431
446
number = number. saturating_sub ( self . ethash_params . eip649_delay ) ;
432
447
}
@@ -510,6 +525,9 @@ mod tests {
510
525
eip649_transition : u64:: max_value ( ) ,
511
526
eip649_delay : 3_000_000 ,
512
527
eip649_reward : None ,
528
+ eip1234_transition : u64:: max_value ( ) ,
529
+ eip1234_delay : 2_000_000 ,
530
+ eip1234_reward : None ,
513
531
expip2_transition : u64:: max_value ( ) ,
514
532
expip2_duration_limit : 30 ,
515
533
}
0 commit comments