Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log-level to launcher + fix trace debug #1757

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions go/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ func (cf *ChainFork) IsFork() bool {
}

func (cf *ChainFork) String() string {
if cf == nil {
return ""
}
return fmt.Sprintf("ChainFork{NewCanonical: %s, OldCanonical: %s, CommonAncestor: %s, CanonicalPath: %s, NonCanonicalPath: %s}",
cf.NewCanonical.Hash(), cf.OldCanonical.Hash(), cf.CommonAncestor.Hash(), cf.CanonicalPath, cf.NonCanonicalPath)
}
3 changes: 3 additions & 0 deletions testnet/launcher/cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type TestnetConfigCLI struct {
contractDeployerDockerImage string
contractDeployerDebug bool
isSGXEnabled bool
logLevel int
}

// ParseConfigCLI returns a NodeConfigCLI based the cli params and defaults.
Expand All @@ -27,6 +28,7 @@ func ParseConfigCLI() *TestnetConfigCLI {
contractDeployerDockerImage := flag.String(contractDeployerDockerImageFlag, "testnetobscuronet.azurecr.io/obscuronet/hardhatdeployer:latest", flagUsageMap[contractDeployerDockerImageFlag])
contractDeployerDebug := flag.Bool(contractDeployerDebugFlag, false, flagUsageMap[contractDeployerDebugFlag])
isSGXEnabled := flag.Bool(isSGXEnabledFlag, false, flagUsageMap[isSGXEnabledFlag])
logLevel := flag.Int(logLevelFlag, 4, flagUsageMap[logLevelFlag])
flag.Parse()

cfg.validatorEnclaveDockerImage = *validatorEnclaveDockerImage
Expand All @@ -36,6 +38,7 @@ func ParseConfigCLI() *TestnetConfigCLI {
cfg.contractDeployerDebug = *contractDeployerDebug
cfg.contractDeployerDockerImage = *contractDeployerDockerImage
cfg.isSGXEnabled = *isSGXEnabled
cfg.logLevel = *logLevel

return cfg
}
2 changes: 2 additions & 0 deletions testnet/launcher/cmd/cli_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
contractDeployerDockerImageFlag = "contract-deployer-docker-image"
contractDeployerDebugFlag = "contract-deployer-debug"
isSGXEnabledFlag = "is-sgx-enabled"
logLevelFlag = "log-level"
)

// Returns a map of the flag usages.
Expand All @@ -22,5 +23,6 @@ func getFlagUsageMap() map[string]string {
contractDeployerDockerImageFlag: "The docker image that runs the contract deployer",
contractDeployerDebugFlag: "Enables the use of node inspector to debug the contract deployer",
isSGXEnabledFlag: "Enables the SGX usage",
logLevelFlag: "Log level for all network",
}
}
1 change: 1 addition & 0 deletions testnet/launcher/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func main() {
launcher.WithContractDeployerDebug(cliConfig.contractDeployerDebug),
launcher.WithContractDeployerDockerImage(cliConfig.contractDeployerDockerImage),
launcher.WithSGXEnabled(cliConfig.isSGXEnabled),
launcher.WithLogLevel(cliConfig.logLevel),
),
)
err := testnet.Start()
Expand Down
8 changes: 8 additions & 0 deletions testnet/launcher/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type Config struct {
contractDeployerDebug bool

isSGXEnabled bool

logLevel int
}

func NewTestnetConfig(opts ...Option) *Config {
Expand Down Expand Up @@ -68,3 +70,9 @@ func WithContractDeployerDebug(b bool) Option {
c.contractDeployerDebug = b
}
}

func WithLogLevel(i int) Option {
return func(c *Config) {
c.logLevel = i
}
}
4 changes: 2 additions & 2 deletions testnet/launcher/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (t *Testnet) Start() error {
node.WithL1Start(networkConfig.L1StartHash),
node.WithInMemoryHostDB(true),
node.WithDebugNamespaceEnabled(true),
node.WithLogLevel(4),
node.WithLogLevel(t.cfg.logLevel),
node.WithEdgelessDBImage("ghcr.io/edgelesssys/edgelessdb-sgx-4gb:v0.3.2"), // default edgeless db value
)

Expand Down Expand Up @@ -102,7 +102,7 @@ func (t *Testnet) Start() error {
node.WithL1Start(networkConfig.L1StartHash),
node.WithInMemoryHostDB(true),
node.WithDebugNamespaceEnabled(true),
node.WithLogLevel(4),
node.WithLogLevel(t.cfg.logLevel),
node.WithEdgelessDBImage("ghcr.io/edgelesssys/edgelessdb-sgx-4gb:v0.3.2"), // default edgeless db value
)

Expand Down
Loading