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 2 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
2 changes: 1 addition & 1 deletion go/enclave/components/block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (bp *l1BlockProcessor) tryAndInsertBlock(br *common.BlockAndReceipts) (*Blo
return nil, err
}
bp.logger.Trace("Block inserted successfully",
log.BlockHeightKey, block.NumberU64(), log.BlockHashKey, block.Hash(), "ingestionType", ingestionType)
otherview marked this conversation as resolved.
Show resolved Hide resolved
log.BlockHeightKey, block.NumberU64(), log.BlockHashKey, block.Hash())

err = bp.storage.StoreBlock(block, ingestionType.ChainFork)
if err != nil {
Expand Down
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