Skip to content

test(zkatsnark): extend integration coverage to match zkatdlog - #2596

Merged
adecaro merged 4 commits into
feature/zkat-snark-driverfrom
zkatsnark/integration
Nov 1, 2026
Merged

adecaro merged 4 commits into
feature/zkat-snark-driverfrom
zkatsnark/integration

Conversation

@adecaro

@adecaro adecaro commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Part of a series of parity PRs against feature/zkat-snark-driver (#2590, #2591, #2592 and others) that close the gaps between the zkatsnark driver and zkatdlog. This PR covers the integration gap.

Before this PR, the fabricx ZKAT-SNARK suite (integration/token/fungible/zkatsnark) ran only T1-T5. The fabtoken -> ZKAT-SNARK upgrade from #2551 was covered only by unit and regression tests. This PR brings the suite in line with the fabricx ZKAT-DLOG suite (integration/token/fungible/dlogx) and adds fabtoken -> ZKAT-SNARK upgrade suites.

What changed

Commit 1: test(integration): support fabtoken upgrade scenarios on fabricx (test plumbing only, no production code)

  • fabricx backend skips transient TMSs. Backend.PrepareNamespace and Backend.InstallPublicParams (integration/nwo/token/fabricx/factory.go) now return early for tms.Transient, as the Fabric chaincode backend (tcc.go) already does. Without this, the extra TMS fails with "missing orgs", and its public params get installed at bring-up, before the fabtoken phase runs. Unit tests added.
  • Topology applies endorsement settings to extra TMSs. The FSC endorsement, policy type, namespace policy and own-org settings are now applied to extra TMSs too. Without this, their merged config wipes the default TMS's fsc_endorsement block. Unit tests cover endorsement on and off.
  • The fzkatsnark SDK registers the fabtoken token and validator drivers, which the upgrade suites need. This has no effect on pure zkatsnark networks.
  • New TestTokensUpgradeWithAlias / TestLocalTokensUpgradeWithAlias in integration/token/fungible/tests.go. The existing TestTokensUpgrade / TestLocalTokensUpgrade are now thin wrappers that pass "dlog-32bits", so the Fabric update suite works as before.

Commit 2: test(zkatsnark): mirror dlogx scenarios and add fabtoken upgrade suites

  • integration/token/fungible/zkatsnark/zkatsnark_test.go adds:
    • T6/T7: Auditor = Issuer, then a public-params update
    • T8: Fabric CA, non-Aries (the only integration coverage of the non-Aries zkatsnark path)
    • T9: malicious transactions
    • T11: token selector (WebSocket, as in dlogx)
    • T12: multisig
    • T13: redeem to self
    • T14: policy identity OR/AND
    • T17: fabtoken 64-bit -> ZKAT-SNARK 32-bit (burn and re-issue)
    • T18: fabtoken 32-bit -> ZKAT-SNARK 32-bit (spent in place)
    • Shared setup is factored into newSuite / newUpgradeTestSuite.
  • fabricx.mk: targets integration-tests-fabricx-zkatsnark-t6 through -t18.
  • .github/workflows/tests.yml: enables t6, t7, t8, t9, t11, t12, t13, t17 and t18. t14 is in the matrix but commented out until the boolpolicy audit-info deserializer fix (feat(zkatsnark): honour resource limits, add circuit breaker, fix boolpolicy audit info deserializer #2591) is merged.
  • Docs: docs/drivers/zkatsnark.md (test coverage), docs/development/testing.md, docs/development/debug-integration-tests.md.

How it was tested

The integration scenarios were NOT run locally, by instruction. CI validates them. Locally, the new specs were only compile-checked.

Commands run (all passing):

cd integration && go build ./...
cd integration && go vet ./nwo/token/fabricx/ ./token/fungible/... ./token/common/sdk/fzkatsnark/
cd integration && go test -count=1 ./nwo/token/fabricx/ ./token/fungible/topology/ ./token/common/sdk/fzkatsnark/
cd integration && go test -run '^$' ./token/fungible/zkatsnark/ ./token/fungible/update/ ./token/fungible/dlogx/
cd integration && golangci-lint run ./nwo/token/fabricx/... ./token/fungible/ ./token/fungible/topology/... ./token/fungible/zkatsnark/... ./token/common/sdk/fzkatsnark/   # 0 issues
gofmt -l <touched packages>   # clean

Scenarios with dependencies or runtime risk

Out of scope / follow-ups

@adecaro adecaro added this to the ZKAT Snark Driver milestone Oct 30, 2026
@adecaro adecaro self-assigned this Oct 30, 2026
adecaro and others added 2 commits October 30, 2026 16:54
- fabricx Backend skips transient TMSs in PrepareNamespace and
  InstallPublicParams, as the Fabric chaincode backend does
- topology propagates FSC endorsement, namespace policy and own-org
  settings to extra TMSs, so their merged config does not wipe
  fsc_endorsement
- fzkatsnark SDK also registers the fabtoken token/validator drivers
- add TestTokensUpgradeWithAlias / TestLocalTokensUpgradeWithAlias and
  wait for every node to load the new public parameters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
Add T6-T9, T11-T14 and the fabtoken -> ZKAT-SNARK upgrade scenarios
(T17 burn-and-re-issue, T18 in place) to the fabricx ZKAT-SNARK suite,
with Makefile targets, CI matrix entries (T14 kept disabled until the
boolpolicy audit-info deserializer fix lands) and docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
@adecaro
adecaro force-pushed the zkatsnark/integration branch from 40d3e2d to a467299 Compare October 30, 2026 15:54
adecaro and others added 2 commits October 31, 2026 11:01
MaliciousTransfer gets a first transaction endorsed and then asks for a
second, different token request to be endorsed under the same transaction
id. With FSC-based endorsement the endorser already filed a validation
record for that id and refuses a second one (unique tx_id), so the attack
is stopped at endorsement and never reaches the ledger. The test expected
the transaction to be committed and then marked Deleted, which only holds
when there are no FSC endorsers.

When the network has FSC endorsers, expect the endorsement failure and
check that no tokens moved. Networks without endorsers (dlog on Fabric)
keep the existing ledger-status checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
… count

2900b2e made TestMaliciousTransactions expect the malicious transfer to
be rejected at FSC endorsement whenever the network has endorser nodes.
That guard is too broad: the EVM suites (evm, evmfabtoken, evmgw,
evmgwfabtoken) also run FSC endorsers, but the EVM endorsement responder
keeps no per-tx-id validation record, so the second token request under
the same tx id is endorsed, ordered, and marked Deleted by the ledger
("token requests do not match"). As a result evm-t9, evm-fabtoken-t9,
evm-gateway-t9 and evm-gateway-fabtoken-t9 regressed with
"Expected an error to have occurred. Got: nil" in MaliciousTransferCash.

Only the Fabric-family FSC endorsement service (fabric and fabricx
backends; fsc/responder.go AppendValidationRecord with a unique tx_id)
refuses tx-id reuse at endorsement. Select the endorsement-rejection
branch only when the default TMS has FSC endorsement enabled and its
backend topology type is exactly "fabric" or "fabricx" (the EVM gateway
type is "fabricx-evm" and must not match).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
@adecaro
adecaro merged commit 4d85440 into feature/zkat-snark-driver Nov 1, 2026
254 checks passed
@adecaro
adecaro deleted the zkatsnark/integration branch November 1, 2026 10:35
adecaro added a commit that referenced this pull request Nov 2, 2026
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant