ika-node: soften enforce-minimum-cpu assert to warning for localnet/dev#1720
Open
t3hrache1nn wants to merge 1 commit into
Open
ika-node: soften enforce-minimum-cpu assert to warning for localnet/dev#1720t3hrache1nn wants to merge 1 commit into
t3hrache1nn wants to merge 1 commit into
Conversation
Replace assert! with if + tracing::error! in IkaRuntimes::calculate_num_of_computations_cores(). Production validators (>=16 cores) unaffected. Localnet/dev runs on common hardware (<16 cores) no longer panic on startup. Also: saturating_sub for TOKIO_ALLOCATED_CORES to avoid underflow on <=4-core machines. Tested on 12-core dev box — full dWallet ceremony completed end-to-end on self-hosted localnet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
IkaRuntimes::calculate_num_of_computations_cores()incrates/ika-core/src/runtime.rscontainsassert!(total_cores_available >= 16, ...)gated on theenforce-minimum-cpuCargo feature. Upstreamika-node'sCargo.tomlincludesenforce-minimum-cpuin its default features, so the assert activates implicitly on every release build unless someone passes--no-default-features.On any dev machine with fewer than 16 physical cores (we hit this on a 12-core dev box),
ika-nodepanics on startup:This kills the localnet ceremony before DKG can begin. There is no localnet-friendly flag upstream today, so anyone trying to bring up a local Ika network for development on common hardware has to hand-patch the source and rebuild.
Proposed fix (this PR)
Replace
assert!withif + tracing::error!. Startup continues, the operator sees a clear warning that they're running underpowered. Production validators are unaffected — they already meet the threshold so the warning never fires.Also: replace
total_cores_available - TOKIO_ALLOCATED_CORESwith.saturating_sub(TOKIO_ALLOCATED_CORES).max(1)so the arithmetic doesn't underflow on machines with ≤4 cores (which would be a separate panic).Why not just
--no-default-features?That disables more than just the CPU gate — it removes the whole feature bundle. A localnet operator shouldn't have to opt out of unrelated production features just to run on a 12-core dev laptop.
Acceptance evidence
We applied this patch on a 12-core dev box and ran a full dWallet creation ceremony end-to-end (DKG through
Active) on self-hosted Ika localnet:0xfc2d0b3e56f3b936f8d97f9b0d2d40311315b4c95b4e5c790f67e627aebaa65eActiveat v4406ika dwallet create --curve secp256k1(no SDK custom path)Alternate shapes (open to maintainer preference)
assert!→if + tracing::error!(same behavior, warning instead of panic)assert!, gate it behind a newenforce-minimum-cpu-strictfeature; existingenforce-minimum-cpubecomes warning-only. Lets production validators opt into the strict panic explicitly.enforce-minimum-cpuout ofika-node's default Cargo features. Forces production deployments to opt in; localnet works out of the box.Happy to refactor to shape 2 or 3 if maintainers prefer — shape 1 was the minimum patch that unblocked us, but the others have different tradeoffs.