Shared access experiments, 2026-10-17
Baseline: acbb2d7, accepted API run 2026-10-16-234007.
These are isolated source patches, not accepted performance claims. Build and
measurement ownership belongs to the round's measurement agent.
Reuse the opened host Store
cached-host.patch changes only ver1/crates/cdk-rsx/src/wasm.rs.
The current generated root keeps its Actor bindings between messages, but each
root::read/root::with calls the SDK's read_store/with_store, which reconstruct
Store through RetainedMemory::reopen, StableMemory::acquire, and Store::open.
That rereads both anchors, the superblock, arena bounds and ownership mode and
throws away the Store's bounded descriptor-page and owner-location caches.
Actor then admits its root catalog in its ordinary scoped access.
The candidate keeps the already-open Store in transient thread-local storage.
The existing exclusive lease is acquired before taking it out. HostedStore
owns it for the scope; Drop returns it before releasing the lease. Only the
initial installation/post-upgrade opening performs full image validation.
The saved Store includes its existing arena counts, backend capacity and bounded
metadata-location caches, whose invalidation/update behavior already supports
long-lived native Store instances. No read/write scope or application payload is
cached, and root/catalog/descriptor/allocation/revision checks are unchanged.
The comparison must measure ordinary endpoint bodies, including acquisition and release. Saved inner counters alone miss the expected opening improvement. Avoid predicting an instruction delta from the number of source reads: the IC's first/second page access behavior and transient heap placement matter.
Lifetime and rollback argument
- The lease still rejects nested acquisition, even for two readers. The cached Option is empty while the HostedStore is live. The Store returns before the lease flag clears.
- The host's safe public API is the only owner of these backing capabilities. Calling the raw unsafe adapters while the host owns this canister's memory is invalid regardless of whether an application scope is currently open.
- Bounds caches remain coherent because retained/stable growth goes through the same Store/backend object. Raw growth outside that capability was already excluded by the adapter safety contract.
- A successful query may populate transient metadata caches. The IC discards those writes with the query; no stable/persistent payload changes are enabled.
- A trap rolls back the TLS Option, lease flag, allocator state, Store metadata and both physical memories as one IC execution. No new journal is added.
- The checked final-artifact startup clears bytes
[0, 16 MiB)before init or post-upgrade. That includes the TLS pointer state and runtime allocation arena; the next binary cannot reuse a previous Store or layout interpretation. - Async machinery is unchanged. Dropping the scope returns the Store and releases
its lease before an await. Holding HostedStore across a call still trips the
existing
assert_store_releasedbackstop. - The low-level
memory-demoqualification canister uses raw adapters exclusively and does not call this SDK host. It remains an intentionally separate fixture.
Required qualification
Compile actual wasm64 artifacts and run ordinary multi-call reads/writes, retained and stable growth, query followed by mutation, installation/upgrade with changed runtime layout, whole-message mixed-memory trap rollback, valid async roundtrips, callback cleanup and the invalid held-lease async probe. Existing app and IC qualification suites cover these paths; a final source/artifact manifest must identify the binaries actually run. Native lease tests cover acquisition/release but cannot qualify Wasm TLS rollback or startup.
Expected tradeoff: a bounded amount of runtime metadata remains allocated between scopes instead of being reconstructed, and query-only cache insertions are discarded by IC query execution. Persistent layout and data capacities do not change.
Reuse catalog admission while its existing revision is unchanged
actor-admission.patch is an independent candidate affecting Store's binding.rs,
module.rs and the native tests/bindings.rs regression suite.
Actor binding validates the current catalog once and records its existing
resource revision in one transient u64. Ordinary scoped admission still checks
Store identity and owner and resolves the catalog's exact public descriptor,
which validates its serial, liveness and ownership. An unchanged revision proves
that the admitted schema, generation, job/frozen state and catalog allocation have
not changed. A changed revision takes the existing full Catalog load/check path;
this candidate deliberately does not refresh the bound proof after that fallback.
The proof is local to this Actor, with no global cache or new persisted format.
Safe writes to the catalog payload or its published root advance the catalog's descriptor revision with checked overflow. Resource retirement and public allocation changes invalidate its descriptor authority or advance its revision. The proof covers the admitted catalog payload and lifecycle state; it does not claim that every allocator or graph bookkeeping byte advances that revision. Migration begin changes the revision before its frozen state becomes visible, and activation changes it before publishing the successor generation. Callers cannot manufacture an Actor or its captured revision. Raw private writes are trusted author infrastructure; violating another resource's ownership was already outside that unsafe contract.
A stale Actor therefore still rejects a newly frozen catalog (Busy), a replaced
root (StaleHandle) and another Store (WrongStore). Two added native regression
tests cover these boundaries using a real begin/validate/activate migration, not
manually manufactured metadata. Existing binding tests cover ordinary child/root
updates, detach/reattach and retiring child identities. As with the cached host,
its benefit must be established in ordinary Wasm method-body measurements.