Skip to content

Commit

Permalink
feat(config): add reader mode
Browse files Browse the repository at this point in the history
This fixes an issue where the advance-runner was being set to run in
reader mode whenever the claimer was disabled.
  • Loading branch information
marcelstanley committed Aug 16, 2024
1 parent 2a61192 commit d544f0b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ You should only use host mode for development and debugging!
* **Type:** `bool`
* **Default:** `"false"`

## `CARTESI_FEATURE_READER_MODE_ENABLED`

If set to true, the node will not generating any claims.

* **Type:** `bool`
* **Default:** `"false"`

## `CARTESI_HTTP_ADDRESS`

HTTP address for the node.
Expand Down
2 changes: 2 additions & 0 deletions internal/node/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type NodeConfig struct {
HttpAddress string
HttpPort int
FeatureHostMode bool
FeatureReaderModeEnabled bool
FeatureDisableClaimer bool
FeatureDisableMachineHashCheck bool
ExperimentalServerManagerBypassLog bool
Expand Down Expand Up @@ -96,6 +97,7 @@ func FromEnv() NodeConfig {
config.FeatureDisableMachineHashCheck = getFeatureDisableMachineHashCheck()
config.ExperimentalServerManagerBypassLog = getExperimentalServerManagerBypassLog()
config.FeatureDisableClaimer = getFeatureDisableClaimer()
config.FeatureReaderModeEnabled = getFeatureReaderModeEnabled()
config.ExperimentalSunodoValidatorEnabled = getExperimentalSunodoValidatorEnabled()
if config.ExperimentalSunodoValidatorEnabled {
config.ExperimentalSunodoValidatorRedisEndpoint =
Expand Down
6 changes: 6 additions & 0 deletions internal/node/config/generate/Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ If set to true, the node will run in host mode.
In host mode, computations will not be performed by the cartesi machine.
You should only use host mode for development and debugging!"""

[features.CARTESI_FEATURE_READER_MODE_ENABLED]
default = "false"
go-type = "bool"
description = """
If set to true, the node will not generating any claims."""

[features.CARTESI_FEATURE_DISABLE_CLAIMER]
default = "false"
go-type = "bool"
Expand Down
12 changes: 12 additions & 0 deletions internal/node/config/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/node/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func newAdvanceRunner(c config.NodeConfig, workDir string) services.CommandServi
c.BlockchainHttpEndpoint.Value))
s.Env = append(s.Env, fmt.Sprintf("ADVANCE_RUNNER_HEALTHCHECK_PORT=%v",
getPort(c, portOffsetAdvanceRunner)))
s.Env = append(s.Env, fmt.Sprintf("READER_MODE=%v", c.FeatureDisableClaimer))
s.Env = append(s.Env, fmt.Sprintf("READER_MODE=%v", c.FeatureReaderModeEnabled))
if c.FeatureHostMode || c.FeatureDisableMachineHashCheck {
s.Env = append(s.Env, "SNAPSHOT_VALIDATION_ENABLED=false")
}
Expand Down

0 comments on commit d544f0b

Please sign in to comment.