From faffb193983ff3e0efeb0f79e134e7dc27880a9d Mon Sep 17 00:00:00 2001 From: Fornax <23104993+0xfornax@users.noreply.github.com> Date: Thu, 22 Oct 2026 13:06:26 -0300 Subject: [PATCH] Remove ProveValidatorBalanceChunk --- bindings/megapool/proof-bundle.go | 3 -- bindings/megapool/proof-bundle_test.go | 4 --- shared/services/megapools.go | 11 ------- .../eth2/fork/gloas/gloas_proofs_test.go | 32 ------------------- 4 files changed, 50 deletions(-) diff --git a/bindings/megapool/proof-bundle.go b/bindings/megapool/proof-bundle.go index e3ebd67c8..c991b78cc 100644 --- a/bindings/megapool/proof-bundle.go +++ b/bindings/megapool/proof-bundle.go @@ -45,7 +45,6 @@ type FinalBalanceProofBundleV2 struct { ValidatorProof ValidatorProof `json:"validatorProof"` SlotProof SlotProof `json:"slotProof"` PreviousNextWithdrawalIndexProof NextWithdrawalIndexProof `json:"previousNextWithdrawalIndexProof"` - ValidatorBalanceProof ValidatorBalanceProof `json:"validatorBalanceProof"` } // UsesProofBundles selects the transaction format from the deployed manager version. @@ -158,7 +157,6 @@ func EncodeFinalBalanceProofBundleV2( validatorProof ValidatorProof, slotProof SlotProof, previousNextWithdrawalIndexProof NextWithdrawalIndexProof, - validatorBalanceProof ValidatorBalanceProof, ) ([]byte, error) { return encodeTuple([]abi.ArgumentMarshaling{ {Name: "withdrawalProof", Type: "tuple", Components: withdrawalProofComponents}, @@ -171,7 +169,6 @@ func EncodeFinalBalanceProofBundleV2( ValidatorProof: validatorProof, SlotProof: slotProof, PreviousNextWithdrawalIndexProof: previousNextWithdrawalIndexProof, - ValidatorBalanceProof: validatorBalanceProof, }) } diff --git a/bindings/megapool/proof-bundle_test.go b/bindings/megapool/proof-bundle_test.go index b781a9fec..dcc1793b2 100644 --- a/bindings/megapool/proof-bundle_test.go +++ b/bindings/megapool/proof-bundle_test.go @@ -72,10 +72,6 @@ func TestEncodeFinalBalanceProofBundleV2(t *testing.T) { NextWithdrawalIndex: 9, Witnesses: [][32]byte{{0x66}}, }, - ValidatorBalanceProof{ - BalanceChunk: [32]byte{0x77}, - Witnesses: [][32]byte{{0x88}}, - }, ) if err != nil { t.Fatalf("encode: %v", err) diff --git a/shared/services/megapools.go b/shared/services/megapools.go index d06eecbe7..457972c98 100644 --- a/shared/services/megapools.go +++ b/shared/services/megapools.go @@ -1282,13 +1282,6 @@ func getGloasFinalBalanceProofBundle(bc beacon.Client, ec withdrawalExecutionCli if err != nil { return nil, nil, err } - balanceLeafProof, balanceChunk, err := gloasWithdrawalState.ProveValidatorBalanceChunk(validatorIndex) - if err != nil { - return nil, nil, err - } - if !gloas.IsZeroValidatorBalance(balanceChunk, validatorIndex) { - return nil, nil, fmt.Errorf("validator %d balance chunk is not zero at withdrawal slot %d", validatorIndex, withdrawalSlot) - } previousSlot := withdrawalSlot - 1 nextWithdrawalIndex, nextWithdrawalIndexLeafProof, err := proveNextWithdrawalIndex(previousState) @@ -1344,10 +1337,6 @@ func getGloasFinalBalanceProofBundle(bc beacon.Client, ec withdrawalExecutionCli NextWithdrawalIndex: nextWithdrawalIndex, Witnesses: ConvertToFixedSize(concatProofs(nextWithdrawalIndexLeafProof, previousPastRoot, blockHeaderProof)), }, - megapool.ValidatorBalanceProof{ - BalanceChunk: balanceChunk, - Witnesses: ConvertToFixedSize(concatProofs(balanceLeafProof, withdrawalPastRoot, blockHeaderProof)), - }, ) if err != nil { return nil, nil, err diff --git a/shared/types/eth2/fork/gloas/gloas_proofs_test.go b/shared/types/eth2/fork/gloas/gloas_proofs_test.go index 0dad405e9..a5c07d718 100644 --- a/shared/types/eth2/fork/gloas/gloas_proofs_test.go +++ b/shared/types/eth2/fork/gloas/gloas_proofs_test.go @@ -405,38 +405,6 @@ func TestProveNextWithdrawalIndex(t *testing.T) { } } -func TestProveValidatorBalanceChunk(t *testing.T) { - state := minimalBeaconState() - state.Balances = []uint64{1, 0, 3, 4, 5} - - _, chunk, err := state.ProveValidatorBalanceChunk(1) - if err != nil { - t.Fatalf("ProveValidatorBalanceChunk: %v", err) - } - if !IsZeroValidatorBalance(chunk, 1) { - t.Fatal("expected validator 1 lane to be zero") - } - if IsZeroValidatorBalance(chunk, 0) { - t.Fatal("expected validator 0 lane to be non-zero") - } - - stateTree, err := generic.SSZ.GetTree(state) - if err != nil { - t.Fatalf("GetTree: %v", err) - } - direct, err := stateTree.Prove(int(GetGeneralizedIndexForBalanceChunk(1))) - if err != nil { - t.Fatalf("direct Prove: %v", err) - } - if ok, err := treeproof.VerifyProof(stateTree.Hash(), direct); err != nil || !ok { - t.Fatalf("verify balance chunk: ok=%v err=%v", ok, err) - } - - if _, _, err := state.ProveValidatorBalanceChunk(uint64(len(state.Balances))); err == nil { - t.Fatal("expected out-of-bounds error") - } -} - func TestHistoricalBoundarySplit(t *testing.T) { const w uint64 = 100 proofSlot := w + generic.SlotsPerHistoricalRoot