Skip to content

Commit

Permalink
chore: Reorder variants of KnownHyperlaneDomain (#4083)
Browse files Browse the repository at this point in the history
## Description

Fix #3961
  • Loading branch information
c410-f3r authored Jul 5, 2024
1 parent 2f7f714 commit 4ec872c
Showing 1 changed file with 69 additions and 83 deletions.
152 changes: 69 additions & 83 deletions rust/hyperlane-core/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,90 +50,57 @@ impl<'a> std::fmt::Display for ContractLocator<'a> {
strum(serialize_all = "lowercase", ascii_case_insensitive)
)]
pub enum KnownHyperlaneDomain {
Ethereum = 1,
Sepolia = 11155111,
Holesky = 17000,

Polygon = 137,

Avalanche = 43114,
Fuji = 43113,

Ancient8 = 888888888,
Arbitrum = 42161,

Optimism = 10,

Avalanche = 43114,
#[cfg_attr(feature = "strum", strum(serialize = "bsc"))]
BinanceSmartChain = 56,
#[cfg_attr(feature = "strum", strum(serialize = "bsctestnet"))]
BinanceSmartChainTestnet = 97,

Blast = 81457,
Bob = 60808,
Celo = 42220,
Alfajores = 44787,

Moonbeam = 1284,
MoonbaseAlpha = 1287,

Ethereum = 1,
Fraxtal = 252,
Fuji = 43113,
Gnosis = 100,
Chiado = 10200,

InEvm = 2525,
Injective = 6909546,
Linea = 59144,
MantaPacific = 169,

Mantle = 5000,
Mode = 34443,
Moonbeam = 1284,
Neutron = 1853125230,

Optimism = 10,
Osmosis = 875,

Injective = 6909546,
InEvm = 2525,

Ancient8 = 888888888,

Blast = 81457,

Mode = 34443,

Polygon = 137,
Redstone = 690,

Viction = 88,

Zetachain = 7000,

PlumeTestnet = 161221135,

Fraxtal = 252,

Linea = 59144,

Sei = 1329,

Bob = 60808,

Mantle = 5000,

Taiko = 167000,
Viction = 88,
Zetachain = 7000,

// -- Local test chains --
/// Test1 local chain
// -- Local chains --
//
Test1 = 13371,
/// Test2 local chain
Test2 = 13372,
/// Test3 local chain
Test3 = 13373,

/// Fuel1 local chain
FuelTest1 = 13374,

/// Sealevel local chain 1
SealevelTest1 = 13375,
/// Sealevel local chain 1
SealevelTest2 = 13376,

// -- v3 testnets --
ScrollSepolia = 534351,

/// Cosmos local chains
CosmosTest99990 = 99990,
CosmosTest99991 = 99991,

// -- Test chains --
//
Alfajores = 44787,
#[cfg_attr(feature = "strum", strum(serialize = "bsctestnet"))]
BinanceSmartChainTestnet = 97,
Chiado = 10200,
Holesky = 17000,
MoonbaseAlpha = 1287,
PlumeTestnet = 161221135,
ScrollSepolia = 534351,
Sepolia = 11155111,
}

#[derive(Clone, Serialize)]
Expand Down Expand Up @@ -242,15 +209,18 @@ impl KnownHyperlaneDomain {

many_to_one!(match self {
Mainnet: [
Ethereum, Avalanche, Arbitrum, Polygon, Optimism, BinanceSmartChain, Celo,
Moonbeam, Gnosis, MantaPacific, Neutron, Injective, InEvm, Ancient8, Blast,
Mode, Redstone, Viction, Zetachain, Fraxtal, Linea, Sei, Osmosis,
Bob, Mantle, Taiko
Ancient8, Arbitrum, Avalanche, BinanceSmartChain, Blast, Bob, Celo, Ethereum,
Fraxtal, Gnosis, InEvm, Injective, Linea, MantaPacific, Mantle, Mode, Moonbeam,
Neutron, Optimism, Osmosis, Polygon, Redstone, Sei, Taiko, Viction, Zetachain,
],
Testnet: [
Alfajores, MoonbaseAlpha, Sepolia, ScrollSepolia, Chiado, PlumeTestnet, Fuji, BinanceSmartChainTestnet, Holesky
Alfajores, BinanceSmartChainTestnet, Chiado, Fuji, Holesky, MoonbaseAlpha,
PlumeTestnet, ScrollSepolia, Sepolia,
],
LocalTestChain: [
Test1, Test2, Test3, FuelTest1, SealevelTest1, SealevelTest2, CosmosTest99990,
CosmosTest99991
],
LocalTestChain: [Test1, Test2, Test3, FuelTest1, SealevelTest1, SealevelTest2, CosmosTest99990, CosmosTest99991],
})
}

Expand All @@ -259,16 +229,26 @@ impl KnownHyperlaneDomain {

many_to_one!(match self {
HyperlaneDomainProtocol::Ethereum: [
Ethereum, Sepolia, Holesky, Polygon, Avalanche, Fuji, Arbitrum,
Optimism, BinanceSmartChain, BinanceSmartChainTestnet, Celo, Gnosis,
Alfajores, Moonbeam, InEvm, Ancient8, Blast, Mode, Redstone, Viction,
Zetachain, MoonbaseAlpha, ScrollSepolia, Chiado, MantaPacific, PlumeTestnet,
Fraxtal, Linea, Sei, Bob, Mantle, Taiko,
Test1, Test2, Test3
Ancient8, Arbitrum, Avalanche, BinanceSmartChain, Blast, Bob, Celo, Ethereum,
Fraxtal, Fuji, Gnosis, InEvm, Linea, MantaPacific, Mantle, Mode, Moonbeam, Optimism,
Polygon, Redstone, Sei, Taiko, Viction, Zetachain,

// Local chains
Test1, Test2, Test3,

// Test chains
Alfajores, BinanceSmartChainTestnet, Chiado, Holesky, MoonbaseAlpha, PlumeTestnet,
ScrollSepolia, Sepolia

],
HyperlaneDomainProtocol::Fuel: [FuelTest1],
HyperlaneDomainProtocol::Sealevel: [SealevelTest1, SealevelTest2],
HyperlaneDomainProtocol::Cosmos: [CosmosTest99990, CosmosTest99991, Neutron, Osmosis, Injective],
HyperlaneDomainProtocol::Cosmos: [
Injective, Neutron, Osmosis,

// Local chains
CosmosTest99990, CosmosTest99991,
],
})
}

Expand All @@ -278,12 +258,18 @@ impl KnownHyperlaneDomain {
many_to_one!(match self {
HyperlaneDomainTechnicalStack::ArbitrumNitro: [Arbitrum, PlumeTestnet],
HyperlaneDomainTechnicalStack::Other: [
Ethereum, Sepolia, Holesky, Polygon, Avalanche, Fuji, Optimism,
BinanceSmartChain, BinanceSmartChainTestnet, Celo, Gnosis, Alfajores, Moonbeam, MoonbaseAlpha,
ScrollSepolia, Chiado, MantaPacific, Neutron, Injective, InEvm, Ancient8, Blast, Mode, Redstone,
Viction, Zetachain, Fraxtal, Linea, Sei, Osmosis, Bob, Mantle, Taiko,
Test1, Test2, Test3, FuelTest1, SealevelTest1, SealevelTest2, CosmosTest99990, CosmosTest99991
],
Ancient8, Avalanche, BinanceSmartChain, Blast, Bob, Celo, Ethereum, Fraxtal, Fuji,
Gnosis, InEvm, Injective, Linea, MantaPacific, Mantle, Mode, Moonbeam, Neutron,
Optimism, Osmosis, Polygon, Redstone, Sei, Taiko, Viction, Zetachain,

// Local chains
CosmosTest99990, CosmosTest99991, FuelTest1, SealevelTest1, SealevelTest2, Test1,
Test2, Test3,

// Test chains
Alfajores, BinanceSmartChainTestnet, Chiado, Holesky, MoonbaseAlpha, ScrollSepolia,
Sepolia
],
})
}
}
Expand Down

0 comments on commit 4ec872c

Please sign in to comment.