Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into pedro/p2p_disabled_flag
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Aug 31, 2023
2 parents a3cb94c + 509d76f commit 9163832
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/manual-deploy-testnet-l2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name: '[M] Deploy Testnet L2'
on:
workflow_dispatch:
inputs:
testnet_type:
testnet_type:
description: 'Testnet Type'
required: true
Expand All @@ -16,6 +16,11 @@ on:
options:
- 'dev-testnet'
- 'testnet'
log_level:
description: 'Log Level 1-Error 5-Trace'
required: true
default: 3
type: number

jobs:
build:
Expand Down Expand Up @@ -258,6 +263,7 @@ jobs:
-enclave_docker_image=${{needs.build.outputs.L2_ENCLAVE_DOCKER_BUILD_TAG}} \
-host_docker_image=${{needs.build.outputs.L2_HOST_DOCKER_BUILD_TAG}} \
-is_debug_namespace_enabled=true \
-log_level=${{ github.event.inputs.log_level }} \
start'
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/manual-upgrade-testnet-l2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ on:
options:
- 'dev-testnet'
- 'testnet'
log_level:
description: 'Log Level 1-Error 5-Trace'
required: true
default: 3
type: number

jobs:
build:
Expand Down Expand Up @@ -176,6 +181,7 @@ jobs:
-host_p2p_port=10000 \
-enclave_docker_image=${{needs.build.outputs.L2_ENCLAVE_DOCKER_BUILD_TAG}} \
-host_docker_image=${{needs.build.outputs.L2_HOST_DOCKER_BUILD_TAG}} \
-log_level=${{ github.event.inputs.log_level }} \
upgrade'
check-obscuro-is-healthy:
Expand Down
3 changes: 3 additions & 0 deletions go/node/cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type NodeConfigCLI struct {
hostWSPort int
nodeName string
isDebugNamespaceEnabled bool
logLevel int
}

// ParseConfigCLI returns a NodeConfigCLI based the cli params and defaults.
Expand Down Expand Up @@ -71,6 +72,7 @@ func ParseConfigCLI() *NodeConfigCLI {
pccsAddr := flag.String(pccsAddrFlag, "", flagUsageMap[pccsAddrFlag])
edgelessDBImage := flag.String(edgelessDBImageFlag, "ghcr.io/edgelesssys/edgelessdb-sgx-4gb:v0.3.2", flagUsageMap[edgelessDBImageFlag])
isDebugNamespaceEnabled := flag.Bool(isDebugNamespaceEnabledFlag, false, flagUsageMap[isDebugNamespaceEnabledFlag])
logLevel := flag.Int(logLevelFlag, 3, flagUsageMap[logLevelFlag])

flag.Parse()
cfg.nodeName = *nodeName
Expand All @@ -97,6 +99,7 @@ func ParseConfigCLI() *NodeConfigCLI {
cfg.hostHTTPPort = *hostHTTPPort
cfg.hostWSPort = *hostWSPort
cfg.isDebugNamespaceEnabled = *isDebugNamespaceEnabled
cfg.logLevel = *logLevel

cfg.nodeAction = flag.Arg(0)
if !validateNodeAction(cfg.nodeAction) {
Expand Down
2 changes: 2 additions & 0 deletions go/node/cmd/cli_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
pccsAddrFlag = "pccs_addr"
edgelessDBImageFlag = "edgeless_db_image"
isDebugNamespaceEnabledFlag = "is_debug_namespace_enabled"
logLevelFlag = "log_level"
)

// Returns a map of the flag usages.
Expand Down Expand Up @@ -56,5 +57,6 @@ func getFlagUsageMap() map[string]string {
hostHTTPPortFlag: "Host HTTPs bound port",
hostWSPortFlag: "Host WebSocket bound port",
isDebugNamespaceEnabledFlag: "Enables the debug namespace for both enclave and host",
logLevelFlag: "Sets the log level 1-Error, 5-Trace",
}
}
1 change: 1 addition & 0 deletions go/node/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func main() {
node.WithPCCSAddr(cliConfig.pccsAddr),
node.WithEdgelessDBImage(cliConfig.edgelessDBImage),
node.WithDebugNamespaceEnabled(cliConfig.isDebugNamespaceEnabled), // false
node.WithLogLevel(cliConfig.logLevel),
)

dockerNode := node.NewDockerNode(nodeCfg)
Expand Down
9 changes: 9 additions & 0 deletions go/node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type Config struct {
hostInMemDB bool
debugNamespaceEnabled bool
profilerEnabled bool
logLevel int
isInboundP2PEnabled bool
}

Expand All @@ -71,6 +72,7 @@ func (c *Config) ToEnclaveConfig() *config.EnclaveConfig {
cfg.HostID = gethcommon.HexToAddress(c.hostID)
cfg.HostAddress = fmt.Sprintf("127.0.0.1:%d", c.hostP2PPort)
cfg.LogPath = testlog.LogFile()
cfg.LogLevel = c.logLevel
cfg.Address = fmt.Sprintf("%s:%d", _localhost, c.enclaveWSPort)

return cfg
Expand Down Expand Up @@ -98,6 +100,7 @@ func (c *Config) ToHostConfig() *config.HostInputConfig {
cfg.LogPath = testlog.LogFile()
cfg.ProfilerEnabled = c.profilerEnabled
cfg.MetricsEnabled = false
cfg.LogLevel = c.logLevel
cfg.IsInboundP2PEnabled = c.isInboundP2PEnabled

return cfg
Expand Down Expand Up @@ -267,6 +270,12 @@ func WithProfiler(b bool) Option {
}
}

func WithLogLevel(i int) Option {
return func(c *Config) {
c.logLevel = i
}
}

func WithInboundP2PEnabled(b bool) Option {
return func(c *Config) {
c.isInboundP2PEnabled = b
Expand Down
3 changes: 3 additions & 0 deletions go/node/docker_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ func (d *DockerNode) startHost() error {
// todo (@stefan): once the limiter is in, increase it back to 5 or 10s
"-batchInterval=1s",
"-rollupInterval=3s",
fmt.Sprintf("-logLevel=%d", d.cfg.logLevel),
fmt.Sprintf("-isInboundP2PEnabled=%t", d.cfg.isInboundP2PEnabled),

Check failure on line 121 in go/node/docker_node.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofmt`-ed with `-s` (gofmt)
}
if !d.cfg.hostInMemDB {
cmd = append(cmd, "-levelDBPath", _hostDataDir)
Expand Down Expand Up @@ -176,6 +178,7 @@ func (d *DockerNode) startEnclave() error {
fmt.Sprintf("-debugNamespaceEnabled=%t", d.cfg.debugNamespaceEnabled),
"-maxBatchSize=25600",
"-maxRollupSize=65536",
fmt.Sprintf("-logLevel=%d", d.cfg.logLevel),
)

if d.cfg.sgxEnabled {
Expand Down
1 change: 1 addition & 0 deletions testnet/launcher/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (t *Testnet) Start() error {
node.WithL1Start(networkConfig.L1StartHash),
node.WithInMemoryHostDB(true),
node.WithDebugNamespaceEnabled(true),
node.WithLogLevel(4),
)

sequencerNode := node.NewDockerNode(sequencerNodeConfig)
Expand Down

0 comments on commit 9163832

Please sign in to comment.