Skip to content

cluster: fix dead deposit amounts validation in unmarshalers - #4636

Open
pinebit wants to merge 1 commit into
mainfrom
pinebit/deposit-amounts-validation-fix
Open

cluster: fix dead deposit amounts validation in unmarshalers#4636
pinebit wants to merge 1 commit into
mainfrom
pinebit/deposit-amounts-validation-fix

Conversation

@pinebit

@pinebit pinebit commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Validate the parsed deposit amounts instead of the zero-valued named return in the v1.8, v1.9 and v1.10-11 definition unmarshalers.

The checks called deposit.VerifyDepositAmounts(def.DepositAmounts, def.Compounding) where def is the named return value, still zero at that point — the parsed data lives in defJSON. VerifyDepositAmounts(nil, false) returns nil via its empty-slice early return, so the checks always passed and definitions with invalid deposit amounts (below the 1ETH minimum, above the maximum, or summing to less than 32ETH) unmarshaled without error. The bug dates back to the introduction of partial deposits in v1.8 and was copied into the v1.9 and v1.10-11 unmarshalers.

The v1.8 and v1.9 unmarshalers now pass compounding=false since those versions don't support compounding; the v1.10-11 unmarshaler passes the parsed compounding flag so large amounts are only accepted for compounding validators.

Note this is defense in depth: the DKG path already re-validates amounts after loading (dkg/disk.go), but other consumers of definition/lock unmarshaling relied on the dead check.

category: bug
ticket: none

Validate the parsed deposit amounts instead of the zero-valued named
return in the v1.8, v1.9 and v1.10-11 definition unmarshalers. The
checks called VerifyDepositAmounts on the empty named return value, so
they always passed and definitions with invalid deposit amounts
unmarshaled without error. The v1.10-11 unmarshaler now also passes the
parsed compounding flag.

category: bug
ticket: none

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.22%. Comparing base (aea5631) to head (c08198e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4636      +/-   ##
==========================================
+ Coverage   58.16%   58.22%   +0.06%     
==========================================
  Files         247      247              
  Lines       34056    34056              
==========================================
+ Hits        19807    19829      +22     
+ Misses      11779    11759      -20     
+ Partials     2470     2468       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pinebit
pinebit requested a review from KaloyanTanev August 10, 2026 11:29
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