-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(protocol): add tests for LibNetwork (#18626)
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.24; | ||
|
||
import "src/shared/libs/LibTrieProof.sol"; | ||
import "../CommonTest.sol"; | ||
|
||
contract LibNetworkTest is CommonTest { | ||
function test_isEthereumTestnet() public pure { | ||
assertTrue(LibNetwork.isEthereumTestnet(LibNetwork.ETHEREUM_ROPSTEN)); | ||
assertTrue(LibNetwork.isEthereumTestnet(LibNetwork.ETHEREUM_RINKEBY)); | ||
assertTrue(LibNetwork.isEthereumTestnet(LibNetwork.ETHEREUM_GOERLI)); | ||
assertTrue(LibNetwork.isEthereumTestnet(LibNetwork.ETHEREUM_KOVAN)); | ||
assertTrue(LibNetwork.isEthereumTestnet(LibNetwork.ETHEREUM_HOLESKY)); | ||
assertTrue(LibNetwork.isEthereumTestnet(LibNetwork.ETHEREUM_SEPOLIA)); | ||
assertFalse(LibNetwork.isEthereumTestnet(LibNetwork.ETHEREUM_MAINNET)); | ||
assertFalse(LibNetwork.isEthereumTestnet(LibNetwork.TAIKO_MAINNET)); | ||
} | ||
|
||
function test_isEthereumMainnetOrTestnet() public pure { | ||
assertTrue(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.ETHEREUM_MAINNET)); | ||
assertTrue(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.ETHEREUM_ROPSTEN)); | ||
assertTrue(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.ETHEREUM_RINKEBY)); | ||
assertTrue(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.ETHEREUM_GOERLI)); | ||
assertTrue(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.ETHEREUM_KOVAN)); | ||
assertTrue(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.ETHEREUM_HOLESKY)); | ||
assertTrue(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.ETHEREUM_SEPOLIA)); | ||
assertFalse(LibNetwork.isEthereumMainnetOrTestnet(LibNetwork.TAIKO_MAINNET)); | ||
} | ||
|
||
function test_isTaikoMainnet() public pure { | ||
assertTrue(LibNetwork.isTaikoMainnet(LibNetwork.TAIKO_MAINNET)); | ||
assertFalse(LibNetwork.isTaikoMainnet(LibNetwork.ETHEREUM_MAINNET)); | ||
assertFalse(LibNetwork.isTaikoMainnet(LibNetwork.TAIKO_HEKLA)); | ||
} | ||
|
||
function test_isTaikoDevnet() public pure { | ||
assertTrue(LibNetwork.isTaikoDevnet(32_300)); | ||
assertTrue(LibNetwork.isTaikoDevnet(32_350)); | ||
assertTrue(LibNetwork.isTaikoDevnet(32_400)); | ||
assertFalse(LibNetwork.isTaikoDevnet(32_299)); | ||
assertFalse(LibNetwork.isTaikoDevnet(32_401)); | ||
assertFalse(LibNetwork.isTaikoDevnet(LibNetwork.TAIKO_MAINNET)); | ||
} | ||
|
||
function test_isDencunSupported() public pure { | ||
assertTrue(LibNetwork.isDencunSupported(LibNetwork.ETHEREUM_MAINNET)); | ||
assertTrue(LibNetwork.isDencunSupported(LibNetwork.ETHEREUM_HOLESKY)); | ||
assertTrue(LibNetwork.isDencunSupported(LibNetwork.ETHEREUM_SEPOLIA)); | ||
assertTrue(LibNetwork.isDencunSupported(32_350)); // Taiko Devnet within range | ||
assertFalse(LibNetwork.isDencunSupported(LibNetwork.ETHEREUM_ROPSTEN)); | ||
assertFalse(LibNetwork.isDencunSupported(LibNetwork.TAIKO_MAINNET)); | ||
} | ||
} |