Skip to content

Commit

Permalink
Deploy Monad Devnet (#4145)
Browse files Browse the repository at this point in the history
* Deploy Monad Devnet

* Code review rework
  • Loading branch information
bruce-riley authored Oct 24, 2024
1 parent 5b2545e commit a543c40
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 82 deletions.
2 changes: 2 additions & 0 deletions cspell-custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ Metaplex
mindshare
mlock
moby
monad
Monad
moonscan
moretags
Neodyme
Expand Down
14 changes: 14 additions & 0 deletions ethereum/env/.env.monad_devnet.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Monad devnet env
# Rename to .env

# Common config for forge deployment
RPC_URL=public_url

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

# Not deploying the token bridge at this time.
1 change: 1 addition & 0 deletions node/cmd/guardiand/adminnodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func runListNodes(cmd *cobra.Command, args []string) {
{"BaseSepolia", vaa.ChainIDBaseSepolia},
{"OptimismSepolia", vaa.ChainIDOptimismSepolia},
{"PolygonSepolia", vaa.ChainIDPolygonSepolia},
{"MonadDevnet", vaa.ChainIDMonadDevnet},
}

if len(only) > 0 {
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 @@ -195,6 +195,9 @@ var (
worldchainRPC *string
worldchainContract *string

monadDevnetRPC *string
monadDevnetContract *string

sepoliaRPC *string
sepoliaContract *string

Expand Down Expand Up @@ -424,6 +427,9 @@ func init() {
polygonSepoliaRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "polygonSepoliaRPC", "Polygon on Sepolia RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
polygonSepoliaContract = NodeCmd.Flags().String("polygonSepoliaContract", "", "Polygon on Sepolia contract address")

monadDevnetRPC = node.RegisterFlagWithValidationOrFail(NodeCmd, "monadDevnetRPC", "Monad Devnet RPC URL", "ws://eth-devnet:8545", []string{"ws", "wss"})
monadDevnetContract = NodeCmd.Flags().String("monadDevnetContract", "", "Monad Devnet 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 @@ -801,6 +807,7 @@ func runNode(cmd *cobra.Command, args []string) {
*optimismSepoliaContract = checkEvmArgs(logger, *optimismSepoliaRPC, *optimismSepoliaContract, "optimismSepolia", false)
*holeskyContract = checkEvmArgs(logger, *holeskyRPC, *holeskyContract, "holesky", false)
*polygonSepoliaContract = checkEvmArgs(logger, *polygonSepoliaRPC, *polygonSepoliaContract, "polygonSepolia", false)
*monadDevnetContract = checkEvmArgs(logger, *monadDevnetRPC, *monadDevnetContract, "monadDevnet", false)

if !argsConsistent([]string{*solanaContract, *solanaRPC}) {
logger.Fatal("Both --solanaContract and --solanaRPC must be set or both unset")
Expand Down Expand Up @@ -927,6 +934,7 @@ func runNode(cmd *cobra.Command, args []string) {
rpcMap["baseSepoliaRPC"] = *baseSepoliaRPC
rpcMap["optimismSepoliaRPC"] = *optimismSepoliaRPC
rpcMap["polygonSepoliaRPC"] = *polygonSepoliaRPC
rpcMap["monadDevnetRPC"] = *monadDevnetRPC
}
rpcMap["scrollRPC"] = *scrollRPC
rpcMap["solanaRPC"] = *solanaRPC
Expand Down Expand Up @@ -1612,6 +1620,18 @@ func runNode(cmd *cobra.Command, args []string) {

watcherConfigs = append(watcherConfigs, wc)
}

if shouldStart(monadDevnetRPC) {
wc := &evm.WatcherConfig{
NetworkID: "monad_devnet",
ChainID: vaa.ChainIDMonadDevnet,
Rpc: *monadDevnetRPC,
Contract: *monadDevnetContract,
CcqBackfillCache: *ccqBackfillCache,
}

watcherConfigs = append(watcherConfigs, wc)
}
}

var ibcWatcherConfig *node.IbcWatcherConfig = nil
Expand Down
169 changes: 87 additions & 82 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 @@ -139,6 +139,7 @@ var perChainConfig = map[vaa.ChainID]PerChainConfig{
vaa.ChainIDBaseSepolia: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDOptimismSepolia: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDPolygonSepolia: {NumWorkers: 1, TimestampCacheSupported: true},
vaa.ChainIDMonadDevnet: {NumWorkers: 1, TimestampCacheSupported: true},
}

// GetPerChainConfig returns the config for the specified chain. If the chain is not configured it returns an empty struct,
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 @@ -722,6 +722,7 @@ func (w *Watcher) getFinality(ctx context.Context) (bool, bool, error) {
w.chainID == vaa.ChainIDHolesky ||
w.chainID == vaa.ChainIDKarura ||
w.chainID == vaa.ChainIDMantle ||
w.chainID == vaa.ChainIDMonadDevnet ||
w.chainID == vaa.ChainIDMoonbeam ||
w.chainID == vaa.ChainIDOptimism ||
w.chainID == vaa.ChainIDOptimismSepolia ||
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 @@ -66,6 +66,7 @@ enum ChainID {
CHAIN_ID_OPTIMISM_SEPOLIA = 10005;
CHAIN_ID_HOLESKY = 10006;
CHAIN_ID_POLYGON_SEPOLIA = 10007;
CHAIN_ID_MONAD_DEVNET = 10008;
}

// MessageID is a VAA's globally unique identifier (see data availability design document).
Expand Down
7 changes: 7 additions & 0 deletions sdk/vaa/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ func (c ChainID) String() string {
return "holesky"
case ChainIDPolygonSepolia:
return "polygon_sepolia"
case ChainIDMonadDevnet:
return "monad_devnet"
default:
return fmt.Sprintf("unknown chain ID: %d", c)
}
Expand Down Expand Up @@ -366,6 +368,8 @@ func ChainIDFromString(s string) (ChainID, error) {
return ChainIDHolesky, nil
case "polygon_sepolia":
return ChainIDPolygonSepolia, nil
case "monad_devnet":
return ChainIDMonadDevnet, nil
default:
return ChainIDUnset, fmt.Errorf("unknown chain ID: %s", s)
}
Expand Down Expand Up @@ -428,6 +432,7 @@ func GetAllNetworkIDs() []ChainID {
ChainIDOptimismSepolia,
ChainIDHolesky,
ChainIDPolygonSepolia,
ChainIDMonadDevnet,
}
}

Expand Down Expand Up @@ -546,6 +551,8 @@ const (
ChainIDHolesky ChainID = 10006
// ChainIDPolygonSepolia is the ChainID of Polygon on Sepolia
ChainIDPolygonSepolia ChainID = 10007
// ChainIDMonadDevnet is the ChainID of Monad Devnet
ChainIDMonadDevnet ChainID = 10008

// Minimum VAA size is derrived from the following assumptions:
// HEADER
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 @@ -85,6 +85,7 @@ func TestChainIDFromString(t *testing.T) {
{input: "optimism_sepolia", output: ChainIDOptimismSepolia},
{input: "holesky", output: ChainIDHolesky},
{input: "polygon_sepolia", output: ChainIDPolygonSepolia},
{input: "monad_devnet", output: ChainIDMonadDevnet},

{input: "Solana", output: ChainIDSolana},
{input: "Ethereum", output: ChainIDEthereum},
Expand Down Expand Up @@ -142,6 +143,7 @@ func TestChainIDFromString(t *testing.T) {
{input: "Optimism_Sepolia", output: ChainIDOptimismSepolia},
{input: "Holesky", output: ChainIDHolesky},
{input: "Polygon_Sepolia", output: ChainIDPolygonSepolia},
{input: "Monad_Devnet", output: ChainIDMonadDevnet},
}

// Negative Test Cases
Expand Down Expand Up @@ -337,6 +339,7 @@ func TestChainId_String(t *testing.T) {
{input: 10005, output: "optimism_sepolia"},
{input: 10006, output: "holesky"},
{input: 10007, output: "polygon_sepolia"},
{input: 10008, output: "monad_devnet"},
{input: 10000, output: "unknown chain ID: 10000"},
}

Expand Down

0 comments on commit a543c40

Please sign in to comment.