eth,node,sdk: XLayer, Linea and Berachain to testnet (#3871)

* Deploy XLayer and Linea to testnet

* Add Berachain support
This commit is contained in:
bruce-riley 2024-04-15 21:45:43 -05:00 committed by GitHub
parent f290df6b9b
commit 005c649018
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 258 additions and 5 deletions

View File

@ -14,6 +14,7 @@ backdoors
bech
Bech
behaviour
Berachain
bigset
Bigtable
borsh
@ -94,6 +95,7 @@ Kujira
lamports
lastrun
libp
Linea
localterra
lockfiles
merkle
@ -141,6 +143,7 @@ rustup
satoshi
secp
seda
Sepolia
serde
setcap
solana

View File

@ -116,6 +116,12 @@ spec:
- ws://eth-devnet:8545
- --blastRPC
- ws://eth-devnet:8545
- --xlayerRPC
- ws://eth-devnet:8545
- --lineaRPC
- ws://eth-devnet:8545
- --berachainRPC
- ws://eth-devnet:8545
- --sepoliaRPC
- ws://eth-devnet:8545
- --holeskyRPC

20
ethereum/env/.env.berachain.testnet vendored Normal file
View File

@ -0,0 +1,20 @@
# Berachain testnet env
# ethereum$ ln -s env/.env.berachain.testnet .env
# Common config for forge deployment
RPC_URL=https://artio.rpc.berachain.com/
# Wormhole Core Migrations
INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
INIT_CHAIN_ID=39
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_EVM_CHAIN_ID=80085
# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=39
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
# Wrapped BERA: https://docs.berachain.com/developers/precompile-addresses#deployment-addresses
BRIDGE_INIT_WETH=0x5806E416dA447b267cEA759358cF22Cc41FAE80F
BRIDGE_INIT_FINALITY=1

19
ethereum/env/.env.linea.testnet vendored Normal file
View File

@ -0,0 +1,19 @@
# Linea testnet env
# Rename to .env
# Common config for forge deployment
RPC_URL="https://rpc.sepolia.linea.build"
# Wormhole Core Migrations
INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
INIT_CHAIN_ID=38
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_EVM_CHAIN_ID=59141
# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=38
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
BRIDGE_INIT_WETH=0x0000000000000000000000000000000000000000
BRIDGE_INIT_FINALITY=1

20
ethereum/env/.env.xlayer.testnet vendored Normal file
View File

@ -0,0 +1,20 @@
# XLayer testnet env
# Rename to .env
# Common config for forge deployment
RPC_URL="https://testrpc.xlayer.tech/"
FORGE_ARGS="--legacy --with-gas-price 110000000000" # 110 gwei
# Wormhole Core Migrations
INIT_SIGNERS=["0x13947Bd48b18E53fdAeEe77F3473391aC727C638"]
INIT_CHAIN_ID=37
INIT_GOV_CHAIN_ID=0x1
INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
INIT_EVM_CHAIN_ID=195
# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=37
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
BRIDGE_INIT_WETH=0xa2affd8301bfb3c5b815829f2f509f053556d21b
BRIDGE_INIT_FINALITY=1

View File

@ -116,6 +116,9 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"Scroll", vaa.ChainIDScroll},
{"Mantle", vaa.ChainIDMantle},
{"Blast", vaa.ChainIDBlast},
{"XLayer", vaa.ChainIDXLayer},
{"Linea", vaa.ChainIDLinea},
{"Berachain", vaa.ChainIDBerachain},
{"Wormchain", vaa.ChainIDWormchain},
{"Sepolia", vaa.ChainIDSepolia},
{"Holesky", vaa.ChainIDHolesky},

View File

@ -179,6 +179,15 @@ var (
blastRPC *string
blastContract *string
xlayerRPC *string
xlayerContract *string
lineaRPC *string
lineaContract *string
berachainRPC *string
berachainContract *string
sepoliaRPC *string
sepoliaContract *string
@ -372,6 +381,15 @@ func init() {
blastRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "blastRPC", "Blast RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
blastContract = NodeCmd.Flags().String("blastContract", "", "Blast contract address")
xlayerRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "xlayerRPC", "XLayer RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
xlayerContract = NodeCmd.Flags().String("xlayerContract", "", "XLayer contract address")
lineaRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "lineaRPC", "Linea RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
lineaContract = NodeCmd.Flags().String("lineaContract", "", "Linea contract address")
berachainRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "berachainRPC", "Berachain RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
berachainContract = NodeCmd.Flags().String("berachainContract", "", "Berachain 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")
@ -580,6 +598,9 @@ func runNode(cmd *cobra.Command, args []string) {
*scrollContract = unsafeDevModeEvmContractAddress(*scrollContract)
*mantleContract = unsafeDevModeEvmContractAddress(*mantleContract)
*blastContract = unsafeDevModeEvmContractAddress(*blastContract)
*xlayerContract = unsafeDevModeEvmContractAddress(*xlayerContract)
*lineaContract = unsafeDevModeEvmContractAddress(*lineaContract)
*berachainContract = unsafeDevModeEvmContractAddress(*berachainContract)
*arbitrumSepoliaContract = unsafeDevModeEvmContractAddress(*arbitrumSepoliaContract)
*baseSepoliaContract = unsafeDevModeEvmContractAddress(*baseSepoliaContract)
*optimismSepoliaContract = unsafeDevModeEvmContractAddress(*optimismSepoliaContract)
@ -766,6 +787,30 @@ func runNode(cmd *cobra.Command, args []string) {
logger.Fatal("Both --blastContract and --blastRPC must be set together or both unset")
}
if *xlayerRPC != "" && !*testnetMode && !*unsafeDevMode {
logger.Fatal("xlayer is currently only supported in devnet and testnet")
}
if (*xlayerRPC == "") != (*xlayerContract == "") {
logger.Fatal("Both --xlayerContract and --xlayerRPC must be set together or both unset")
}
if *lineaRPC != "" && !*testnetMode && !*unsafeDevMode {
logger.Fatal("linea is currently only supported in devnet and testnet")
}
if (*lineaRPC == "") != (*lineaContract == "") {
logger.Fatal("Both --lineaContract and --lineaRPC must be set together or both unset")
}
if *berachainRPC != "" && !*testnetMode && !*unsafeDevMode {
logger.Fatal("berachain is currently only supported in devnet and testnet")
}
if (*berachainRPC == "") != (*berachainContract == "") {
logger.Fatal("Both --berachainContract and --berachainRPC 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")
@ -981,6 +1026,8 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["auroraRPC"] = *auroraRPC
rpcMap["avalancheRPC"] = *avalancheRPC
rpcMap["baseRPC"] = *baseRPC
rpcMap["berachainRPC"] = *berachainRPC
rpcMap["blastRPC"] = *blastRPC
rpcMap["bscRPC"] = *bscRPC
rpcMap["celoRPC"] = *celoRPC
rpcMap["ethRPC"] = *ethRPC
@ -992,8 +1039,8 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["injectiveWS"] = *injectiveWS
rpcMap["karuraRPC"] = *karuraRPC
rpcMap["klaytnRPC"] = *klaytnRPC
rpcMap["lineaRPC"] = *lineaRPC
rpcMap["mantleRPC"] = *mantleRPC
rpcMap["blastRPC"] = *blastRPC
rpcMap["moonbeamRPC"] = *moonbeamRPC
rpcMap["nearRPC"] = *nearRPC
rpcMap["oasisRPC"] = *oasisRPC
@ -1020,6 +1067,7 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["gatewayWS"] = *gatewayWS
rpcMap["gatewayLCD"] = *gatewayLCD
rpcMap["wormchainURL"] = *wormchainURL
rpcMap["xlayerRPC"] = *xlayerRPC
rpcMap["xplaWS"] = *xplaWS
rpcMap["xplaLCD"] = *xplaLCD
@ -1444,6 +1492,42 @@ func runNode(cmd *cobra.Command, args []string) {
watcherConfigs = append(watcherConfigs, wc)
}
if shouldStart(xlayerRPC) {
wc := &evm.WatcherConfig{
NetworkID: "xlayer",
ChainID: vaa.ChainIDXLayer,
Rpc: *xlayerRPC,
Contract: *xlayerContract,
CcqBackfillCache: *ccqBackfillCache,
}
watcherConfigs = append(watcherConfigs, wc)
}
if shouldStart(lineaRPC) {
wc := &evm.WatcherConfig{
NetworkID: "linea",
ChainID: vaa.ChainIDLinea,
Rpc: *lineaRPC,
Contract: *lineaContract,
CcqBackfillCache: *ccqBackfillCache,
}
watcherConfigs = append(watcherConfigs, wc)
}
if shouldStart(berachainRPC) {
wc := &evm.WatcherConfig{
NetworkID: "berachain",
ChainID: vaa.ChainIDBerachain,
Rpc: *berachainRPC,
Contract: *berachainContract,
CcqBackfillCache: *ccqBackfillCache,
}
watcherConfigs = append(watcherConfigs, wc)
}
if shouldStart(terraWS) {
wc := &cosmwasm.WatcherConfig{
NetworkID: "terra",

View File

@ -127,6 +127,9 @@ var perChainConfig = map[vaa.ChainID]PerChainConfig{
vaa.ChainIDScroll: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDMantle: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDBlast: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDXLayer: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDLinea: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDBerachain: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDSepolia: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDHolesky: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDArbitrumSepolia: {NumWorkers: 1, TimestampCacheSupported: true},

View File

@ -699,6 +699,7 @@ func fetchCurrentGuardianSet(ctx context.Context, ethConn connectors.Connector)
// getFinality determines if the chain supports "finalized" and "safe". This is hard coded so it requires thought to change something. However, it also reads the RPC
// to make sure the node actually supports the expected values, and returns an error if it doesn't. Note that we do not support using safe mode but not finalized mode.
func (w *Watcher) getFinality(ctx context.Context) (bool, bool, error) {
// TODO: Need to handle finality for Linea before it can be deployed in Mainnet.
finalized := false
safe := false
if w.unsafeDevMode {
@ -718,7 +719,8 @@ func (w *Watcher) getFinality(ctx context.Context) (bool, bool, error) {
w.chainID == vaa.ChainIDHolesky ||
w.chainID == vaa.ChainIDArbitrumSepolia ||
w.chainID == vaa.ChainIDBaseSepolia ||
w.chainID == vaa.ChainIDOptimismSepolia {
w.chainID == vaa.ChainIDOptimismSepolia ||
w.chainID == vaa.ChainIDXLayer {
finalized = true
safe = true
} else if w.chainID == vaa.ChainIDScroll {
@ -729,6 +731,9 @@ func (w *Watcher) getFinality(ctx context.Context) (bool, bool, error) {
// Polygon now supports polling for finalized but not safe.
// https://forum.polygon.technology/t/optimizing-decentralized-apps-ux-with-milestones-a-significantly-accelerated-finality-solution/13154
finalized = true
} else if w.chainID == vaa.ChainIDBerachain {
// Berachain supports instant finality: https://docs.berachain.com/faq/
return false, false, nil
}
// If finalized / safe should be supported, read the RPC to make sure they actually are.

View File

@ -4,6 +4,9 @@
Support for move of relayer ethereum contracts
Blast Sepolia support
XLayer Sepolia support
Linea Sepolia support
Berachain Testnet support
## 0.10.13

View File

@ -34,6 +34,9 @@ export const CHAINS = {
scroll: 34,
mantle: 35,
blast: 36,
xlayer: 37,
linea: 38,
berachain: 39,
wormchain: 3104,
cosmoshub: 4000,
evmos: 4001,
@ -80,6 +83,9 @@ export const EVMChainNames = [
"scroll",
"mantle",
"blast",
"xlayer",
"linea",
"berachain",
"sepolia",
"arbitrum_sepolia",
"base_sepolia",
@ -313,6 +319,21 @@ const MAINNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
xlayer: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
linea: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
berachain: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ufs3tlq4umljk0qfe8k5ya0x6hpavn897u2cnf9k0en9jr7qarqqaqfk2j",
token_bridge:
@ -507,9 +528,9 @@ const TESTNET = {
nft_bridge: "0x98A0F4B96972b32Fcb3BD03cAeB66A44a6aB9Edb",
},
neon: {
core: "0x268557122Ffd64c85750d630b716471118F323c8",
token_bridge: "0xEe3dB83916Ccdc3593b734F7F2d16D630F39F1D0",
nft_bridge: "0x66E5BcFD45D2F3f166c567ADa663f9d2ffb292B4",
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
terra2: {
core: "terra19nv3xr5lrmmr7egvrk2kqgw4kcn43xrtd5g0mpgwwvhetusk4k7s66jyv0",
@ -579,6 +600,21 @@ const TESTNET = {
token_bridge: "0x430855B4D43b8AEB9D2B9869B74d58dda79C0dB2",
nft_bridge: undefined,
},
xlayer: {
core: "0xA31aa3FDb7aF7Db93d18DDA4e19F811342EDF780",
token_bridge: "0xdA91a06299BBF302091B053c6B9EF86Eff0f930D",
nft_bridge: undefined,
},
linea: {
core: "0x79A1027a6A159502049F10906D333EC57E95F083",
token_bridge: "0xC7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
nft_bridge: undefined,
},
berachain: {
core: "0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd",
token_bridge: "0xa10f2eF61dE1f19f586ab8B6F2EbA89bACE63F7a",
nft_bridge: undefined,
},
wormchain: {
core: "wormhole16jzpxp0e8550c9aht6q9svcux30vtyyyyxv5w2l2djjra46580wsazcjwp",
token_bridge:
@ -838,6 +874,21 @@ const DEVNET = {
token_bridge: undefined,
nft_bridge: undefined,
},
xlayer: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
linea: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
berachain: {
core: undefined,
token_bridge: undefined,
nft_bridge: undefined,
},
wormchain: {
core: "wormhole1ghd753shjuwexxywmgs4xz7x2q732vcnkm6h2pyv9s6ah3hylvrqtm7t3h",
token_bridge:
@ -989,6 +1040,9 @@ 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_BLAST = CHAINS["blast"];
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_WORMCHAIN = CHAINS["wormchain"];
export const CHAIN_ID_GATEWAY = CHAIN_ID_WORMCHAIN;
export const CHAIN_ID_COSMOSHUB = CHAINS["cosmoshub"];

View File

@ -36,6 +36,9 @@ var knownTestnetTokenbridgeEmitters = map[vaa.ChainID]string{
vaa.ChainIDScroll: "00000000000000000000000022427d90B7dA3fA4642F7025A854c7254E4e45BF",
vaa.ChainIDMantle: "00000000000000000000000075Bfa155a9D7A3714b0861c8a8aF0C4633c45b5D",
vaa.ChainIDBlast: "000000000000000000000000430855B4D43b8AEB9D2B9869B74d58dda79C0dB2",
vaa.ChainIDXLayer: "000000000000000000000000dA91a06299BBF302091B053c6B9EF86Eff0f930D",
vaa.ChainIDLinea: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",
vaa.ChainIDBerachain: "000000000000000000000000a10f2eF61dE1f19f586ab8B6F2EbA89bACE63F7a",
vaa.ChainIDSepolia: "000000000000000000000000DB5492265f6038831E89f495670FF909aDe94bd9",
vaa.ChainIDHolesky: "00000000000000000000000076d093BbaE4529a342080546cAFEec4AcbA59EC6",
vaa.ChainIDArbitrumSepolia: "000000000000000000000000C7A204bDBFe983FCD8d8E61D02b475D4073fF97e",

View File

@ -201,6 +201,12 @@ func (c ChainID) String() string {
return "mantle"
case ChainIDBlast:
return "blast"
case ChainIDXLayer:
return "xlayer"
case ChainIDLinea:
return "linea"
case ChainIDBerachain:
return "berachain"
case ChainIDCosmoshub:
return "cosmoshub"
case ChainIDEvmos:
@ -306,6 +312,12 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDMantle, nil
case "blast":
return ChainIDBlast, nil
case "xlayer":
return ChainIDXLayer, nil
case "linea":
return ChainIDLinea, nil
case "berachain":
return ChainIDBerachain, nil
case "cosmoshub":
return ChainIDCosmoshub, nil
case "evmos":
@ -374,6 +386,9 @@ func GetAllNetworkIDs() []ChainID {
ChainIDScroll,
ChainIDMantle,
ChainIDBlast,
ChainIDXLayer,
ChainIDLinea,
ChainIDBerachain,
ChainIDWormchain,
ChainIDCosmoshub,
ChainIDEvmos,
@ -461,6 +476,12 @@ const (
ChainIDMantle ChainID = 35
// ChainIDBlast is the ChainID of Blast
ChainIDBlast ChainID = 36
// ChainIDXLayer is the ChainID of XLayer
ChainIDXLayer ChainID = 37
// ChainIDLinea is the ChainID of Linea
ChainIDLinea ChainID = 38
// ChainIDBerachain is the ChainID of Berachain
ChainIDBerachain ChainID = 39
//ChainIDWormchain is the ChainID of Wormchain
ChainIDWormchain ChainID = 3104
// ChainIDCosmoshub is the ChainID of Cosmoshub

View File

@ -62,6 +62,9 @@ func TestChainIDFromString(t *testing.T) {
{input: "scroll", output: ChainIDScroll},
{input: "mantle", output: ChainIDMantle},
{input: "blast", output: ChainIDBlast},
{input: "xlayer", output: ChainIDXLayer},
{input: "linea", output: ChainIDLinea},
{input: "berachain", output: ChainIDBerachain},
{input: "wormchain", output: ChainIDWormchain},
{input: "cosmoshub", output: ChainIDCosmoshub},
{input: "evmos", output: ChainIDEvmos},
@ -111,6 +114,9 @@ func TestChainIDFromString(t *testing.T) {
{input: "Scroll", output: ChainIDScroll},
{input: "Mantle", output: ChainIDMantle},
{input: "Blast", output: ChainIDBlast},
{input: "XLayer", output: ChainIDXLayer},
{input: "Linea", output: ChainIDLinea},
{input: "Berachain", output: ChainIDBerachain},
{input: "Wormchain", output: ChainIDWormchain},
{input: "Cosmoshub", output: ChainIDCosmoshub},
{input: "Evmos", output: ChainIDEvmos},
@ -299,6 +305,9 @@ func TestChainId_String(t *testing.T) {
{input: 34, output: "scroll"},
{input: 35, output: "mantle"},
{input: 36, output: "blast"},
{input: 37, output: "xlayer"},
{input: 38, output: "linea"},
{input: 39, output: "berachain"},
{input: 3104, output: "wormchain"},
{input: 4000, output: "cosmoshub"},
{input: 4001, output: "evmos"},