Reactor, Rechain and Takt
Reactor, Rechain and Takt are separate crates in the CDK workspace. They compose Nyxus memory through Store. Use conventions for memory/service authoring, engines for storage behavior and upgrades for admitted lifecycle boundaries.
| Library | Responsibility |
|---|---|
| Reactor | Durable ordered delivery, response addresses, fair scheduling and callback permits |
| Rechain | Typed reducers, history, replay identities, certification and archive primitives |
| Takt | Workflow graphs, saved requests, coordination, uncertainty and call accounting |
| Takt generator | JSON validation, typed Rust generation and source maps |
| Takt derive | Compile-time progress payload metadata, reexported by Takt |
| DCID | Canonical principal/object identifier helpers |
Reactor owns the orchestration Error and Result types; Takt reexports them
for workflow APIs. Takt owns PayloadSize, which measures logical admission
size independently of serialization, allocation capacity and retained sharing.
Applications implement it for their workflow data and error types.
Workflow JSON owns generated code; handwritten versioned memory owns payloads. See Takt authoring for generation, build registration, compiler diagnostics and scaffolding. Crate-local native tests stay beside the libraries. The RRT benchmark owns Heavy16's canister, host workload, typed action verifier and build/run/audit tools. Its seven graphs are under canister/src/workflows. Chat, basic Rechain and lifecycle probes are standalone test fixtures; generic host support belongs to tests/pocketic.
For a new app, start from the typed Chat root with its shared Reactor scheduler, Rechain startup, and generated Takt registration. Its generated root supplies the Wasm admission export and retained catalog. The Basic Rechain fixture shows the lower-level admission wiring and recorded history. Chat example · Basic Rechain
Use IC Wire by default for public application endpoints and internal messages.
RRT also offers an experimental Tripwire transport (tripwire) and the
Fourcans workload contracts (tripwire-workload) for performance studies.
Reactor's optional tripwire_codec module provides the bounded value-message
traits, scalar frames and principal helpers used by Takt, Rechain and
applications. Its
tripwire-workload feature is independent of Reactor's tripwire transport
feature.
Build all communicating peers with the same contracts. This prototype mode is
fresh-install only: there is no old queue/history decoder, and a physical memory
signature does not infer the meaning of arbitrary saved byte buffers. Resolve
work before changing its byte contract; use a distinct contract for incompatible
live routes. See the SDK Tripwire guide
for selective IC reads and explicit borrowing of existing heap bytes.
Tripwire receive stores accepted fields in bounded retained packet chunks.
Queued byte/text spans own those bytes; synchronous handlers borrow nested
fields directly through dispatch. Known children use generated Nested fields
and bounded record arrays use List; tagged protocols open the selected child's
exact source window. Child builders write into the final parent allocation.
Opaque route payloads and specialized packed Reactor rows retain their explicit
readers. Packed Reactor batches select one little-endian width for each of
sequence, reader generation and response/request ID. Sequence and ID support
1/2/4/8-byte widths and the reader supports 1/2/4 bytes; a single checked batch
byte owns those choices. Full integer domains, exact principal tails, expiry
fields and cumulative payload ends remain available. Consumed entries release their owners, while
pending retries retain exact bytes. A small surviving span pins its whole chunk;
copy small business fields that need an independent long lifetime.
Reactor ingress ·
Shared Nyxus collections
Takt stores progress in typed native rows. Direct completion commits drop displaced values after releasing the row guards. Takt memory contract
The Tripwire peer endpoint uses one fresh-install outer envelope containing version, segment count, codec and the complete inner byte length. It sends either the exact inner bytes or one independent LZ4 block, selecting compression only when it reduces payload length. LZ4 comes from the reusable compression workspace. Raw mode belongs to this same current envelope; there is no earlier-format reader or codec negotiation. Every communicating peer must install the same contract. Existing receive authorization and version checks precede decompression. The original length is bounded at 2,000,000 bytes before allocation, and the decompressed header must agree with the admitted outer header. For IC sources, compressed input and decoded output occupy disjoint spans in one bounded ordinary allocation. Already-owned slice sources keep their borrowed input and allocate only decoded output. The workspace stays inside synchronous receive; accepted fields still copy into the bounded retained chunks above. No queued field retains the whole temporary decoded packet. Application payloads and saved operation bytes remain exact.
The IC controller lazily reuses time within each synchronous scheduler turn: IC time is constant during that invocation. Later turns, callbacks and resumed async work get a fresh closure. The general scheduler keeps its injectable clock, and instruction-budget counters continue to read progressing execution cost.
Saved retry bytes and operation identities remain unchanged across transport retries. A timeout does not cancel a physical call or authorize a replacement effect. See Wire and status for protocol and support limits.
History replay and archives
Rechain provides optional Reader, archive Store and transfer Coordinator owners. The Reader binds a saved cursor to one source and chain, traverses bounded archive redirects, checks the contiguous hash chain and advances only the application's acknowledged prefix. A resumed reader uses its saved archive range before asking the source for the next range. Apply rows and acknowledge their prefix in the same local write frame. Archive transfers persist exact retry bytes and release local history only after validating the accepted prefix. Count retention and explicit prefix targets are maintenance operations; local-only producers attach no archive owner.
Hosts provision and register archives, run calls under shared Reactor permits,
and supply polling/backoff and maintenance scheduling. Automatic archive
creation, funding, monitoring/upgrades and age/byte retention triggers are not
implemented. These primitives do not establish a complete archive-fleet
lifecycle. memory::configure separately supports admission-limit/catalog
changes before the actor's one Rechain Runtime binding, preserving history.
Installed archive and Reader replay
Workflow evolution and upgrade boundaries
The default RRT lifecycle drains business work and transport. Takt's local-work profile can retain eligible pending work under its exact definition, and its cold planner can convert selected states. Reactor's separate reader-upgrade profile retains eligible future-reader inbox frames. Use the generated switch to pause dispatch while callbacks retire. The old image still runs both SDK and owner lifecycle checks. Generated controller switch · Takt definition and execution evolution · Reactor reader capability · Store upgrade rules
Rechain's public block Reader persists its replay cursor and exact chain identity. Its payload and projection contracts evolve separately from both Takt execution state and Reactor reader generations. Rechain history evolution
Hash contracts
Rechain blocks and transaction replay fingerprints use the optimized
cdk-rsx-crypto-blake3 1.8.7 with pure, zeroize
and wasm32_simd enabled. Current RRT Rechain advertises
blake3-header-body-v3: its body commitment hashes
b"rechain/body-commitment/v3\0" || opening[32] || payload-length-u64-le || payload,
and its public block hash hashes b"rechain/header-chain/v3\0" || canonical-Wire-header || body-commitment.
The header commits deployment, index, parent, trusted commit time and hook policy.
Original reads disclose the body and opening; redacted/restricted reads retain
its original commitment. Chain-declared record/read hooks and a private native
blinding key support omitted secret fields, access control and delayed reveal.
See the RRT Rechain contract.
Transaction identities use the rechain:idempotency:blake3:v1 domain and keep
their framed caller, metadata and selected identity bytes.
The Takt generator uses the same BLAKE3 implementation for definition signatures,
preserving its cdk-rsx-takt-definition-v1\0 domain, canonical JSON, original
state order and Rust bindings. RRT benchmark semantic graph policies also use
BLAKE3 with their existing cdk-rsx-semantic-source\0 frame. Generated code comes
from JSON through the generator; these fingerprints own no workflow schema.
Reactor hashes no application values and retains its exact saved transport bytes.
IC certified trees, management module hashes and source/artifact integrity receipts use SHA-256. The RRT host independently verifies block BLAKE3 and reconstructs the IC certificate trees. It obtains the canonical header bytes from the selected artifact's generated Wire schema.
The dated qualification records give the source and artifact identities, tested workload and measurements. Rechain V3 Heavy16 · BLAKE3 qualification
Composed certification
RRT Rechain owns the canister's certified root. An application that also certifies
HTTP responses registers its complete labeled subtree with
cdk_rsx_rechain::ic::set_application_root. For HTTP certification this subtree
already contains the http_expr label, which sorts before rechain. Rechain
publishes their fork as one root whenever either branch changes; applications
must not call certified_data_set independently.
ic::application_witness checks the supplied witness against the registered
application digest and adds the current pruned Rechain sibling. Tip certificates
add the pruned application sibling to their own witness. Both authenticate the
same root while preserving the existing labeled lookup paths. Updating the
application branch does not flush tips deferred by Rechain's adaptive publisher.
The application digest is a transient registration. Restore the durable public snapshot and register its subtree after Rechain startup on init/restore, before serving queries. Canisters without an application branch retain their Rechain root alone. HTTP request bounds, response certification, cache policy and public snapshot freshness belong to the application; composition grants no write or financial authority. Composed HTTP certification recipe
Physical delivery and acknowledgements
The Reactor IC driver reports two independent values to Host::finish:
an optional decoded Reactor acknowledgement and PhysicalDisposition.
ReplyReceived includes replies rejected locally for byte size or ACK framing;
NotDispatched identifies cycle preflight or call_perform failure;
DefiniteReject identifies a genuine known reject response. Those events can
retire a host's delivery reservation without acknowledging a logical frame.
The existing transport finish path retains and retries any unacknowledged bytes.
UnknownOrAbandoned covers SYS_UNKNOWN, unclassified reject codes and guard
drop. It retains the conservative possible-late-delivery premise even though
the IC gives the caller at most one response callback. Callback completion is
not proof that an unknown request or callee effect cannot occur later.
retires_delivery_debt is a positive whitelist; business success, accepted
prefixes and financial idempotency still come from their own contracts.
The CDK distinguishes cleanup-generated CallRejected placeholders from
genuine rejection callbacks through is_cleanup(). Code/message matching must
not turn a trapped callback's synthetic error into a confirmed remote reject.
The existing guard/drop and fresh Store-frame boundaries remain in effect;
neither a view nor a memory guard crosses the awaited call. This metadata is
transient and does not change retained messages or their Wire format.
Standalone Reactor request recipe
Build and qualify
The RRT benchmark guide owns Heavy16 build, run, audit and composed lifecycle commands. The factory test guide owns native/tooling checks and standalone IC fixtures. Use the canonical SDK builder directly for fixture Wasm.
Run library tests from the repository root:
source tools/env.sh
cargo test --manifest-path cdk-rsx/Cargo.toml --workspace --offline --locked
Keep native checks, actual install/KEEP/rollback and performance qualification separate. Source relocation requires fresh artifacts and does not qualify unchanged performance. Use benchmark records for recorded results and source identities, and profiling for measurement rules. Historical reports retain their original implementation names and paths.