From ca36858425234c271144944986658e05c5abf1e0 Mon Sep 17 00:00:00 2001 From: otherview Date: Tue, 19 Dec 2023 16:59:13 +0000 Subject: [PATCH] debug for l2 deployer --- testnet/launcher/l2contractdeployer/docker.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/testnet/launcher/l2contractdeployer/docker.go b/testnet/launcher/l2contractdeployer/docker.go index e7532de5a6..c1b0c2bcff 100644 --- a/testnet/launcher/l2contractdeployer/docker.go +++ b/testnet/launcher/l2contractdeployer/docker.go @@ -27,11 +27,17 @@ func NewDockerContractDeployer(cfg *Config) (*ContractDeployer, error) { func (n *ContractDeployer) Start() error { fmt.Printf("Starting L2 contract deployer with config: \n%s\n\n", litter.Sdump(*n.cfg)) - cmds := []string{ - "npx", "hardhat", "obscuro:deploy", - "--network", "layer2", + cmds := []string{"npx"} + var ports []int + + // inspect stops operation until debugger is hooked on port 9229 if debug is enabled + if n.cfg.debugEnabled { + cmds = append(cmds, "--node-options=\"--inspect-brk=0.0.0.0:9229\"") + ports = append(ports, 9229) } + cmds = append(cmds, "hardhat", "obscuro:deploy", "--network", "layer2") + envs := map[string]string{ "PREFUND_FAUCET_AMOUNT": n.cfg.faucetPrefundAmount, "MGMT_CONTRACT_ADDRESS": n.cfg.managementContractAddress, @@ -73,7 +79,7 @@ func (n *ContractDeployer) Start() error { `, n.cfg.l1HTTPURL, n.cfg.l1privateKey, n.cfg.l2Host, n.cfg.l2Port, n.cfg.l2PrivateKey, n.cfg.hocPKString, n.cfg.pocPKString), } - containerID, err := docker.StartNewContainer("hh-l2-deployer", n.cfg.dockerImage, cmds, nil, envs, nil, nil) + containerID, err := docker.StartNewContainer("hh-l2-deployer", n.cfg.dockerImage, cmds, ports, envs, nil, nil) if err != nil { return err }