Skip to content

Commit

Permalink
Deploy Sepolia based L2s (#3606)
Browse files Browse the repository at this point in the history
* Deploy Sepolia based L2s

* Code review rework
  • Loading branch information
bruce-riley authored Dec 20, 2023
1 parent 126d330 commit 818038e
Show file tree
Hide file tree
Showing 18 changed files with 527 additions and 245 deletions.
8 changes: 8 additions & 0 deletions devnet/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ spec:
- ws://eth-devnet:8545
- --mantleRPC
- ws://eth-devnet:8545
- --sepoliaRPC
- ws://eth-devnet:8545
- --arbitrumSepoliaRPC
- ws://eth-devnet:8545
- --baseSepoliaRPC
- ws://eth-devnet:8545
- --optimismSepoliaRPC
- ws://eth-devnet:8545
# - --wormchainURL
# - wormchain:9090
# - --accountantKeyPath
Expand Down
17 changes: 17 additions & 0 deletions ethereum/.env.arbitrum.sepolia.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Arbitrum on Sepolia testnet
# Rename to .env to use with truffle migrations

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

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=10003
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
# WETH is listed here: https://docs.arbitrum.io/for-devs/useful-addresses#token-bridge-smart-contracts
BRIDGE_INIT_WETH=0x980B62Da83eFf3D4576C647993b0c1D7faf17c73
BRIDGE_INIT_FINALITY=1
17 changes: 17 additions & 0 deletions ethereum/.env.base.sepolia.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Base on Sepolia testnet env
# Rename to .env to use with truffle migrations

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

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=10004
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
# WETH is listed here: https://docs.base.org/base-contracts/
BRIDGE_INIT_WETH=0x4200000000000000000000000000000000000006
BRIDGE_INIT_FINALITY=1
17 changes: 17 additions & 0 deletions ethereum/.env.optimism.sepolia.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Optimism on Sepolia testnet
# Rename to .env to use with truffle migrations

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

# Bridge Migrations
BRIDGE_INIT_CHAIN_ID=10005
BRIDGE_INIT_GOV_CHAIN_ID=0x1
BRIDGE_INIT_GOV_CONTRACT=0x0000000000000000000000000000000000000000000000000000000000000004
# WETH is listed here: https://help.optimism.io/hc/en-us/articles/4417948883611-What-is-ETH-WETH-How-do-they-interact-
BRIDGE_INIT_WETH=0x4200000000000000000000000000000000000006
BRIDGE_INIT_FINALITY=1
29 changes: 29 additions & 0 deletions ethereum/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,16 @@ module.exports = {
},
network_id: 421613,
},
arbitrum_sepolia_testnet: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://arbitrum-sepolia.publicnode.com"
//"https://sepolia-rollup.arbitrum.io/rpc" // This didn't work.
);
},
network_id: 421614,
},
optimism: {
provider: () => {
return new HDWalletProvider(
Expand All @@ -330,6 +340,16 @@ module.exports = {
},
network_id: 420,
},
optimism_sepolia_testnet: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://rpc.ankr.com/optimism_sepolia"
// "https://sepolia.optimism.io/" <== This didn't work for testnet
);
},
network_id: 11155420,
},
gnosis: {
provider: () => {
return new HDWalletProvider(
Expand Down Expand Up @@ -366,6 +386,15 @@ module.exports = {
},
network_id: 84531,
},
base_sepolia_testnet: {
provider: () => {
return new HDWalletProvider(
process.env.MNEMONIC,
"https://sepolia.base.org"
);
},
network_id: 84532,
},
scroll_testnet: {
provider: () => {
return new HDWalletProvider(
Expand Down
3 changes: 3 additions & 0 deletions node/cmd/guardiand/adminnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"Mantle", vaa.ChainIDMantle},
{"Wormchain", vaa.ChainIDWormchain},
{"Sepolia", vaa.ChainIDSepolia},
{"ArbitrumSepolia", vaa.ChainIDArbitrumSepolia},
{"BaseSepolia", vaa.ChainIDBaseSepolia},
{"OptimismSepolia", vaa.ChainIDOptimismSepolia},
}

if len(only) > 0 {
Expand Down
126 changes: 95 additions & 31 deletions node/cmd/guardiand/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ var (
sepoliaRPC *string
sepoliaContract *string

arbitrumSepoliaRPC *string
arbitrumSepoliaContract *string

baseSepoliaRPC *string
baseSepoliaContract *string

optimismSepoliaRPC *string
optimismSepoliaContract *string

logLevel *string
publicRpcLogDetailStr *string
publicRpcLogToTelemetry *bool
Expand Down Expand Up @@ -352,6 +361,15 @@ func init() {
baseRPC = NodeCmd.Flags().String("baseRPC", "", "Base RPC URL")
baseContract = NodeCmd.Flags().String("baseContract", "", "Base contract address")

arbitrumSepoliaRPC = NodeCmd.Flags().String("arbitrumSepoliaRPC", "", "Arbitrum on Sepolia RPC URL")
arbitrumSepoliaContract = NodeCmd.Flags().String("arbitrumSepoliaContract", "", "Arbitrum on Sepolia contract address")

baseSepoliaRPC = NodeCmd.Flags().String("baseSepoliaRPC", "", "Base on Sepolia RPC URL")
baseSepoliaContract = NodeCmd.Flags().String("baseSepoliaContract", "", "Base on Sepolia contract address")

optimismSepoliaRPC = NodeCmd.Flags().String("optimismSepoliaRPC", "", "Optimism on Sepolia RPC URL")
optimismSepoliaContract = NodeCmd.Flags().String("optimismSepoliaContract", "", "Optimism on Sepolia contract address")

logLevel = NodeCmd.Flags().String("logLevel", "info", "Logging level (debug, info, warn, error, dpanic, panic, fatal)")
publicRpcLogDetailStr = NodeCmd.Flags().String("publicRpcLogDetail", "full", "The detail with which public RPC requests shall be logged (none=no logging, minimal=only log gRPC methods, full=log gRPC method, payload (up to 200 bytes) and user agent (up to 200 bytes))")
publicRpcLogToTelemetry = NodeCmd.Flags().Bool("logPublicRpcToTelemetry", true, "whether or not to include publicRpc request logs in telemetry")
Expand Down Expand Up @@ -505,6 +523,9 @@ func runNode(cmd *cobra.Command, args []string) {
*sepoliaContract = unsafeDevModeEvmContractAddress(*sepoliaContract)
*scrollContract = unsafeDevModeEvmContractAddress(*scrollContract)
*mantleContract = unsafeDevModeEvmContractAddress(*mantleContract)
*arbitrumSepoliaContract = unsafeDevModeEvmContractAddress(*arbitrumSepoliaContract)
*baseSepoliaContract = unsafeDevModeEvmContractAddress(*baseSepoliaContract)
*optimismSepoliaContract = unsafeDevModeEvmContractAddress(*optimismSepoliaContract)
}

// Verify flags
Expand Down Expand Up @@ -665,31 +686,38 @@ func runNode(cmd *cobra.Command, args []string) {
logger.Fatal("If --gatewayWS is not specified, then --gatewayLCD and --gatewayContract must not be specified")
}

if *testnetMode {
if *neonRPC == "" {
logger.Fatal("Please specify --neonRPC")
// These chains are only allowed in devnet and testnet.
if *testnetMode || *unsafeDevMode {
if (*neonRPC == "") != (*neonContract == "") {
logger.Fatal("Both --neonRPC and --neonContract must be set together or both unset")
}
if *neonContract == "" {
logger.Fatal("Please specify --neonContract")
if (*sepoliaRPC == "") != (*sepoliaContract == "") {
logger.Fatal("Both --sepoliaRPC and --sepoliaContract must be set together or both unset")
}
if *sepoliaRPC == "" {
logger.Fatal("Please specify --sepoliaRPC")
if (*arbitrumSepoliaRPC == "") != (*arbitrumSepoliaContract == "") {
logger.Fatal("Both --arbitrumSepoliaRPC and --arbitrumSepoliaContract must be set together or both unset")
}
if *sepoliaContract == "" {
logger.Fatal("Please specify --sepoliaContract")
if (*baseSepoliaRPC == "") != (*baseSepoliaContract == "") {
logger.Fatal("Both --baseSepoliaRPC and --baseSepoliaContract must be set together or both unset")
}
if (*optimismSepoliaRPC == "") != (*optimismSepoliaContract == "") {
logger.Fatal("Both --optimismSepoliaRPC and --optimismSepoliaContract must be set together or both unset")
}
} else {
if *neonRPC != "" && !*unsafeDevMode {
logger.Fatal("Please do not specify --neonRPC")
if *neonRPC != "" || *neonContract != "" {
logger.Fatal("Please do not specify --neonRPC or --neonContract")
}
if *sepoliaRPC != "" || *sepoliaContract != "" {
logger.Fatal("Please do not specify --sepoliaRPC or --sepoliaContract")
}
if *neonContract != "" && !*unsafeDevMode {
logger.Fatal("Please do not specify --neonContract")
if *arbitrumSepoliaRPC != "" || *arbitrumSepoliaContract != "" {
logger.Fatal("Please do not specify --arbitrumSepoliaRPC or --arbitrumSepoliaContract")
}
if *sepoliaRPC != "" && !*unsafeDevMode {
logger.Fatal("Please do not specify --sepoliaRPC")
if *baseSepoliaRPC != "" || *baseSepoliaContract != "" {
logger.Fatal("Please do not specify --baseSepoliaRPC or --baseSepoliaContract")
}
if *sepoliaContract != "" && !*unsafeDevMode {
logger.Fatal("Please do not specify --sepoliaContract")
if *optimismSepoliaRPC != "" || *optimismSepoliaContract != "" {
logger.Fatal("Please do not specify --optimismSepoliaRPC or --optimismSepoliaContract")
}
}

Expand Down Expand Up @@ -893,6 +921,9 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["pythnetWS"] = *pythnetWS
if env == common.TestNet {
rpcMap["sepoliaRPC"] = *sepoliaRPC
rpcMap["arbitrumSepoliaRPC"] = *arbitrumSepoliaRPC
rpcMap["baseSepoliaRPC"] = *baseSepoliaRPC
rpcMap["optimismSepoliaRPC"] = *optimismSepoliaRPC
}
rpcMap["scrollRPC"] = *scrollRPC
rpcMap["solanaRPC"] = *solanaRPC
Expand Down Expand Up @@ -1428,22 +1459,22 @@ func runNode(cmd *cobra.Command, args []string) {
watcherConfigs = append(watcherConfigs, wc)
}

if *testnetMode {
if shouldStart(neonRPC) {
if !shouldStart(solanaRPC) {
log.Fatalf("If neon is enabled then solana must also be enabled.")
}
wc := &evm.WatcherConfig{
NetworkID: "neon",
ChainID: vaa.ChainIDNeon,
Rpc: *neonRPC,
Contract: *neonContract,
L1FinalizerRequired: "solana-finalized",
}

watcherConfigs = append(watcherConfigs, wc)
if *testnetMode && shouldStart(neonRPC) {
if !shouldStart(solanaRPC) {
log.Fatalf("If neon is enabled then solana must also be enabled.")
}
wc := &evm.WatcherConfig{
NetworkID: "neon",
ChainID: vaa.ChainIDNeon,
Rpc: *neonRPC,
Contract: *neonContract,
L1FinalizerRequired: "solana-finalized",
}

watcherConfigs = append(watcherConfigs, wc)
}

if *testnetMode || *unsafeDevMode {
if shouldStart(sepoliaRPC) {
wc := &evm.WatcherConfig{
NetworkID: "sepolia",
Expand All @@ -1454,6 +1485,39 @@ func runNode(cmd *cobra.Command, args []string) {

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(arbitrumSepoliaRPC) {
wc := &evm.WatcherConfig{
NetworkID: "arbitrum_sepolia",
ChainID: vaa.ChainIDArbitrumSepolia,
Rpc: *arbitrumSepoliaRPC,
Contract: *arbitrumSepoliaContract,
}

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(baseSepoliaRPC) {
wc := &evm.WatcherConfig{
NetworkID: "base_sepolia",
ChainID: vaa.ChainIDBaseSepolia,
Rpc: *baseSepoliaRPC,
Contract: *baseSepoliaContract,
}

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(optimismSepoliaRPC) {
wc := &evm.WatcherConfig{
NetworkID: "optimism_sepolia",
ChainID: vaa.ChainIDOptimismSepolia,
Rpc: *optimismSepoliaRPC,
Contract: *optimismSepoliaContract,
}

watcherConfigs = append(watcherConfigs, wc)
}
}

var ibcWatcherConfig *node.IbcWatcherConfig = nil
Expand Down
2 changes: 1 addition & 1 deletion node/pkg/node/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func GuardianOptionWatchers(watcherConfigs []watchers.WatcherConfig, ibcWatcherC
return fmt.Errorf("NetworkID already configured: %s", string(wc.GetNetworkID()))
}

watcherName := string(wc.GetNetworkID()) + "watch"
watcherName := string(wc.GetNetworkID()) + "_watch"
logger.Debug("Setting up watcher: " + watcherName)

if wc.GetNetworkID() != "solana-confirmed" { // TODO this should not be a special case, see comment in common/readiness.go
Expand Down
Loading

0 comments on commit 818038e

Please sign in to comment.