Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Mantle to testnet #3438

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions devnet/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ spec:
- ws://eth-devnet:8545
- --scrollRPC
- ws://eth-devnet:8545
- --mantleRPC
- ws://eth-devnet:8545
# - --wormchainURL
# - wormchain:9090
# - --accountantKeyPath
Expand Down
16 changes: 16 additions & 0 deletions ethereum/.env.mantle.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Mantle testnet env
# Rename to .env to use with truffle migrations

# Wormhole Core Migrations
INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
INIT_CHAIN_ID=35
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_EVM_CHAIN_ID=5001

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=35
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
BRIDGE_INIT_WETH=0xEa12Be2389c2254bAaD383c6eD1fa1e15202b52A
BRIDGE_INIT_FINALITY=1
9 changes: 9 additions & 0 deletions ethereum/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ module.exports = {
},
network_id: 534351,
},
mantle_testnet: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://rpc.testnet.mantle.xyz"
);
},
network_id: 5001,
},
rootstock: {
provider: () => {
return new HDWalletProvider(
Expand Down
1 change: 1 addition & 0 deletions node/cmd/guardiand/adminnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"Base", vaa.ChainIDBase},
{"Sei", vaa.ChainIDSei},
{"Scroll", vaa.ChainIDScroll},
{"Mantle", vaa.ChainIDMantle},
{"Wormchain", vaa.ChainIDWormchain},
{"Sepolia", vaa.ChainIDSepolia},
}
Expand Down
29 changes: 29 additions & 0 deletions node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ var (
scrollRPC *string
scrollContract *string

mantleRPC *string
mantleContract *string

sepoliaRPC *string
sepoliaContract *string

Expand Down Expand Up @@ -343,6 +346,9 @@ func init() {
scrollRPC = NodeCmd.Flags().String("scrollRPC", "", "Scroll RPC URL")
scrollContract = NodeCmd.Flags().String("scrollContract", "", "Scroll contract address")

mantleRPC = NodeCmd.Flags().String("mantleRPC", "", "Mantle RPC URL")
mantleContract = NodeCmd.Flags().String("mantleContract", "", "Mantle contract address")

baseRPC = NodeCmd.Flags().String("baseRPC", "", "Base RPC URL")
baseContract = NodeCmd.Flags().String("baseContract", "", "Base contract address")

Expand Down Expand Up @@ -498,6 +504,7 @@ func runNode(cmd *cobra.Command, args []string) {
*baseContract = unsafeDevModeEvmContractAddress(*baseContract)
*sepoliaContract = unsafeDevModeEvmContractAddress(*sepoliaContract)
*scrollContract = unsafeDevModeEvmContractAddress(*scrollContract)
*mantleContract = unsafeDevModeEvmContractAddress(*mantleContract)
}

// Verify flags
Expand Down Expand Up @@ -640,6 +647,16 @@ func runNode(cmd *cobra.Command, args []string) {
logger.Fatal("Both --scrollContract and --scrollRPC must be set together or both unset")
}

// Mantle should not be allowed in mainnet until its finality policy is understood and implemented in the watcher.
// Note that as of 11/9/2023 Mantle does not support querying for `finalized` or `safe`, just `latest`, so we will need to implement a finalizer.
if *mantleRPC != "" && !*testnetMode && !*unsafeDevMode {
logger.Fatal("mantle is currently only supported in devnet and testnet")
}

if (*mantleRPC == "") != (*mantleContract == "") {
logger.Fatal("Both --mantleContract and --mantleRPC must be set together or both unset")
}

if *gatewayWS != "" {
if *gatewayLCD == "" || *gatewayContract == "" {
logger.Fatal("If --gatewayWS is specified, then --gatewayLCD and --gatewayContract must be specified")
Expand Down Expand Up @@ -865,6 +882,7 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["ibcWS"] = *ibcWS
rpcMap["karuraRPC"] = *karuraRPC
rpcMap["klaytnRPC"] = *klaytnRPC
rpcMap["mantleRPC"] = *mantleRPC
rpcMap["moonbeamRPC"] = *moonbeamRPC
rpcMap["nearRPC"] = *nearRPC
rpcMap["neonRPC"] = *neonRPC
Expand Down Expand Up @@ -1253,6 +1271,17 @@ func runNode(cmd *cobra.Command, args []string) {
watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(mantleRPC) {
wc := &evm.WatcherConfig{
NetworkID: "mantle",
ChainID: vaa.ChainIDMantle,
Rpc: *mantleRPC,
Contract: *mantleContract,
}

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(terraWS) {
wc := &cosmwasm.WatcherConfig{
NetworkID: "terra",
Expand Down
208 changes: 106 additions & 102 deletions node/pkg/proto/publicrpc/v1/publicrpc.pb.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions node/pkg/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func handleQueryRequestsImpl(
vaa.ChainIDOptimism: {},
vaa.ChainIDBase: {},
vaa.ChainIDScroll: {},
vaa.ChainIDMantle: {},
vaa.ChainIDSepolia: {},
}

Expand Down
1 change: 1 addition & 0 deletions proto/publicrpc/v1/publicrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum ChainID {
CHAIN_ID_SEI = 32;
// CHAIN_ID_ROOTSTOCK = 33;
CHAIN_ID_SCROLL = 34;
CHAIN_ID_MANTLE = 35;
CHAIN_ID_WORMCHAIN = 3104;
CHAIN_ID_COSMOSHUB = 4000;
CHAIN_ID_EVMOS = 4001;
Expand Down
18 changes: 18 additions & 0 deletions sdk/js/src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const CHAINS = {
sei: 32,
rootstock: 33,
scroll: 34,
mantle: 35,
wormchain: 3104,
cosmoshub: 4000,
evmos: 4001,
Expand Down Expand Up @@ -68,6 +69,7 @@ export const EVMChainNames = [
"base",
"rootstock",
"scroll",
"mantle",
"sepolia",
] as const;
export type EVMChainName = typeof EVMChainNames[number];
Expand Down Expand Up @@ -283,6 +285,11 @@ const MAINNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
mantle: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
token_bridge:
Expand Down Expand Up @@ -494,6 +501,11 @@ const TESTNET = {
token_bridge: "0x22427d90B7dA3fA4642F7025A854c7254E4e45BF",
nft_bridge: "0x47B9a1406BEe29a3001BFEB7e45aE45fFFB40c18",
},
mantle: {
core: "0x6b9C8671cdDC8dEab9c719bB87cBd3e782bA6a35",
token_bridge: "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
nft_bridge: "0x23908A62110e21C04F3A4e011d24F901F911744A",
},
wormchain: {
core: "wormhole16jzpxp0e8550c9aht6q9svcux30vtyyyyxv5w2l2djjra46580wsazcjwp",
token_bridge:
Expand Down Expand Up @@ -702,6 +714,11 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
mantle: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgshdnj3k",
token_bridge:
Expand Down Expand Up @@ -811,6 +828,7 @@ export const CHAIN_ID_BASE = CHAINS["base"];
export const CHAIN_ID_SEI = CHAINS["sei"];
export const CHAIN_ID_ROOTSTOCK = CHAINS["rootstock"];
export const CHAIN_ID_SCROLL = CHAINS["scroll"];
export const CHAIN_ID_MANTLE = CHAINS["mantle"];
export const CHAIN_ID_WORMCHAIN = CHAINS["wormchain"];
export const CHAIN_ID_GATEWAY = CHAIN_ID_WORMCHAIN;
export const CHAIN_ID_COSMOSHUB = CHAINS["cosmoshub"];
Expand Down
5 changes: 5 additions & 0 deletions sdk/rust/core/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub enum Chain {
Sei,
Rootstock,
Scroll,
Mantle,
Wormchain,
Sepolia,

Expand Down Expand Up @@ -87,6 +88,7 @@ impl From<u16> for Chain {
32 => Chain::Sei,
33 => Chain::Rootstock,
34 => Chain::Scroll,
35 => Chain::Mantle,
3104 => Chain::Wormchain,
10002 => Chain::Sepolia,
c => Chain::Unknown(c),
Expand Down Expand Up @@ -130,6 +132,7 @@ impl From<Chain> for u16 {
Chain::Sei => 32,
Chain::Rootstock => 33,
Chain::Scroll => 34,
Chain::Mantle => 35,
Chain::Wormchain => 3104,
Chain::Sepolia => 10002,
Chain::Unknown(c) => c,
Expand Down Expand Up @@ -173,6 +176,7 @@ impl fmt::Display for Chain {
Self::Sei => f.write_str("Sei"),
Self::Rootstock => f.write_str("Rootstock"),
Self::Scroll => f.write_str("Scroll"),
Self::Mantle => f.write_str("Mantle"),
Self::Sepolia => f.write_str("Sepolia"),
Self::Wormchain => f.write_str("Wormchain"),
Self::Unknown(v) => write!(f, "Unknown({v})"),
Expand Down Expand Up @@ -222,6 +226,7 @@ impl FromStr for Chain {
"Sei" | "sei" | "SEI" => Ok(Chain::Sei),
"Rootstock" | "rootstock" | "ROOTSTOCK" => Ok(Chain::Rootstock),
"Scroll" | "scroll" | "SCROLL" => Ok(Chain::Scroll),
"Mantle" | "mantle" | "MANTLE" => Ok(Chain::Mantle),
"Sepolia" | "sepolia" | "SEPOLIA" => Ok(Chain::Sepolia),
"Wormchain" | "wormchain" | "WORMCHAIN" => Ok(Chain::Wormchain),
_ => {
Expand Down
2 changes: 2 additions & 0 deletions sdk/testnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var knownTestnetTokenbridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDKlaytn: "000000000000000000000000c7a13be098720840dea132d860fdfa030884b09a",
vaa.ChainIDCelo: "00000000000000000000000005ca6037ec51f8b712ed2e6fa72219feae74e153",
vaa.ChainIDNear: "c2c0b6ecbbe9ecf91b2b7999f0264018ba68126c2e83bf413f59f712f3a1df55",
vaa.ChainIDMantle: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
vaa.ChainIDMoonbeam: "000000000000000000000000bc976d4b9d57e57c3ca52e1fd136c45ff7955a96",
vaa.ChainIDArbitrum: "00000000000000000000000023908A62110e21C04F3A4e011d24F901F911744A",
vaa.ChainIDOptimism: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
Expand Down Expand Up @@ -54,6 +55,7 @@ var knownTestnetNFTBridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDAcala: "00000000000000000000000096f1335e0acab3cfd9899b30b2374e25a2148a6e",
vaa.ChainIDKlaytn: "00000000000000000000000094c994fc51c13101062958b567e743f1a04432de",
vaa.ChainIDCelo: "000000000000000000000000acd8190f647a31e56a656748bc30f69259f245db",
vaa.ChainIDMantle: "00000000000000000000000023908A62110e21C04F3A4e011d24F901F911744A",
vaa.ChainIDMoonbeam: "00000000000000000000000098a0f4b96972b32fcb3bd03caeb66a44a6ab9edb",
vaa.ChainIDArbitrum: "000000000000000000000000Ee3dB83916Ccdc3593b734F7F2d16D630F39F1D0",
vaa.ChainIDOptimism: "00000000000000000000000023908A62110e21C04F3A4e011d24F901F911744A",
Expand Down
7 changes: 7 additions & 0 deletions sdk/vaa/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ func (c ChainID) String() string {
return "sei"
case ChainIDScroll:
return "scroll"
case ChainIDMantle:
return "mantle"
case ChainIDCosmoshub:
return "cosmoshub"
case ChainIDEvmos:
Expand Down Expand Up @@ -299,6 +301,8 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDSei, nil
case "scroll":
return ChainIDScroll, nil
case "mantle":
return ChainIDMantle, nil
case "cosmoshub":
return ChainIDCosmoshub, nil
case "evmos":
Expand Down Expand Up @@ -348,6 +352,7 @@ func GetAllNetworkIDs() []ChainID {
ChainIDBase,
ChainIDSei,
ChainIDScroll,
ChainIDMantle,
ChainIDWormchain,
ChainIDCosmoshub,
ChainIDEvmos,
Expand Down Expand Up @@ -420,6 +425,8 @@ const (
ChainIDSei ChainID = 32
// ChainIDScroll is the ChainID of Scroll
ChainIDScroll ChainID = 34
// ChainIDMantle is the ChainID of Mantle
ChainIDMantle ChainID = 35
//ChainIDWormchain is the ChainID of Wormchain
ChainIDWormchain ChainID = 3104
// ChainIDCosmoshub is the ChainID of Cosmoshub
Expand Down
Loading