Skip to content

Faketime work#3503

Open
OlufemiAdeOlusile wants to merge 3 commits into
masterfrom
faketime-work
Open

Faketime work#3503
OlufemiAdeOlusile wants to merge 3 commits into
masterfrom
faketime-work

Conversation

@OlufemiAdeOlusile

@OlufemiAdeOlusile OlufemiAdeOlusile commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds optional clock skew on one pool node in a local dev cluster via libfaketime (LD_PRELOAD + FAKETIME). Default-off: no env vars → unchanged behaviour. Local experiments only, not wired into CI or regression.

Changes

  • cluster_scripts.py_inject_time_drift_hook() replaces the # --- Placeholder for any pre-run setup --- comment in generated cardano-node-poolN wrappers with a conditional bash block that activates
    LD_PRELOAD/FAKETIME. Only pool wrappers are touched; bft1 and tx-generator are untouched. Raises ValueError if the placeholder is missing (guards against template drift with cardonnay).
  • flake.nix — adds pkgs.libfaketime to the Nix dev shell so the library is available automatically.
  • README.md — adds env var table and a single usage example under the local dev cluster section. libfaketime is included automatically in the Nix dev shell; no manual install needed.

Env contract

Variable Purpose
TIME_DRIFT_POOL Pool index (1, 2, or 3); unset = no drift
TIME_DRIFT_SPEC libfaketime string, e.g. +0 x1.008 (gradual, no boot offset)
LIBFAKETIME_PATH Override .so path if auto-detect fails

Usage

make cluster-scripts
TIME_DRIFT_POOL=1 TIME_DRIFT_SPEC='+0 x1.008' make start-cluster

@OlufemiAdeOlusile OlufemiAdeOlusile marked this pull request as ready for review June 18, 2026 10:03
Comment thread cardano_node_tests/utils/cluster_scripts.py
Comment thread scripts/check_dev_env.sh Outdated
Comment thread README.md
Inject a conditional clock-skew bash block into the pool wrapper
script via _inject_time_drift_hook. Activated only when
TIME_DRIFT_POOL and TIME_DRIFT_SPEC are set at cluster start time.
Default-off: unset env vars leave behaviour unchanged.

Add libfaketime to the Nix dev shell so the dependency is
available automatically. Remove manual installation instructions
and the has_faketime check from check_dev_env.sh per review
feedback. Simplify README to env var table and usage example.
Update _inject_time_drift_hook to replace the placeholder comment
'# --- Placeholder for any pre-run setup ---' added in cardonnay
PR#134 instead of prepending before exec cardano-node run.
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