Skip to content

Commit

Permalink
Deploy Snaxchain to testnet (wormhole-foundation#4035)
Browse files Browse the repository at this point in the history
* Deploy Snaxchain to testnet

* Code review rework
  • Loading branch information
bruce-riley authored Jul 25, 2024
1 parent 5995fd6 commit f3e6a93
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cspell-custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ seievm
Sepolia
serde
setcap
snaxchain
SnaxChain
solana
Solana
Solana's
Expand Down
1 change: 1 addition & 0 deletions deployments/testnet/tokenBridgeVAAs.csv
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Blast (36) Testnet Token Bridge,0100000000010052b4615add1ca354feb81a7f90b70a0d78
XLayer (37) Testnet Token Bridge,01000000000100c983babda02e84e346e49f823aa201d65c82e19c51cdfb555cc9aa2fa6809f4500f6344d86722b1a8023906d185c96bc9b4e332402ae2e05ec69d0d95c39ea81000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000005b1293100000000000000000000000000000000000000000000546f6b656e4272696467650100000025000000000000000000000000da91a06299bbf302091b053c6b9ef86eff0f930d
Linea (38) Testnet Token Bridge,01000000000100411f65a20405ad0d85d6718a91bc16cf645a7eb7dbd29d4b2d0b9cc2d872dc01112cf96dc40c07ddf648325a5dcdba42c70612179126178e7fb9e9bcfef1cb4a01000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000183785600000000000000000000000000000000000000000000546f6b656e4272696467650100000026000000000000000000000000c7a204bdbfe983fcd8d8e61d02b475d4073ff97e
Berachain (39) Testnet Token Bridge,01000000000100c19d35faa10139fef5b3244f120efb67ad22d2d9ece7d777bcb6e957506ba9f15e2e6fd91a18dcdd6bf434d96d624fd725f957437f2e86dfdcbb6d0e97f3eeb100000000010000000100010000000000000000000000000000000000000000000000000000000000000004000000000404250300000000000000000000000000000000000000000000546f6b656e4272696467650100000027000000000000000000000000a10f2ef61de1f19f586ab8b6f2eba89bace63f7a
Snaxchain (43) Testnet Token Bridge,010000000001008ed60dec76f13f6da695fc5f134c8cf3527f264712e7bb98d2e54a5f457759e0491e3f1cb42eed9b84edc60a96836df98a3752c8a4e10977801e6c35a39f211b000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000005ba971e00000000000000000000000000000000000000000000546f6b656e427269646765010000002b000000000000000000000000a10f2ef61de1f19f586ab8b6f2eba89bace63f7a
Gateway (3104) Testnet Token Bridge,01000000000100117d1c7a124a9e2e29d82b3803b825be7c8a1dc7f19013669f7d11d42d448aa72339fe3657e4bd156c5c28dd10e78aab3e06e9e76c4bbd38c81e057533d577c40000000000d09296c5000100000000000000000000000000000000000000000000000000000000000000049ea4b9942b23298c20000000000000000000000000000000000000000000546f6b656e4272696467650100000c20ef5251ea1e99ae48732800ccc7b83b57881232a73eb796b63b1d86ed2ea44e27
Sepolia (10002) (Ethereum) Testnet Token Bridge,01000000000100a03841125d40e9df3cd80d027bc660191755587980e49f6a46e9baa1b5c3f6b46e51256c225bd242139ae11d3c84439acdc204a5f39a2e1acb750ae98bb759f1000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000005491ea100000000000000000000000000000000000000000000546f6b656e4272696467650100002712000000000000000000000000db5492265f6038831e89f495670ff909ade94bd9
Arbitrum Sepolia (10003) Testnet Token Bridge,010000000001001b0fbbcc7a3e8c491dc25f0a611075513032fe444d8e6585153e6ae2cf8c7514152b050e95a3e0af11e5b2705b2efb717bec3cfaa3b1617ff623c14e61a69224000000000100000001000100000000000000000000000000000000000000000000000000000000000000040000000001b8de3c00000000000000000000000000000000000000000000546f6b656e4272696467650100002713000000000000000000000000c7a204bdbfe983fcd8d8e61d02b475d4073ff97e
Expand Down
21 changes: 21 additions & 0 deletions ethereum/env/.env.snaxchain.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SnaxChain testnet env
# Rename to .env

# Common config for forge deployment
RPC_URL="https://rpc-snaxchain-s50q0kjngn.t.conduit.xyz/"
FORGE_ARGS="--legacy"

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

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=43
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
BRIDGE_INIT_FINALITY=1
# TODO: This exists. Is this what we should use?
BRIDGE_INIT_WETH=0x4200000000000000000000000000000000000006
1 change: 1 addition & 0 deletions node/cmd/guardiand/adminnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"XLayer", vaa.ChainIDXLayer},
{"Linea", vaa.ChainIDLinea},
{"Berachain", vaa.ChainIDBerachain},
{"Snaxchain", vaa.ChainIDSnaxchain},
{"Wormchain", vaa.ChainIDWormchain},
{"Sepolia", vaa.ChainIDSepolia},
{"Holesky", vaa.ChainIDHolesky},
Expand Down
20 changes: 20 additions & 0 deletions node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ var (
berachainRPC *string
berachainContract *string

snaxchainRPC *string
snaxchainContract *string

sepoliaRPC *string
sepoliaContract *string

Expand Down Expand Up @@ -389,6 +392,9 @@ func init() {
berachainRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "berachainRPC", "Berachain RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
berachainContract = NodeCmd.Flags().String("berachainContract", "", "Berachain contract address")

snaxchainRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "snaxchainRPC", "Snaxchain RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
snaxchainContract = NodeCmd.Flags().String("snaxchainContract", "", "Snaxchain contract address")

baseRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "baseRPC", "Base RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
baseContract = NodeCmd.Flags().String("baseContract", "", "Base contract address")

Expand Down Expand Up @@ -646,6 +652,7 @@ func runNode(cmd *cobra.Command, args []string) {
*blastContract = checkEvmArgs(logger, *blastRPC, *blastContract, "blast", true)
*xlayerContract = checkEvmArgs(logger, *xlayerRPC, *xlayerContract, "xlayer", true)
*berachainContract = checkEvmArgs(logger, *berachainRPC, *berachainContract, "berachain", false)
*snaxchainContract = checkEvmArgs(logger, *snaxchainRPC, *snaxchainContract, "snaxchain", false)

// These chains will only ever be testnet / devnet.
*sepoliaContract = checkEvmArgs(logger, *sepoliaRPC, *sepoliaContract, "sepolia", false)
Expand Down Expand Up @@ -850,6 +857,7 @@ func runNode(cmd *cobra.Command, args []string) {
}
rpcMap["scrollRPC"] = *scrollRPC
rpcMap["solanaRPC"] = *solanaRPC
rpcMap["snaxchainRPC"] = *snaxchainRPC
rpcMap["suiRPC"] = *suiRPC
rpcMap["terraWS"] = *terraWS
rpcMap["terraLCD"] = *terraLCD
Expand Down Expand Up @@ -1317,6 +1325,18 @@ func runNode(cmd *cobra.Command, args []string) {
watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(snaxchainRPC) {
wc := &evm.WatcherConfig{
NetworkID: "snaxchain",
ChainID: vaa.ChainIDSnaxchain,
Rpc: *snaxchainRPC,
Contract: *snaxchainContract,
CcqBackfillCache: *ccqBackfillCache,
}

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(terraWS) {
wc := &cosmwasm.WatcherConfig{
NetworkID: "terra",
Expand Down
1 change: 1 addition & 0 deletions node/pkg/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ var perChainConfig = map[vaa.ChainID]PerChainConfig{
vaa.ChainIDXLayer: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDLinea: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDBerachain: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDSnaxchain: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDSepolia: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDHolesky: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDArbitrumSepolia: {NumWorkers: 1, TimestampCacheSupported: true},
Expand Down
1 change: 1 addition & 0 deletions node/pkg/watchers/evm/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ func (w *Watcher) getFinality(ctx context.Context) (bool, bool, error) {
w.chainID == vaa.ChainIDOptimism ||
w.chainID == vaa.ChainIDOptimismSepolia ||
w.chainID == vaa.ChainIDSepolia ||
w.chainID == vaa.ChainIDSnaxchain ||
w.chainID == vaa.ChainIDXLayer {
finalized = true
safe = true
Expand Down
4 changes: 4 additions & 0 deletions sdk/js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.10.18

Add Snaxchain testnet support

## 0.10.17

Add Mantle mainnet support
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@certusone/wormhole-sdk",
"version": "0.10.17",
"version": "0.10.18",
"description": "SDK for interacting with Wormhole",
"homepage": "https://wormhole.com",
"main": "./lib/cjs/index.js",
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 @@ -38,6 +38,7 @@ export const CHAINS = {
linea: 38,
berachain: 39,
seievm: 40,
snaxchain: 43,
wormchain: 3104,
cosmoshub: 4000,
evmos: 4001,
Expand Down Expand Up @@ -89,6 +90,7 @@ export const EVMChainNames = [
"linea",
"berachain",
"seievm",
"snaxchain",
"sepolia",
"arbitrum_sepolia",
"base_sepolia",
Expand Down Expand Up @@ -343,6 +345,11 @@ const MAINNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
snaxchain: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
token_bridge:
Expand Down Expand Up @@ -634,6 +641,11 @@ const TESTNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
snaxchain: {
core: "0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd",
token_bridge: "0xa10f2eF61dE1f19f586ab8B6F2EbA89bACE63F7a",
nft_bridge: undefined,
},
wormchain: {
core: "wormhole16jzpxp0e8550c9aht6q9svcux30vtyyyyxv5w2l2djjra46580wsazcjwp",
token_bridge:
Expand Down Expand Up @@ -918,6 +930,11 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
snaxchain: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqtm7t3h",
token_bridge:
Expand Down Expand Up @@ -1078,6 +1095,7 @@ export const CHAIN_ID_XLAYER = CHAINS["xlayer"];
export const CHAIN_ID_LINEA = CHAINS["linea"];
export const CHAIN_ID_BERACHAIN = CHAINS["berachain"];
export const CHAIN_ID_SEIEVM = CHAINS["seievm"];
export const CHAIN_ID_SNAXCHAIN = CHAINS["snaxchain"];
export const CHAIN_ID_WORMCHAIN = CHAINS["wormchain"];
export const CHAIN_ID_GATEWAY = CHAIN_ID_WORMCHAIN;
export const CHAIN_ID_COSMOSHUB = CHAINS["cosmoshub"];
Expand Down
1 change: 1 addition & 0 deletions sdk/testnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var knownTestnetTokenbridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDXLayer: "000000000000000000000000dA91a06299BBF302091B053c6B9EF86Eff0f930D",
vaa.ChainIDLinea: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
vaa.ChainIDBerachain: "000000000000000000000000a10f2eF61dE1f19f586ab8B6F2EbA89bACE63F7a",
vaa.ChainIDSnaxchain: "000000000000000000000000a10f2eF61dE1f19f586ab8B6F2EbA89bACE63F7a",
vaa.ChainIDSepolia: "000000000000000000000000DB5492265f6038831E89f495670FF909aDe94bd9",
vaa.ChainIDHolesky: "00000000000000000000000076d093BbaE4529a342080546cAFEec4AcbA59EC6",
vaa.ChainIDArbitrumSepolia: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
Expand Down
7 changes: 7 additions & 0 deletions sdk/vaa/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ func (c ChainID) String() string {
return "berachain"
case ChainIDSeiEVM:
return "seievm"
case ChainIDSnaxchain:
return "snaxchain"
case ChainIDCosmoshub:
return "cosmoshub"
case ChainIDEvmos:
Expand Down Expand Up @@ -322,6 +324,8 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDLinea, nil
case "berachain":
return ChainIDBerachain, nil
case "snaxchain":
return ChainIDSnaxchain, nil
case "cosmoshub":
return ChainIDCosmoshub, nil
case "seievm":
Expand Down Expand Up @@ -397,6 +401,7 @@ func GetAllNetworkIDs() []ChainID {
ChainIDXLayer,
ChainIDLinea,
ChainIDBerachain,
ChainIDSnaxchain,
ChainIDWormchain,
ChainIDCosmoshub,
ChainIDEvmos,
Expand Down Expand Up @@ -493,6 +498,8 @@ const (
ChainIDBerachain ChainID = 39
// ChainIDSeiEVM is the ChainID of SeiEVM
ChainIDSeiEVM ChainID = 40
// ChainIDSnaxchain is the ChainID of Snaxchain
ChainIDSnaxchain ChainID = 43
//ChainIDWormchain is the ChainID of Wormchain
ChainIDWormchain ChainID = 3104
// ChainIDCosmoshub is the ChainID of Cosmoshub
Expand Down
3 changes: 3 additions & 0 deletions sdk/vaa/structs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestChainIDFromString(t *testing.T) {
{input: "xlayer", output: ChainIDXLayer},
{input: "linea", output: ChainIDLinea},
{input: "berachain", output: ChainIDBerachain},
{input: "snaxchain", output: ChainIDSnaxchain},
{input: "seievm", output: ChainIDSeiEVM},
{input: "wormchain", output: ChainIDWormchain},
{input: "cosmoshub", output: ChainIDCosmoshub},
Expand Down Expand Up @@ -119,6 +120,7 @@ func TestChainIDFromString(t *testing.T) {
{input: "XLayer", output: ChainIDXLayer},
{input: "Linea", output: ChainIDLinea},
{input: "Berachain", output: ChainIDBerachain},
{input: "Snaxchain", output: ChainIDSnaxchain},
{input: "SeiEVM", output: ChainIDSeiEVM},
{input: "Wormchain", output: ChainIDWormchain},
{input: "Cosmoshub", output: ChainIDCosmoshub},
Expand Down Expand Up @@ -314,6 +316,7 @@ func TestChainId_String(t *testing.T) {
{input: 38, output: "linea"},
{input: 39, output: "berachain"},
{input: 40, output: "seievm"},
{input: 43, output: "snaxchain"},
{input: 3104, output: "wormchain"},
{input: 4000, output: "cosmoshub"},
{input: 4001, output: "evmos"},
Expand Down

0 comments on commit f3e6a93

Please sign in to comment.