Skip to content

refactor(common)!: remove unused UniqueKeyViolation/DeadlockDetected re-exports and AuditRegistry/SigRegistry - #2126

Merged
mbrandenburger merged 2 commits into
hyperledger-labs:mainfrom
mbrandenburger:issue-2010-remove-unused-symbols
Oct 16, 2026
Merged

mbrandenburger merged 2 commits into
hyperledger-labs:mainfrom
mbrandenburger:issue-2010-remove-unused-symbols

Conversation

@mbrandenburger

@mbrandenburger mbrandenburger commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Fixes #2010

vault.UniqueKeyViolation and vault.DeadlockDetected re-export the sentinels in platform/view/services/storage/driver. Nothing outside the vault package uses either one, in FSC or in Panurus. Every unique-key check (sql/common/binding.go, signerinfo.go, auditinfo.go, the sqlite and postgres error mappers) and the committer's retry classification in committer/failure.go use the storage-driver sentinels directly. The vault SQL writes only through upserts (ON CONFLICT DO NOTHING/UPDATE), so it never produces a unique-key violation. driver.AuditRegistry and driver.SigRegistry have no users; the sig service implements the same methods on its concrete type.

Difference from the issue

The issue keeps DeadlockDetected as a collapsed var. It is the same kind of unused re-export, so this PR removes it too. The commit retry loop in vault.go now checks dbdriver.DeadlockDetected, as committer/failure.go does.

Other changes in touched files

  • The retry loop said "This should generate a panic" on a non-deadlock error. The function returns that error for every tx in the batch and retries a deadlocked batch indefinitely (no bound, backoff or context check); the comment now says both. Bounding the loop is out of scope.
  • VerifyingIdentity, SigningIdentity and SigDeserializer in sigservice.go have Godoc. The Info doc states that auditInfo is optional: idemix uses it to add the enrollment ID and fails if it does not match the identity, while x509 ignores it.

Compatibility

Breaking only for code that imports the four removed symbols. Both packages are core/generic and driver packages without a compatibility promise. Panurus references only the storage-driver UniqueKeyViolation and none of the removed symbols. Building Panurus against this branch produces the same output as building it against main. That build already fails on main, because Panurus pins FSC v0.24.0 and its mock fsc/mock/fabric_rws.go lacks RWSet.GetReadVersion; this PR does not change that.

Verification

  • grep -rn --include='*.go' -E 'UniqueKeyViolation|DeadlockDetected|\b(AuditRegistry|SigRegistry)\b' over all five modules and Panurus finds only the storage-driver sentinels and their direct users.
  • go vet ./... passes in the root, integration, libp2p and cc/query modules.
  • go test -skip Postgres ./platform/common/core/generic/vault/... passes.
  • make checks reports 0 issues; golangci-lint's unused covers the U1000 check. The standalone staticcheck v0.7.0 named in the issue crashes on Go 1.27 (unexpected expr: *ast.KeyValueExpr), independent of this change.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Hey @mbrandenburger 👋 thanks for the PR!
I'm your friendly PR Helper Bot 🤖 and I'll be riding shotgun on this one, keeping track of your PR's status to help you get it approved and merged.

This comment updates automatically as you push changes -- think of it as your PR's live scoreboard!
Here's the latest:


PR Checks

✅ DCO Sign-off -- All commits have valid sign-offs. Nice work!


❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:

  • 9b91156 refactor(vault): remove unused UniqueKeyViolation/DeadlockDetected re-exports and AuditRegistry/SigRegistry
  • bf2563a fixup! refactor(vault): remove unused UniqueKeyViolation/DeadlockDetected re-exports and AuditRegistry/SigRegistry

You'll need to sign your commits with GPG (e.g. git commit -S). See the Signing Guide for a step-by-step walkthrough.


✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing!


✅ Issue Link -- Linked to #2010 (assigned to you).


⏳ All checks must pass before this PR can be reviewed. You've got this!

@github-actions github-actions Bot added the status: needs revision The pull request requires changes from the author before it can be reviewed or merged label Oct 15, 2026
@mbrandenburger mbrandenburger added this to the 26Q4 milestone Oct 15, 2026
@mbrandenburger mbrandenburger added status: needs review The pull request is ready for maintainer review and removed status: needs revision The pull request requires changes from the author before it can be reviewed or merged labels Oct 15, 2026
@AkramBitar

AkramBitar commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed the fix: correct, no blockers.

One optional change before merge, commit message only: refactor(common)!: ... instead of refactor(vault): ....

Optional: the new comment at vault.go:196 could say the batch is retried indefinitely — the loop has no bound, backoff or ctx check. Pre-existing, out of scope.

@AkramBitar AkramBitar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AkramBitar AkramBitar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@mbrandenburger mbrandenburger changed the title refactor(vault): remove unused UniqueKeyViolation/DeadlockDetected re-exports and AuditRegistry/SigRegistry refactor(common)!: remove unused UniqueKeyViolation/DeadlockDetected re-exports and AuditRegistry/SigRegistry Oct 16, 2026
@github-actions github-actions Bot added status: needs revision The pull request requires changes from the author before it can be reviewed or merged and removed status: needs review The pull request is ready for maintainer review labels Oct 16, 2026
@mbrandenburger
mbrandenburger enabled auto-merge (squash) October 16, 2026 10:03
…-exports and AuditRegistry/SigRegistry

vault.UniqueKeyViolation and vault.DeadlockDetected re-export the
storage-driver sentinels. Nothing outside the vault references them, in
FSC or Panurus, and the vault SQL uses upserts, so it never produces a
unique-key violation. The commit retry loop now checks
dbdriver.DeadlockDetected directly, the same way the committer does.

driver.AuditRegistry and driver.SigRegistry have no users. The sig
service implements the same methods on its concrete type.

Also add godocs to the remaining sigservice.go interfaces, and replace a
misleading comment in the retry loop: it returns the error, it does not
panic.

Closes hyperledger-labs#2010

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
…cted re-exports and AuditRegistry/SigRegistry

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger
mbrandenburger force-pushed the issue-2010-remove-unused-symbols branch from d9fb804 to bf2563a Compare October 16, 2026 10:03
@mbrandenburger
mbrandenburger merged commit d350423 into hyperledger-labs:main Oct 16, 2026
@mbrandenburger
mbrandenburger deleted the issue-2010-remove-unused-symbols branch October 16, 2026 10:04
rgowrishankar pushed a commit to rgowrishankar/fabric-smart-client that referenced this pull request Oct 20, 2026
…re-exports and AuditRegistry/SigRegistry (hyperledger-labs#2126)

vault.UniqueKeyViolation and vault.DeadlockDetected re-export the
storage-driver sentinels. Nothing outside the vault references them, in
FSC or Panurus, and the vault SQL uses upserts, so it never produces a
unique-key violation. The commit retry loop now checks
dbdriver.DeadlockDetected directly, the same way the committer does.

driver.AuditRegistry and driver.SigRegistry have no users. The sig
service implements the same methods on its concrete type.

Also add godocs to the remaining sigservice.go interfaces, and replace a
misleading comment in the retry loop: it retries a deadlocked batch
indefinitely and returns any other error, it does not panic.

Breaking: removes the exported vault.UniqueKeyViolation,
vault.DeadlockDetected, driver.AuditRegistry and driver.SigRegistry; use
platform/view/services/storage/driver.UniqueKeyViolation and
DeadlockDetected instead.

Closes hyperledger-labs#2010

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs revision The pull request requires changes from the author before it can be reviewed or merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(vault): remove the UniqueKeyViolation re-export and the unused AuditRegistry/SigRegistry interfaces

2 participants