Repository navigation
feat(zkatsnark): honour resource limits, add circuit breaker, fix boolpolicy audit info deserializer - #2591
Merged
Conversation
This was referenced Oct 30, 2026
Merged
… audit deserializer Align the zkatsnark driver wiring with zkatdlog: - NewTokenDriver takes the dig-provided driver.ResourceLimitsProvider and NewTokenService passes the resolved limits to the validator, so token.validation.limits is honoured by the endorser-side validator and by IssueService.maxOutputs (upgrade split) instead of hard-coded defaults. - The wallet service is decorated with the observability circuit breaker (NewWalletServiceDecoratorWithConfig) in Driver.NewTokenService and in WalletServiceFactory.NewWalletService; the decorated service backs authorization, issue/transfer services and the token service. zkatsnark.NewTokenService now takes driver.WalletService. - NewEIDRHDeserializer registers boolpolicy.NewAuditInfoDeserializer(d) instead of the zero value, which silently dropped the enrollment ID of policy identities and skipped component audit-info checks. Add driver wiring unit tests, a policy enrollment-ID test, a maxOutputs test, and FuzzActionResourceLimits (wired into nightly fuzzing). Update the zkatsnark, resource-limits and observability docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
adecaro
force-pushed
the
zkatsnark/driver-wiring
branch
from
October 30, 2026 09:49
27ed044 to
fc088b1
Compare
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.
Summary
This PR closes the "driver-wiring" parity gap between the
zkatsnarkdriver andzkatdlog. It is one of a series of parallel parity PRs againstfeature/zkat-snark-driver.Before this change, the zkatsnark driver:
token.validation.limitsand hard-codeddriver.ResourceLimits{}.WithDefaults();What changed
(a) Resource limits
NewTokenDrivernow takes adriver.ResourceLimitsProvideras its last parameter, like zkatdlog. dig supplies it, so the integration SDK (integration/token/common/sdk/fzkatsnark) needs no change.NewTokenServiceresolves the limits right beforevalidator.NewValidatorand fails withfailed resolving validator resource limitsif the provider errors.IssueService.maxOutputs()(the upgrade split) now uses the configured limits.FuzzActionResourceLimits(nogh/v1/validator/validator_limits_fuzz_test.go). It runs throughActionDeserializer.DeserializeActionsagainst the default limits and a small custom set. It seeds boundary and boundary+1 cases for inputs, outputs and metadata entries, for both issue and transfer actions. The target is wired into.github/workflows/nightly-fuzz.ymlaszkatsnark-action-limits.(b) Circuit breaker / observability
NewTokenServicedecorates the wallet service withobservability.NewWalletServiceDecoratorWithConfig(ws, metricsProvider, LoadCircuitBreakerConfig(tmsConfig)). The decorated service is passed to the four authorization arguments (their ordering is unchanged), the issue service, the transfer service andzkatsnark.NewTokenService. The deserializer and identity provider stay on the raw wallet service, as in zkatdlog.zkatsnark.NewTokenServicenow takesdriver.WalletService. Godoc was added for it and forService.WalletServiceFactory.NewWalletServicealso returns a decorated service, using&disabled.Provider{}.(c) boolpolicy audit info
NewEIDRHDeserializernow registersboolpolicy.NewAuditInfoDeserializer(d), the same as zkatdlog.Docs
docs/drivers/zkatsnark.md: new "Driver Wiring" section. It notes that operators running plonkfri must raisemaxRequestBytesandmaxActionBytesundertoken.validation.limits, and that the upgrade-split limit is configurable.docs/drivers/validation-resource-limits.md: lists the zkatsnarkNewTokenDriverand adds a ZKAT-SNARK limits table.docs/services/observability.md: mentions ZKAT-SNARK.Behaviour changes
token.validation.limitsnow apply to the zkatsnark endorser-side validator and to the upgrade split. Operators running plonkfri must raisemaxActionBytesandmaxRequestBytesthemselves.Dependency note
The new import of
token/services/observabilityrequired runninggo mod tidyin the zkatsnark module. That bumpedgolang.org/x/netfrom v0.61.0 to v0.62.0, which matches what the root module already requires. Other parallel PRs may touch the samego.mod/go.sumlines.Tests
driver/deserializer_test.gois a regression test. It failed on the base branch: the EID came back as""instead of"wallet-42", and malformed member audit info gave no error. It passes after the fix. It also covers conflicting members and legally missing (nil) member audit info.driver/driver_test.gocovers:NewTokenService;Validator.Limits;*observability.WalletServiceDecorator;TestIssueServiceMaxOutputspins the upgrade split at the limit and at limit+1.Commands run (all pass):
An independent reviewer re-ran the build, vet, targeted tests, a fuzz run, the race test, lint, gofmt and
go mod tidy -diff, and confirmed that the regression test fails on the base branch.Out of scope / follow-ups / limitations
make unit-tests-zkatsnarkshards under-race, and the NWO integration tests (covered by a separate parity PR).zkatsnarkhas noMaxProofBytescheck by design, so proof size is not a fuzz dimension.ws.go;errors.Errorf("...[%s]", err)indriver.go/validator.go;LoadAuditRetryConfiginNewAuditorService;decoratedWSto the four authorization multiplexer arguments. If the multiplexer-ordering PR merges first, keepdecoratedWSin its new ordering when resolving the conflict, and vice versa.🤖 Generated with Claude Code