hide —simulate-proof-failures behind compile flag

The `--simulate-proof-failures` cli param is now only available when codex is compile using the `-d:codex_enable_proof_failures` flag.
This commit is contained in:
Eric Mastro 2023-04-24 19:38:32 +10:00
parent 04d223ba71
commit 477d4891d8
No known key found for this signature in database
3 changed files with 19 additions and 10 deletions

View File

@ -66,7 +66,7 @@ task testContracts, "Build & run Codex Contract tests":
test "testContracts"
task testIntegration, "Run integration tests":
codexTask()
buildBinary "codex", params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:codex_enable_proof_failures=true"
test "testIntegration"
task test, "Run tests":

View File

@ -138,10 +138,15 @@ proc new(_: type Contracts,
var validator: ?ValidatorInteractions
if config.persistence:
let purchasing = Purchasing.new(market, clock)
let proving = if config.simulateProofFailures > 0:
SimulatedProving.new(market, clock,
config.simulateProofFailures)
else: Proving.new(market, clock)
when codex_enable_proof_failures:
let proving = if config.simulateProofFailures > 0:
SimulatedProving.new(market, clock,
config.simulateProofFailures)
else: Proving.new(market, clock)
else:
let proving = Proving.new(market, clock)
let sales = Sales.new(market, clock, proving, repo)
client = some ClientInteractions.new(clock, purchasing)
host = some HostInteractions.new(clock, sales, proving)

View File

@ -34,6 +34,9 @@ import ./stores
export DefaultCacheSizeMiB, net, DefaultQuotaBytes, DefaultBlockTtl, DefaultBlockMaintenanceInterval, DefaultNumberOfBlocksToMaintainPerInterval
const
codex_enable_proof_failures* {.booldefine.} = false
type
StartUpCommand* {.pure.} = enum
noCommand,
@ -229,12 +232,13 @@ type
defaultValue: 1000
name: "validator-max-slots"
.}: int
simulateProofFailures* {.
desc: "Simulates proof failures once every N proofs. 0 = disabled."
defaultValue: 0
name: "simulate-proof-failures"
.}: uint
desc: "Simulates proof failures once every N proofs. 0 = disabled."
defaultValue: 0
name: "simulate-proof-failures"
hidden
.}: uint
of initNode:
discard