Skip to content

feat(did-webvh): backdate + space the VTA's webvh versionTime - #600

Merged
stormer78 merged 1 commit into
mainfrom
feat/webvh-backdated-versiontime
Jun 28, 2026
Merged

feat(did-webvh): backdate + space the VTA's webvh versionTime#600
stormer78 merged 1 commit into
mainfrom
feat/webvh-backdated-versiontime

Conversation

@stormer78

Copy link
Copy Markdown
Contributor

What

Sets an explicit, backdated, index-spaced versionTime on the VTA's did:webvh log entries (genesis create + standard update), instead of letting the library default each to now().

Why

The VTA mints its did:webvh at setup and updates it moments later (e.g. services didcomm enable, or any service-management change). versionTime serialises at second granularity and must be strictly increasing and not in the future, so two entries minted in the same second serialise identically and make the DID unresolvable. It bites late and confusingly — the entries look fine in memory, then a client fetching did.jsonl fails with "versionTime must be greater than previous".

backdated_version_time(entry_index) returns now − 1 day + index·1 min. The wall-clock value is irrelevant to did:webvh (it's just a monotonic ordering marker), so backdating keeps the chain strictly increasing and in the past no matter how fast entries are minted — a day of headroom at one-minute spacing. Applied to the single-entry operations (genesis create, standard update). The multi-entry deactivation path keeps per-entry now() (a single value can't space its two entries).

Dependency

Requires didwebvh-rs 0.5.6, which exposes version_time on CreateDIDConfig/UpdateDIDConfig (decentralized-identity/didwebvh-rs#48). Bumped here + lockfile refreshed.

Validation

A fresh VTA setup + services didcomm enable back-to-back with no delay now resolves cleanly and completes a containerised did:peer agent → live-VTA round-trip (previously this required an artificial ≥1s pause between the two commands). did_webvh test suite green (73 + 24 + 1), fmt/clippy clean.

The VTA creates its did:webvh at setup and updates it moments later (e.g.
'services didcomm enable'). versionTime serialises at second granularity and must
be strictly increasing and not in the future, so two entries minted in the same
second serialise identically and make the DID unresolvable — surfacing as a
resolution failure ("versionTime must be greater than previous") only once a
client fetches did.jsonl.

Set an explicit versionTime on the genesis-create and standard-update log
entries: backdated a day and spaced a minute apart by entry index
(backdated_version_time). The wall-clock value is irrelevant to did:webvh; this
keeps the log strictly increasing and in the past regardless of how fast the
entries are minted. Requires didwebvh-rs 0.5.6, which exposes version_time on
CreateDIDConfig/UpdateDIDConfig (decentralized-identity/didwebvh-rs#48).

Validated end-to-end: a fresh VTA set up and didcomm-enabled back-to-back with no
delay now resolves and completes a containerised did:peer agent round-trip.

Signed-off-by: Glenn Gore <glenn@affinidi.com>
@stormer78
stormer78 requested a review from a team as a code owner June 28, 2026 22:34
@stormer78
stormer78 merged commit c73d9db into main Jun 28, 2026
9 of 10 checks passed
@stormer78
stormer78 deleted the feat/webvh-backdated-versiontime branch June 28, 2026 22:37
stormer78 added a commit that referenced this pull request Jul 2, 2026
…on (#600) (#605)

The VTA creates its did:webvh at `vta setup` and updates it moments later
(e.g. `services didcomm enable` patching in the DIDComm mediator service).
did:webvh serialises versionTime at second granularity and requires each
entry to be strictly later than the previous, so two entries minted in the
same wall-clock second serialise identically and the DID resolves back to
the genesis (REST-only) entry — the operator sees `services didcomm enable`
report success and write config.toml, yet the published DID document still
advertises REST only at version 1.

PR #600 fixed this by backdating + index-spacing versionTime on the
genesis-create and standard-update entries (`backdated_version_time`), but
shipped with only manual end-to-end validation. This adds automated guards:

- A did_webvh e2e test driving create -> didcomm-enable *back-to-back with
  no sleep* (every other e2e test dodges the bug by sleeping past the
  second boundary), asserting the chain still validates and advertises
  DIDCommMessaging at version 2. Neutering `backdated_version_time` makes it
  fail with the exact didwebvh-rs error ("Current versionTime must be
  greater than previous versionTime ... Log truncated at 2-...").
- A unit test pinning `backdated_version_time`'s contract: timestamps are in
  the past and strictly increasing by entry index at second precision.

Reuses the shared `with_didcomm_service` patcher rather than hand-rolling a
service-array edit.

Bumps vta-service 0.10.18 -> 0.10.19.

Claude-Session: https://claude.ai/code/session_01HoRff8BDqXuSfQ7RNjm3ic

Signed-off-by: Glenn Gore <glenn@affinidi.com>
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.

1 participant