fix: forward fee/value-lock callbacks through ProcessOperations (#29)#35
Merged
Conversation
SideTree.ProcessOperations built each per-anchor Processor with only WithPrefix/WithCAS/WithDIDs, silently dropping any baseFeeFn/perOpFeeFn/ valueLockFn configured via WithFeeFunctions. The fee and value-lock checks in OperationsProcessor.Process() are gated on those callbacks being non-nil, so they could never fire — the seam was dead even for a caller that set it. Forward the configured callbacks (only the non-nil ones, preserving the nil guards in Process()) to every per-anchor Processor. This is a prerequisite for the unconditional per-anchor op-count enforcement (#28); on its own it changes nothing for callers that don't set the callbacks (e.g. ion-node today). Adds TestProcessOperationsForwardsFeeFunctions, which fails before the fix (callback never invoked) and covers value-lock reject, per-op-fee reject, and the accept path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Fixes the dropped-seam bug behind issue #29.
SideTree.ProcessOperationsbuilt each per-anchorProcessorwith onlyWithPrefix/WithCAS/WithDIDs, silently dropping anybaseFeeFn/perOpFeeFn/valueLockFnset viaWithFeeFunctions. Because the fee and value-lock checks inOperationsProcessor.Process()are gated on those callbacks being non-nil, they could never fire — the value-lock seam was dead code even for a caller that configured it.This forwards the configured callbacks (only the non-nil ones, so the nil guards in
Process()stay correct) to every per-anchorProcessor.Why it matters
This is the enabling prerequisite for the P0 consensus fix (#28 — unconditional per-anchor op-count enforcement). Without it, no value-lock / fee logic the reader installs can ever run. See the plan:
docs/plans/2026-06-04-001-feat-ion-value-locking-protocol-rules-plan.md.On its own this PR changes nothing for callers that don't set the callbacks (e.g.
ion-nodetoday, where all three remain nil →feeFunctions()returns empty → theProcessoris built exactly as before).Testing
TestProcessOperationsForwardsFeeFunctions(new) — verified red before the fix (callback never invoked →called == false), green after. Covers three sub-cases: value-lock reject, per-op-fee reject, and the accept path, asserting the per-anchorProcessedOperations.Error.gofmtclean;go build,go vet,go test -race -count=1 ./...all green locally.Post-Deploy Monitoring & Validation
No additional operational monitoring required: pure library change, inert until a caller sets
WithFeeFunctions(none do yet); behavior is exercised by the enforcement PR #28.🤖 Generated with Claude Code