fix(dlv): the advertisement's vault post is a frozen artifact, not a DLVManager derivation - #720
Merged
Merged
Conversation
…DLVManager derivation
route.publishRoutingAdvertisement derived its VaultPostProto mirror from
dlv_manager.create_vault_post — process-lifetime state — so a restarted
owner could never advertise a vault it had already created and funded
('Vault not found' on hardware during the two-device e2e). DLVManager
doctrine forbids repopulating the manager from records, and this fix
does not: dlv.create now freezes the exact encoded post bytes onto the
vault's record (amm_vault_records.vault_post_proto, joining the frozen
baseline_state_ccb/baseline_presentation bytes), and the publisher
replays them verbatim. The in-memory derive path is deleted, not gated.
The bytes are final only after finalize_vault applies the creator
signature and dlv.create stamps enforcement + policy_digest, so the
producer runs exactly there and is MANDATORY: a vault whose post cannot
be frozen fails at creation, not at first publish. The publisher fails
closed on an empty column with an error naming the missing producer.
Trader-side sufficiency verified from source: route.syncVaultsForPair
already rebuilds the full LimboVault from published post bytes
(VaultPost::try_from -> from_vault_post). Reconcile and dlv.composeVault
are durable-only, so the ad path was the only owner-restart consumer.
CLIENT_DB_SCHEMA_VERSION 6 -> 7; beta does not migrate (clean wipe).
Regressions: a fresh router (empty DLVManager over the same durable
state and carried-over head) publishes the ad — the exact hardware
failure shape; a mutation control blanks the column in SQL (the true
pre-cut database state) and requires the named refusal. dsm_sdk lib
1772/0; make lint green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (owner cleanup step 3 — the restart recovery gap)
route.publishRoutingAdvertisementderived its fullVaultPostProtomirror fromdlv_manager.create_vault_post. DLVManager vaults are process-lifetime by doctrine (no repopulation from records — that would fabricate values nobody computed), so any restart permanently orphaned every existing vault for advertisement purposes — observed on hardware during the two-device e2e ("Vault not found", vaultA8PSGQGZ…, chip task_3deb28ee).Fix — durable replay, not rehydration
dlv.createfreezes the exact encoded post bytes onto the vault's record: newamm_vault_records.vault_post_protocolumn, joining the frozenbaseline_state_ccb/baseline_presentationbytes (third instance of the repo's frozen-artifact pattern).finalize_vaultapplies the creator signature and enforcement +policy_digestare stamped — the earliest point the bytes are final — and is mandatory: a vault whose post cannot be frozen fails at creation, not at first publish.route.syncVaultsForPairalready rebuilds the fullLimboVaultfrom published post bytes (VaultPost::try_from→from_vault_post). Reconcile anddlv.composeVaultare durable-only, so the ad path was the only owner-restart consumer.CLIENT_DB_SCHEMA_VERSION6 → 7; beta does not migrate (clean wipe, devices re-onboard).Regressions
the_advertisement_publishes_from_durable_state_after_a_restart— a fresh router (empty DLVManager over the same durable state, head carried over as the persistence codec would) publishes the ad; also pins that the frozen bytes decode as aVaultPostProtonaming the vault and carrying theLimboVaultProto.an_empty_frozen_post_refuses_to_publish_instead_of_rederiving— mutation control blanks the column in SQL (the exact pre-cut database state) and requires the refusal to name the missing producer.Verification
cargo test -p dsm_sdk --lib: 1772 passed / 0 failed (7 ignored)cargo check -p dsm_sdk --all-targetsclean;make lintgreen (fmt + clippy + frontend)