@@ -238,6 +238,11 @@ impl Config {
238
238
Self :: config_with_derived_values ( DerivedConfigInputs :: shanghai ( ) )
239
239
}
240
240
241
+ /// Cancun hard fork configuration.
242
+ pub const fn cancun ( ) -> Config {
243
+ Self :: config_with_derived_values ( DerivedConfigInputs :: cancun ( ) )
244
+ }
245
+
241
246
const fn config_with_derived_values ( inputs : DerivedConfigInputs ) -> Config {
242
247
let DerivedConfigInputs {
243
248
gas_storage_read_warm,
@@ -324,8 +329,11 @@ impl Config {
324
329
/// Independent inputs that are used to derive other config values.
325
330
/// See `Config::config_with_derived_values` implementation for details.
326
331
struct DerivedConfigInputs {
332
+ /// `WARM_STORAGE_READ_COST` (see EIP-2929).
327
333
gas_storage_read_warm : u64 ,
334
+ /// `COLD_SLOAD_COST` (see EIP-2929).
328
335
gas_sload_cold : u64 ,
336
+ /// `ACCESS_LIST_STORAGE_KEY_COST` (see EIP-2930).
329
337
gas_access_list_storage_key : u64 ,
330
338
decrease_clears_refund : bool ,
331
339
has_base_fee : bool ,
@@ -407,4 +415,22 @@ impl DerivedConfigInputs {
407
415
eip_1559_enabled : true ,
408
416
}
409
417
}
418
+
419
+ const fn cancun ( ) -> Self {
420
+ Self {
421
+ gas_storage_read_warm : 100 ,
422
+ gas_sload_cold : 2100 ,
423
+ gas_access_list_storage_key : 1900 ,
424
+ decrease_clears_refund : true ,
425
+ has_base_fee : true ,
426
+ has_push0 : true ,
427
+ disallow_executable_format : true ,
428
+ warm_coinbase_address : true ,
429
+ // 2 * (MAX_CODE_SIZE = `24576`) = (0xC000 = 49152) as per EIP-3860
430
+ max_initcode_size : Some ( 0xC000 ) ,
431
+ eip_1153_enabled : true ,
432
+ eip_5656_enabled : true ,
433
+ eip_1559_enabled : true ,
434
+ }
435
+ }
410
436
}
0 commit comments