@@ -114,7 +114,7 @@ pub struct Runtime<'config> {
114
114
return_data_len : U256 ,
115
115
return_data_offset : U256 ,
116
116
context : Context ,
117
- _config : & ' config Config ,
117
+ config : & ' config Config ,
118
118
}
119
119
120
120
impl < ' config > Runtime < ' config > {
@@ -132,7 +132,7 @@ impl<'config> Runtime<'config> {
132
132
return_data_len : U256 :: zero ( ) ,
133
133
return_data_offset : U256 :: zero ( ) ,
134
134
context,
135
- _config : config,
135
+ config,
136
136
}
137
137
}
138
138
@@ -146,6 +146,11 @@ impl<'config> Runtime<'config> {
146
146
& self . context
147
147
}
148
148
149
+ /// Get a reference to the runtime config.
150
+ pub fn config ( & self ) -> & ' config Config {
151
+ self . config
152
+ }
153
+
149
154
/// Step the runtime.
150
155
pub fn step < ' a , H : Handler > (
151
156
& ' a mut self ,
@@ -287,6 +292,9 @@ pub struct Config {
287
292
pub has_base_fee : bool ,
288
293
/// Has PUSH0 opcode. See [EIP-3855](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3855.md)
289
294
pub has_push0 : bool ,
295
+ /// Has PREVRANDAO opcode, replacing the DIFFICULTY opcode.
296
+ /// See [EIP-4399](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4399.md)
297
+ pub has_prevrandao : bool ,
290
298
/// Whether the gasometer is running in estimate mode.
291
299
pub estimate : bool ,
292
300
}
@@ -342,6 +350,7 @@ impl Config {
342
350
has_ext_code_hash : false ,
343
351
has_base_fee : false ,
344
352
has_push0 : false ,
353
+ has_prevrandao : false ,
345
354
estimate : false ,
346
355
}
347
356
}
@@ -396,6 +405,7 @@ impl Config {
396
405
has_ext_code_hash : true ,
397
406
has_base_fee : false ,
398
407
has_push0 : false ,
408
+ has_prevrandao : false ,
399
409
estimate : false ,
400
410
}
401
411
}
@@ -410,6 +420,11 @@ impl Config {
410
420
Self :: config_with_derived_values ( DerivedConfigInputs :: london ( ) )
411
421
}
412
422
423
+ /// The Merge (Paris) hard fork configuration.
424
+ pub const fn merge ( ) -> Config {
425
+ Self :: config_with_derived_values ( DerivedConfigInputs :: merge ( ) )
426
+ }
427
+
413
428
/// Shanghai hard fork configuration.
414
429
pub const fn shanghai ( ) -> Config {
415
430
Self :: config_with_derived_values ( DerivedConfigInputs :: shanghai ( ) )
@@ -423,6 +438,7 @@ impl Config {
423
438
decrease_clears_refund,
424
439
has_base_fee,
425
440
has_push0,
441
+ has_prevrandao,
426
442
disallow_executable_format,
427
443
warm_coinbase_address,
428
444
max_initcode_size,
@@ -488,6 +504,7 @@ impl Config {
488
504
has_ext_code_hash : true ,
489
505
has_base_fee,
490
506
has_push0,
507
+ has_prevrandao,
491
508
estimate : false ,
492
509
}
493
510
}
@@ -502,6 +519,7 @@ struct DerivedConfigInputs {
502
519
decrease_clears_refund : bool ,
503
520
has_base_fee : bool ,
504
521
has_push0 : bool ,
522
+ has_prevrandao : bool ,
505
523
disallow_executable_format : bool ,
506
524
warm_coinbase_address : bool ,
507
525
max_initcode_size : Option < usize > ,
@@ -516,6 +534,7 @@ impl DerivedConfigInputs {
516
534
decrease_clears_refund : false ,
517
535
has_base_fee : false ,
518
536
has_push0 : false ,
537
+ has_prevrandao : false ,
519
538
disallow_executable_format : false ,
520
539
warm_coinbase_address : false ,
521
540
max_initcode_size : None ,
@@ -530,6 +549,22 @@ impl DerivedConfigInputs {
530
549
decrease_clears_refund : true ,
531
550
has_base_fee : true ,
532
551
has_push0 : false ,
552
+ has_prevrandao : false ,
553
+ disallow_executable_format : true ,
554
+ warm_coinbase_address : false ,
555
+ max_initcode_size : None ,
556
+ }
557
+ }
558
+
559
+ const fn merge ( ) -> Self {
560
+ Self {
561
+ gas_storage_read_warm : 100 ,
562
+ gas_sload_cold : 2100 ,
563
+ gas_access_list_storage_key : 1900 ,
564
+ decrease_clears_refund : true ,
565
+ has_base_fee : true ,
566
+ has_push0 : false ,
567
+ has_prevrandao : true ,
533
568
disallow_executable_format : true ,
534
569
warm_coinbase_address : false ,
535
570
max_initcode_size : None ,
@@ -544,6 +579,7 @@ impl DerivedConfigInputs {
544
579
decrease_clears_refund : true ,
545
580
has_base_fee : true ,
546
581
has_push0 : true ,
582
+ has_prevrandao : true ,
547
583
disallow_executable_format : true ,
548
584
warm_coinbase_address : true ,
549
585
max_initcode_size : Some ( 0xC000 ) ,
0 commit comments