WEBVTT

00:00:00.500 --> 00:00:02.466
This canister is already running.

00:00:03.366 --> 00:00:07.116
Its code reports business revision one, and its Store uses memory

00:00:07.129 --> 00:00:07.897
schema one.

00:00:08.796 --> 00:00:10.697
The root owns a vector of integers.

00:00:11.595 --> 00:00:14.330
Its numbered child owns a separate buffer of bytes.

00:00:15.228 --> 00:00:18.496
We can check where both buffers live before asking the Internet

00:00:18.509 --> 00:00:20.176
Computer to replace the Wasm.

00:00:21.075 --> 00:00:24.226
The request selects KEEP, which preserves the canister's Wasm

00:00:24.239 --> 00:00:25.775
main memory for the upgrade.

00:00:27.933 --> 00:00:31.175
Application work drains before the upgrade begins.

00:00:32.075 --> 00:00:35.578
The old code checks that callbacks and executor tasks have drained

00:00:35.591 --> 00:00:37.349
and that no Store frame is open.

00:00:38.247 --> 00:00:41.255
Shutdown then drops App and a separately held reference to the

00:00:41.268 --> 00:00:42.062
leaf's vector.

00:00:42.961 --> 00:00:44.823
The leaf keeps its own reference.

00:00:45.721 --> 00:00:49.549
After SDK cleanup and the final readiness checks, the old code

00:00:49.562 --> 00:00:50.890
records a clean marker.

00:00:51.789 --> 00:00:55.096
The incoming Wasm checks this marker before it initializes its

00:00:55.109 --> 00:00:55.747
statics.

00:00:57.867 --> 00:01:01.291
The startup guard checks the saved platform layout and consumes

00:01:01.304 --> 00:01:02.163
the clean marker.

00:01:03.064 --> 00:01:07.244
It resets the SDK's control area and initializes the new program's

00:01:07.257 --> 00:01:07.947
statics.

00:01:08.845 --> 00:01:11.358
The retained allocations stay in their pages.

00:01:12.257 --> 00:01:15.668
The incoming code compares the saved fingerprint with its compiled

00:01:15.681 --> 00:01:16.280
Catalog.

00:01:17.179 --> 00:01:20.447
The Catalog covers the data's layout and how the code interprets

00:01:20.460 --> 00:01:20.707
it.

00:01:21.606 --> 00:01:25.121
This fixture's business revision can change outside that contract.

00:01:26.020 --> 00:01:27.348
The fingerprints match.

00:01:28.246 --> 00:01:31.905
Before the first new allocation, the provider recovers any leftover

00:01:31.918 --> 00:01:33.793
Runtime pages for reuse.

00:01:34.692 --> 00:01:36.658
It reads their ownership records.

00:01:37.556 --> 00:01:41.072
The Nyxus pages are still owned, so both retained buffers stay

00:01:41.085 --> 00:01:42.634
at their original addresses.

00:01:44.767 --> 00:01:46.954
The restore hook opens the retained root.

00:01:47.855 --> 00:01:50.667
It takes a fresh reference to the leaf's vector and saves a

00:01:50.680 --> 00:01:52.138
new App bound to the actor.

00:01:53.037 --> 00:01:56.331
Then it writes the V1 fingerprint back to the saved Catalog.

00:01:57.230 --> 00:01:58.375
Ask for state again.

00:01:59.274 --> 00:02:01.735
The response now says business revision two.

00:02:02.633 --> 00:02:06.045
Schema one and the saved values match the first response.

00:02:06.943 --> 00:02:09.287
Both buffers are still at the same addresses.

00:02:10.185 --> 00:02:13.597
The test then tries a build with an extra field in the V1 root.

00:02:14.495 --> 00:02:18.128
The Catalog comparison fails before the candidate opens a retained

00:02:18.141 --> 00:02:18.623
pointer.

00:02:19.521 --> 00:02:23.493
The IC rolls back the attempt, including the old code's teardown.

00:02:24.391 --> 00:02:27.347
Business revision two is still running on schema one.

00:02:28.245 --> 00:02:31.344
To change the schema on purpose, the next build will name the

00:02:31.357 --> 00:02:33.388
V1 contract it can convert.

