Skip to content

fix: forward fee/value-lock callbacks through ProcessOperations (#29)#35

Merged
LiranCohen merged 1 commit into
masterfrom
fix/wire-fee-callbacks
Jun 4, 2026
Merged

fix: forward fee/value-lock callbacks through ProcessOperations (#29)#35
LiranCohen merged 1 commit into
masterfrom
fix/wire-fee-callbacks

Conversation

@LiranCohen

Copy link
Copy Markdown
Contributor

Summary

Fixes the dropped-seam bug behind issue #29. SideTree.ProcessOperations built each per-anchor Processor with only WithPrefix/WithCAS/WithDIDs, silently dropping any baseFeeFn/perOpFeeFn/valueLockFn set via WithFeeFunctions. Because the fee and value-lock checks in OperationsProcessor.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-anchor Processor.

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-node today, where all three remain nil → feeFunctions() returns empty → the Processor is 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-anchor ProcessedOperations.Error.
  • gofmt clean; 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

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>
@LiranCohen LiranCohen merged commit 860dcfe into master Jun 4, 2026
1 check passed
@LiranCohen LiranCohen deleted the fix/wire-fee-callbacks branch June 4, 2026 15:52
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