test: add missing fork_id tests for the Görli and Sepolia nets (#987)

Co-authored-by: lambdaclass-user <github@lambdaclass.com>
This commit is contained in:
Estéfano Bargas
2023-01-23 13:32:29 -03:00
committed by GitHub
parent c5440cc775
commit b354a17f65

View File

@ -423,7 +423,7 @@ impl ParisStatus {
#[cfg(test)]
mod tests {
use crate::{Chain, ChainSpec, ForkHash, Genesis, Hardfork, Header, MAINNET};
use crate::{Chain, ChainSpec, ForkHash, Genesis, Hardfork, Header, GOERLI, MAINNET, SEPOLIA};
#[test]
fn test_empty_forkid() {
@ -483,8 +483,8 @@ mod tests {
assert_eq!(unique_spec.fork_id(2), duplicate_spec.fork_id(2));
}
// these tests check that the forkid computation is accurate
#[test]
// this test checks that the forkid computation is accurate
fn test_mainnet_forkids() {
let frontier_forkid = MAINNET.fork_id(0);
assert_eq!([0xfc, 0x64, 0xec, 0x04], frontier_forkid.hash.0);
@ -541,4 +541,30 @@ mod tests {
let latest_forkid = MAINNET.fork_id(15050000);
assert_eq!(0, latest_forkid.next);
}
#[test]
fn test_goerli_forkids() {
let frontier_forkid = GOERLI.fork_id(0);
assert_eq!([0xa3, 0xf5, 0xab, 0x08], frontier_forkid.hash.0);
assert_eq!(1561651, frontier_forkid.next);
let istanbul_forkid = GOERLI.fork_id(1561651);
assert_eq!([0xc2, 0x5e, 0xfa, 0x5c], istanbul_forkid.hash.0);
assert_eq!(4460644, istanbul_forkid.next);
let berlin_forkid = GOERLI.fork_id(4460644);
assert_eq!([0x75, 0x7a, 0x1c, 0x47], berlin_forkid.hash.0);
assert_eq!(5062605, berlin_forkid.next);
let london_forkid = GOERLI.fork_id(12965000);
assert_eq!([0xb8, 0xc6, 0x29, 0x9d], london_forkid.hash.0);
assert_eq!(0, london_forkid.next);
}
#[test]
fn test_sepolia_forkids() {
let mergenetsplit_forkid = SEPOLIA.fork_id(1735371);
assert_eq!([0xb9, 0x6c, 0xbd, 0x13], mergenetsplit_forkid.hash.0);
assert_eq!(0, mergenetsplit_forkid.next);
}
}