Skip to content

Commit e74e555

Browse files
[ETCM-354] Add ForkId calculation tests for Mordor
1 parent 68d68d3 commit e74e555

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/scala/io/iohk/ethereum/forkid/ForkIdSpec.scala

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ class ForkIdSpec extends AnyWordSpec with Matchers {
8181
create(11700000) shouldBe ForkId(0xdb63a1caL, None)
8282
}
8383

84+
"create correct ForkId for mordor blocks" in {
85+
val mordorConf = config.blockchains("mordor")
86+
val mordorGenesisHash = ByteString(Hex.decode("a68ebde7932eccb177d38d55dcc6461a019dd795a681e59b5a3e4f3a7259a3f1"))
87+
def create(head: BigInt) = ForkId.create(mordorGenesisHash, mordorConf)(head)
88+
89+
create(0) shouldBe ForkId(0x175782aaL, Some(301243)) // Unsynced
90+
create(301242) shouldBe ForkId(0x175782aaL, Some(301243))
91+
create(301243) shouldBe ForkId(0x604f6ee1L, Some(999983))
92+
create(999982) shouldBe ForkId(0x604f6ee1L, Some(999983))
93+
create(999983) shouldBe ForkId(0xf42f5539L, Some(2520000))
94+
create(2519999) shouldBe ForkId(0xf42f5539L, Some(2520000))
95+
create(2520000) shouldBe ForkId(0x66b5c286L, None)
96+
// TODO: Add Magneto
97+
// create(2520000) shouldBe ForkId(0x66b5c286L, Some(3985893))
98+
// create(3985893) shouldBe ForkId(0x66b5c286L, Some(3985893))
99+
// create(3985894) shouldBe ForkId(0x92b323e0L, None)
100+
}
101+
84102
// Here’s a couple of tests to verify the proper RLP encoding (since FORK_HASH is a 4 byte binary but FORK_NEXT is an 8 byte quantity):
85103
"be correctly encoded via rlp" in {
86104
roundTrip(ForkId(0, None), "c6840000000080")

0 commit comments

Comments
 (0)