Skip to content

Commit

Permalink
Deploy Unichain testnet (#4134)
Browse files Browse the repository at this point in the history
* Deploy Unichain testnet

* Add snaxchain to proto
  • Loading branch information
bruce-riley authored Oct 10, 2024
1 parent 4894961 commit 44d6bf8
Show file tree
Hide file tree
Showing 11 changed files with 174 additions and 106 deletions.
2 changes: 2 additions & 0 deletions cspell-custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ unbond
Uncompromised
undercollateralization
unforgeable
unichain
Unichain
unnormalize
untampered
utest
Expand Down
21 changes: 21 additions & 0 deletions ethereum/env/.env.unichain.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Unichain testnet env
# Rename to .env

# Common config for forge deployment
RPC_URL=fill_this_in
FORGE_ARGS="--legacy"

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

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=44
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
BRIDGE_INIT_FINALITY=1
# Unichain is an OP Stack chain so *probably* has the same WETH address. Should verify this! https://docs.optimism.io/stack/protocol/features/custom-gas-token#what-is-the-wrapped-erc-20-gas-token
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 @@ -120,6 +120,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"Linea", vaa.ChainIDLinea},
{"Berachain", vaa.ChainIDBerachain},
{"Snaxchain", vaa.ChainIDSnaxchain},
{"Unichain", vaa.ChainIDUnichain},
{"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 @@ -187,6 +187,9 @@ var (
snaxchainRPC *string
snaxchainContract *string

unichainRPC *string
unichainContract *string

sepoliaRPC *string
sepoliaContract *string

Expand Down Expand Up @@ -394,6 +397,9 @@ func init() {
snaxchainRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "snaxchainRPC", "Snaxchain RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
snaxchainContract = NodeCmd.Flags().String("snaxchainContract", "", "Snaxchain contract address")

unichainRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "unichainRPC", "Unichain RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
unichainContract = NodeCmd.Flags().String("unichainContract", "", "Unichain 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 @@ -758,6 +764,7 @@ func runNode(cmd *cobra.Command, args []string) {
*lineaContract = checkEvmArgs(logger, *lineaRPC, *lineaContract, "linea", true)
*berachainContract = checkEvmArgs(logger, *berachainRPC, *berachainContract, "berachain", false)
*snaxchainContract = checkEvmArgs(logger, *snaxchainRPC, *snaxchainContract, "snaxchain", true)
*unichainContract = checkEvmArgs(logger, *unichainRPC, *unichainContract, "unichain", false)

// These chains will only ever be testnet / devnet.
*sepoliaContract = checkEvmArgs(logger, *sepoliaRPC, *sepoliaContract, "sepolia", false)
Expand Down Expand Up @@ -901,6 +908,7 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["terraLCD"] = *terraLCD
rpcMap["terra2WS"] = *terra2WS
rpcMap["terra2LCD"] = *terra2LCD
rpcMap["unichainRPC"] = *unichainRPC
rpcMap["gatewayWS"] = *gatewayWS
rpcMap["gatewayLCD"] = *gatewayLCD
rpcMap["wormchainURL"] = *wormchainURL
Expand Down Expand Up @@ -1334,6 +1342,18 @@ func runNode(cmd *cobra.Command, args []string) {
watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(unichainRPC) {
wc := &evm.WatcherConfig{
NetworkID: "unichain",
ChainID: vaa.ChainIDUnichain,
Rpc: *unichainRPC,
Contract: *unichainContract,
CcqBackfillCache: *ccqBackfillCache,
}

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(terraWS) {
wc := &cosmwasm.WatcherConfig{
NetworkID: "terra",
Expand Down
221 changes: 115 additions & 106 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 @@ -131,6 +131,7 @@ var perChainConfig = map[vaa.ChainID]PerChainConfig{
vaa.ChainIDLinea: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDBerachain: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDSnaxchain: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDUnichain: {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 @@ -727,6 +727,7 @@ func (w *Watcher) getFinality(ctx context.Context) (bool, bool, error) {
w.chainID == vaa.ChainIDOptimismSepolia ||
w.chainID == vaa.ChainIDSepolia ||
w.chainID == vaa.ChainIDSnaxchain ||
w.chainID == vaa.ChainIDUnichain ||
w.chainID == vaa.ChainIDXLayer {
finalized = true
safe = true
Expand Down
2 changes: 2 additions & 0 deletions proto/publicrpc/v1/publicrpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ enum ChainID {
CHAIN_ID_LINEA = 38;
CHAIN_ID_BERACHAIN = 39;
CHAIN_ID_SEIEVM = 40;
CHAIN_ID_SNAXCHAIN = 43;
CHAIN_ID_UNICHAIN = 44;
CHAIN_ID_WORMCHAIN = 3104;
CHAIN_ID_COSMOSHUB = 4000;
CHAIN_ID_EVMOS = 4001;
Expand Down
1 change: 1 addition & 0 deletions sdk/testnet_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var knownTestnetTokenbridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDLinea: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
vaa.ChainIDBerachain: "000000000000000000000000a10f2eF61dE1f19f586ab8B6F2EbA89bACE63F7a",
vaa.ChainIDSnaxchain: "000000000000000000000000a10f2eF61dE1f19f586ab8B6F2EbA89bACE63F7a",
vaa.ChainIDUnichain: "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 @@ -211,6 +211,8 @@ func (c ChainID) String() string {
return "seievm"
case ChainIDSnaxchain:
return "snaxchain"
case ChainIDUnichain:
return "unichain"
case ChainIDCosmoshub:
return "cosmoshub"
case ChainIDEvmos:
Expand Down Expand Up @@ -326,6 +328,8 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDBerachain, nil
case "snaxchain":
return ChainIDSnaxchain, nil
case "unichain":
return ChainIDUnichain, nil
case "cosmoshub":
return ChainIDCosmoshub, nil
case "seievm":
Expand Down Expand Up @@ -402,6 +406,7 @@ func GetAllNetworkIDs() []ChainID {
ChainIDLinea,
ChainIDBerachain,
ChainIDSnaxchain,
ChainIDUnichain,
ChainIDWormchain,
ChainIDCosmoshub,
ChainIDEvmos,
Expand Down Expand Up @@ -500,6 +505,8 @@ const (
ChainIDSeiEVM ChainID = 40
// ChainIDSnaxchain is the ChainID of Snaxchain
ChainIDSnaxchain ChainID = 43
// ChainIDUnichain is the ChainID of Unichain
ChainIDUnichain ChainID = 44
//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 @@ -66,6 +66,7 @@ func TestChainIDFromString(t *testing.T) {
{input: "linea", output: ChainIDLinea},
{input: "berachain", output: ChainIDBerachain},
{input: "snaxchain", output: ChainIDSnaxchain},
{input: "unichain", output: ChainIDUnichain},
{input: "seievm", output: ChainIDSeiEVM},
{input: "wormchain", output: ChainIDWormchain},
{input: "cosmoshub", output: ChainIDCosmoshub},
Expand Down Expand Up @@ -121,6 +122,7 @@ func TestChainIDFromString(t *testing.T) {
{input: "Linea", output: ChainIDLinea},
{input: "Berachain", output: ChainIDBerachain},
{input: "Snaxchain", output: ChainIDSnaxchain},
{input: "Unichain", output: ChainIDUnichain},
{input: "SeiEVM", output: ChainIDSeiEVM},
{input: "Wormchain", output: ChainIDWormchain},
{input: "Cosmoshub", output: ChainIDCosmoshub},
Expand Down Expand Up @@ -317,6 +319,7 @@ func TestChainId_String(t *testing.T) {
{input: 39, output: "berachain"},
{input: 40, output: "seievm"},
{input: 43, output: "snaxchain"},
{input: 44, output: "unichain"},
{input: 3104, output: "wormchain"},
{input: 4000, output: "cosmoshub"},
{input: 4001, output: "evmos"},
Expand Down

0 comments on commit 44d6bf8

Please sign in to comment.