Skip to content

Commit bf6ccc0

Browse files
authored
chore(l1): update genesis files to include Fusaka fields (#4643)
**Description** - Added the Fusaka timestamp and blob schedule to the genesis JSON files, for both testnets and mainnet - Updated genesis.rs with BPO forks for future-proofing - Updated the ForkID test cases to include de new forks. Also added test cases for hoodi given Holesky will be getting phased out. Closes #4598
1 parent 1554492 commit bf6ccc0

9 files changed

Lines changed: 362 additions & 18 deletions

File tree

cmd/ethrex/networks/holesky/genesis.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,36 @@
1717
"shanghaiTime": 1696000704,
1818
"pragueTime": 1740434112,
1919
"cancunTime": 1707305664,
20+
"osakaTime": 1759308480,
21+
"bpo1Time": 1759800000,
22+
"bpo2Time": 1760389824,
23+
"blobSchedule": {
24+
"cancun": {
25+
"target": 3,
26+
"max": 6,
27+
"baseFeeUpdateFraction": 3338477
28+
},
29+
"prague": {
30+
"target": 6,
31+
"max": 9,
32+
"baseFeeUpdateFraction": 5007716
33+
},
34+
"osaka": {
35+
"target": 6,
36+
"max": 9,
37+
"baseFeeUpdateFraction": 5007716
38+
},
39+
"bpo1": {
40+
"target": 10,
41+
"max": 15,
42+
"baseFeeUpdateFraction": 8346193
43+
},
44+
"bpo2": {
45+
"target": 14,
46+
"max": 21,
47+
"baseFeeUpdateFraction": 11684671
48+
}
49+
},
2050
"depositContractAddress": "0x4242424242424242424242424242424242424242"
2151
},
2252
"alloc": {

cmd/ethrex/networks/hoodi/genesis.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
"terminalTotalDifficultyPassed": true,
1717
"shanghaiTime": 0,
1818
"cancunTime": 0,
19+
"pragueTime": 1742999832,
20+
"osakaTime": 1761677592,
21+
"bpo1Time": 1762365720,
22+
"bpo2Time": 1762955544,
1923
"blobSchedule": {
2024
"cancun": {
2125
"target": 3,
@@ -26,10 +30,24 @@
2630
"target": 6,
2731
"max": 9,
2832
"baseFeeUpdateFraction": 5007716
33+
},
34+
"osaka": {
35+
"target": 6,
36+
"max": 9,
37+
"baseFeeUpdateFraction": 5007716
38+
},
39+
"bpo1": {
40+
"target": 10,
41+
"max": 15,
42+
"baseFeeUpdateFraction": 8346193
43+
},
44+
"bpo2": {
45+
"target": 14,
46+
"max": 21,
47+
"baseFeeUpdateFraction": 11684671
2948
}
3049
},
31-
"depositContractAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
32-
"pragueTime": 1742999832
50+
"depositContractAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa"
3351
},
3452
"alloc": {
3553
"0x0000000000000000000000000000000000000000": {

cmd/ethrex/networks/mainnet/genesis.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"shanghaiTime": 1681338455,
2323
"cancunTime": 1710338135,
2424
"pragueTime": 1746612311,
25+
"osakaTime": 1764798551,
26+
"bpo1Time": 1765978199,
27+
"bpo2Time": 1767747671,
2528
"ethash": {},
2629
"depositContractAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa",
2730
"blobSchedule": {
@@ -34,6 +37,21 @@
3437
"target": 6,
3538
"max": 9,
3639
"baseFeeUpdateFraction": 5007716
40+
},
41+
"osaka": {
42+
"target": 6,
43+
"max": 9,
44+
"baseFeeUpdateFraction": 5007716
45+
},
46+
"bpo1": {
47+
"target": 10,
48+
"max": 15,
49+
"baseFeeUpdateFraction": 8346193
50+
},
51+
"bpo2": {
52+
"target": 14,
53+
"max": 21,
54+
"baseFeeUpdateFraction": 11684671
3755
}
3856
}
3957
},

cmd/ethrex/networks/sepolia/genesis.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,36 @@
1717
"shanghaiTime": 1677557088,
1818
"cancunTime": 1706655072,
1919
"pragueTime": 1741159776,
20+
"osakaTime": 1760427360,
21+
"bpo1Time": 1761017184,
22+
"bpo2Time": 1761607008,
23+
"blobSchedule": {
24+
"cancun": {
25+
"target": 3,
26+
"max": 6,
27+
"baseFeeUpdateFraction": 3338477
28+
},
29+
"prague": {
30+
"target": 6,
31+
"max": 9,
32+
"baseFeeUpdateFraction": 5007716
33+
},
34+
"osaka": {
35+
"target": 6,
36+
"max": 9,
37+
"baseFeeUpdateFraction": 5007716
38+
},
39+
"bpo1": {
40+
"target": 10,
41+
"max": 15,
42+
"baseFeeUpdateFraction": 8346193
43+
},
44+
"bpo2": {
45+
"target": 14,
46+
"max": 21,
47+
"baseFeeUpdateFraction": 11684671
48+
}
49+
},
2050
"depositContractAddress": "0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D"
2151
},
2252
"alloc": {

crates/common/types/fork_id.rs

Lines changed: 215 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,60 @@ mod tests {
316316
time: 1740434112,
317317
fork_id: ForkId {
318318
fork_hash: H32::from_str("0xdfbd9bed").unwrap(),
319+
fork_next: 1759308480,
320+
},
321+
is_valid: true,
322+
},
323+
TestCase {
324+
head: 123,
325+
time: 1759308479,
326+
fork_id: ForkId {
327+
fork_hash: H32::from_str("0xdfbd9bed").unwrap(),
328+
fork_next: 1759308480,
329+
},
330+
is_valid: true,
331+
},
332+
TestCase {
333+
head: 123,
334+
time: 1759308480,
335+
fork_id: ForkId {
336+
fork_hash: H32::from_str("0x783def52").unwrap(),
337+
fork_next: 1759800000,
338+
},
339+
is_valid: true,
340+
},
341+
TestCase {
342+
head: 123,
343+
time: 1759799999,
344+
fork_id: ForkId {
345+
fork_hash: H32::from_str("0x783def52").unwrap(),
346+
fork_next: 1759800000,
347+
},
348+
is_valid: true,
349+
},
350+
TestCase {
351+
head: 123,
352+
time: 1759800000,
353+
fork_id: ForkId {
354+
fork_hash: H32::from_str("0xa280a45c").unwrap(),
355+
fork_next: 1760389824,
356+
},
357+
is_valid: true,
358+
},
359+
TestCase {
360+
head: 123,
361+
time: 1760389823,
362+
fork_id: ForkId {
363+
fork_hash: H32::from_str("0xa280a45c").unwrap(),
364+
fork_next: 1760389824,
365+
},
366+
is_valid: true,
367+
},
368+
TestCase {
369+
head: 123,
370+
time: 1760389824,
371+
fork_id: ForkId {
372+
fork_hash: H32::from_str("0x9bc6cb31").unwrap(),
319373
fork_next: 0,
320374
},
321375
is_valid: true,
@@ -324,7 +378,111 @@ mod tests {
324378
head: 123,
325379
time: 2740434112,
326380
fork_id: ForkId {
327-
fork_hash: H32::from_str("0xdfbd9bed").unwrap(),
381+
fork_hash: H32::from_str("0x9bc6cb31").unwrap(),
382+
fork_next: 0,
383+
},
384+
is_valid: true,
385+
},
386+
];
387+
assert_test_cases(test_cases, genesis.config, genesis_header);
388+
}
389+
390+
#[test]
391+
fn hoodi_test_cases() {
392+
let genesis_file = std::fs::File::open("../../cmd/ethrex/networks/hoodi/genesis.json")
393+
.expect("Failed to open genesis file");
394+
let genesis_reader = BufReader::new(genesis_file);
395+
let genesis: Genesis =
396+
serde_json::from_reader(genesis_reader).expect("Failed to read genesis file");
397+
let genesis_header = genesis.get_block().header;
398+
// See https://github.com/ethereum/go-ethereum/blob/444a6d007a08bddcec0b68b60ab507ea8bc1d078/core/forkid/forkid_test.go#L100
399+
let test_cases: Vec<TestCase> = vec![
400+
TestCase {
401+
head: 123,
402+
time: 0,
403+
fork_id: ForkId {
404+
fork_hash: H32::from_str("0xbef71d30").unwrap(),
405+
fork_next: 1742999832,
406+
},
407+
is_valid: true,
408+
},
409+
TestCase {
410+
head: 123,
411+
time: 1742999831,
412+
fork_id: ForkId {
413+
fork_hash: H32::from_str("0xbef71d30").unwrap(),
414+
fork_next: 1742999832,
415+
},
416+
is_valid: true,
417+
},
418+
TestCase {
419+
head: 123,
420+
time: 1742999832,
421+
fork_id: ForkId {
422+
fork_hash: H32::from_str("0x0929e24e").unwrap(),
423+
fork_next: 1761677592,
424+
},
425+
is_valid: true,
426+
},
427+
TestCase {
428+
head: 123,
429+
time: 1761677591,
430+
fork_id: ForkId {
431+
fork_hash: H32::from_str("0x0929e24e").unwrap(),
432+
fork_next: 1761677592,
433+
},
434+
is_valid: true,
435+
},
436+
TestCase {
437+
head: 123,
438+
time: 1761677592,
439+
fork_id: ForkId {
440+
fork_hash: H32::from_str("0xe7e0e7ff").unwrap(),
441+
fork_next: 1762365720,
442+
},
443+
is_valid: true,
444+
},
445+
TestCase {
446+
head: 123,
447+
time: 1762365719,
448+
fork_id: ForkId {
449+
fork_hash: H32::from_str("0xe7e0e7ff").unwrap(),
450+
fork_next: 1762365720,
451+
},
452+
is_valid: true,
453+
},
454+
TestCase {
455+
head: 123,
456+
time: 1762365720,
457+
fork_id: ForkId {
458+
fork_hash: H32::from_str("0x3893353e").unwrap(),
459+
fork_next: 1762955544,
460+
},
461+
is_valid: true,
462+
},
463+
TestCase {
464+
head: 123,
465+
time: 1762955543,
466+
fork_id: ForkId {
467+
fork_hash: H32::from_str("0x3893353e").unwrap(),
468+
fork_next: 1762955544,
469+
},
470+
is_valid: true,
471+
},
472+
TestCase {
473+
head: 123,
474+
time: 1762955544,
475+
fork_id: ForkId {
476+
fork_hash: H32::from_str("0x23aa1351").unwrap(),
477+
fork_next: 0,
478+
},
479+
is_valid: true,
480+
},
481+
TestCase {
482+
head: 123,
483+
time: 2740434112,
484+
fork_id: ForkId {
485+
fork_hash: H32::from_str("0x23aa1351").unwrap(),
328486
fork_next: 0,
329487
},
330488
is_valid: true,
@@ -424,6 +582,60 @@ mod tests {
424582
time: 1741159776,
425583
fork_id: ForkId {
426584
fork_hash: H32::from_str("0xed88b5fd").unwrap(),
585+
fork_next: 1760427360,
586+
},
587+
is_valid: true,
588+
},
589+
TestCase {
590+
head: 1735372,
591+
time: 1760427359,
592+
fork_id: ForkId {
593+
fork_hash: H32::from_str("0xed88b5fd").unwrap(),
594+
fork_next: 1760427360,
595+
},
596+
is_valid: true,
597+
},
598+
TestCase {
599+
head: 1735372,
600+
time: 1760427360,
601+
fork_id: ForkId {
602+
fork_hash: H32::from_str("0xe2ae4999").unwrap(),
603+
fork_next: 1761017184,
604+
},
605+
is_valid: true,
606+
},
607+
TestCase {
608+
head: 1735372,
609+
time: 1761017183,
610+
fork_id: ForkId {
611+
fork_hash: H32::from_str("0xe2ae4999").unwrap(),
612+
fork_next: 1761017184,
613+
},
614+
is_valid: true,
615+
},
616+
TestCase {
617+
head: 1735372,
618+
time: 1761017184,
619+
fork_id: ForkId {
620+
fork_hash: H32::from_str("0x56078a1e").unwrap(),
621+
fork_next: 1761607008,
622+
},
623+
is_valid: true,
624+
},
625+
TestCase {
626+
head: 1735372,
627+
time: 1761607007,
628+
fork_id: ForkId {
629+
fork_hash: H32::from_str("0x56078a1e").unwrap(),
630+
fork_next: 1761607008,
631+
},
632+
is_valid: true,
633+
},
634+
TestCase {
635+
head: 1735372,
636+
time: 1761607008,
637+
fork_id: ForkId {
638+
fork_hash: H32::from_str("0x268956b6").unwrap(),
427639
fork_next: 0,
428640
},
429641
is_valid: true,
@@ -432,13 +644,13 @@ mod tests {
432644
head: 1735372,
433645
time: 2741159776,
434646
fork_id: ForkId {
435-
fork_hash: H32::from_str("0xed88b5fd").unwrap(),
647+
fork_hash: H32::from_str("0x268956b6").unwrap(),
436648
fork_next: 0,
437649
},
438650
is_valid: true,
439651
},
440652
];
441-
assert_test_cases(test_cases, genesis.config, genesis_hash);
653+
assert_test_cases(test_cases, genesis.config, genesis_hash.clone());
442654
}
443655

444656
#[test]

0 commit comments

Comments
 (0)