Skip to content

[CRE] Mixed-env topology + automatic non-determinism detection - #23290

Open
prashantkumar1982 wants to merge 2 commits into
developfrom
cre/mixed-env-non-determinism
Open

[CRE] Mixed-env topology + automatic non-determinism detection#23290
prashantkumar1982 wants to merge 2 commits into
developfrom
cre/mixed-env-non-determinism

Conversation

@prashantkumar1982

@prashantkumar1982 prashantkumar1982 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

[CRE] Mixed-env topology + automatic non-determinism detection

What & why

Adds a mixed-env Local CRE topology that runs each multi-node DON with 2 nodes on the PR image and 2 on the develop image, and fails the run if the two code versions disagree. This surfaces non-determinism and cross-version incompatibilities (e.g. things that would break a rolling upgrade) in CI, before merge — instead of after.

A DON only works if its nodes compute identical results. If a change makes nodes produce different consensus reports or different cross-DON request/response payloads, the DON can't agree. Putting old (develop) and new (PR) nodes in the same DON forces any such divergence to show up as a failed check.

What it catches

While the normal smoke tests run, every node's logs are scanned for markers that mean two nodes disagreed. A single hit fails the run with Non-Determinism introduced:

Layer Marker
OCR3 consensus This is commonly caused by non-determinism (libocr)
DON2DON request received messages with the same id and different payloads
DON2DON response received multiple unique responses for the same request / response quorum unreachable

These lines are silent when all nodes run the same code.

Changes

  • Topology: configs/mixed-env-don.toml.tmpl (workflow + capabilities DONs at override_mode = "each", 2 PR + 2 develop; bootstrap/gateway on the baseline), configs/render-mixed-env.sh (envsubst renderer), .gitignore for the rendered file.
  • Detection: test-helpers/nondeterminism_scan.go (ScanContainersForNeedles) + smoke/cre/nondeterminism_check_test.go (TestMain scans node logs after the suite, mixed-env only).
  • CI (cre-system-tests.yaml): mixed-env added to Test_CRE_V2_Suite_Bucket_A and _B via PER_TEST_TOPOLOGIES_JSON; TestMain excluded from test discovery; render step resolves PR + develop-nightly images; empty chainlink-image for mixed-env so per-node TOML images win; optional mixed_env_baseline_image input.
  • Docs: core/scripts/cre/environment/docs/mixed-env.md.

Reuses the already-built per-PR image and the nightly develop image — no extra image builds.

Design notes

  • 2-2 split: symmetric, and the only ratio that also produces beyond-log symptoms; 3-1 would mask a single divergent node (n=4 ⇒ F=1).
  • Scope: only tests exercising OCR3 consensus or a remote capability call can trip it; that's why it's scoped to Bucket_A/B.
  • Empty CTF_CHAINLINK_IMAGE is required for mixed-env (a non-empty value forces one image on all nodes) — handled in the workflow.

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@prashantkumar1982
prashantkumar1982 force-pushed the cre/mixed-env-non-determinism branch from 41c2e2f to b4be2da Compare July 31, 2026 19:08
@github-actions

Copy link
Copy Markdown
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@trunk-io

trunk-io Bot commented Jul 31, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@prashantkumar1982
prashantkumar1982 force-pushed the cre/mixed-env-non-determinism branch from b4be2da to 8b25b56 Compare July 31, 2026 20:11
Comment thread .github/workflows/cre-system-tests.yaml Outdated
exit 1
fi
echo "mixed-env non-determinism check: no markers found"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prashantkumar1982 what do you think about putting this mixed env in a dedicated workflow file? I am a bit weary about adding more things to this one. Soon it will be too complex to maintainable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Adds a "mixed-env" Local CRE topology that runs each multi-node DON with 2 nodes
built from the PR image and 2 from the develop image, and fails the run if the
two code versions ever disagree — surfacing non-determinism and cross-version
incompatibilities before merge.

- configs/mixed-env-don.toml.tmpl + render-mixed-env.sh: 2-2 image split per DON
  via override_mode = "each"; rendered with envsubst (gitignored output).
- test-helpers/nondeterminism_scan.go + smoke/cre TestMain: scan all node logs
  after the suite (mixed-env only) and fail with "Non-Determinism introduced".
  Markers: the libocr OCR3 signature-mismatch warning plus the DON2DON
  request/response divergence warnings.
- cre-system-tests.yaml: run mixed-env for Bucket_A/B; render step resolves PR +
  develop-nightly images; empty chainlink-image so per-node TOML images are used;
  optional mixed_env_baseline_image input; exclude TestMain from discovery.
- docs/mixed-env.md: developer-facing overview.

Reuses the already-built per-PR image and the nightly develop image, so no extra
image builds are added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review feedback: keep cre-system-tests.yaml simple by extracting the mixed-env
topology into a dedicated reusable workflow, mirroring how
cre-regression-system-tests.yaml is structured.

- New .github/workflows/cre-mixed-env-tests.yaml: owns the mixed-env matrix
  (Bucket_A, Bucket_B, EVM_Read_*), the render step, env start (empty
  CTF_CHAINLINK_IMAGE), and the non-determinism gate. No per-topology
  conditionals — every job is mixed-env, so it's simpler than the inline version.
- integration-tests.yml: call it from a new run-core-cre-mixed-env-tests job,
  gated the same as the other CRE e2e workflows.
- cre-system-tests.yaml: revert all mixed-env additions (matrix entries, render
  step, gate step, mixed_env_baseline_image input, chainlink-image conditional).
  Only the TestMain discovery exclusion remains (TestMain lives in the smoke pkg).
- docs updated to point at the new workflow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cl-sonarqube-production

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
3 Security Hotspots
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

@prashantkumar1982
prashantkumar1982 requested a review from Tofel August 3, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants