Skip to content
Business logic Audit finding Intermediate

Removing an observer doesn't update an active ballot's voter list, leading to deadlocks

Active ballots snapshot the observer set into a fixed voter list and require a percentage of that list to vote. When observers are later removed from the set through slashing or unbonding, they stay in the ballot's voter list, so the remaining voters can no longer reach the threshold and the ballot stays in progress forever.

0xAlix2 Follow with BrothersInCode

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-04-zetachain-cross-chain-judging/issues/190

This issue has been acknowledged by the team but won't be fixed at this time.

Found by

0xAlix2, BrothersInCode

Summary

When a ballot is initialized for voting, it takes a snapshot of the active observers and adds them to the voter list, along with recording the chain threshold, meaning X% of the voter list must vote to finalize the ballot.
https://github.com/sherlock-audit/2025-04-zetachain-cross-chain/blob/main/node/x/observer/keeper/voting.go#L62-L92:

Go
ballot = types.Ballot{
	Index:                "",
	BallotIdentifier:     index,
	VoterList:            observerSet.ObserverList,
	Votes:                types.CreateVotes(len(observerSet.ObserverList)),
	ObservationType:      observationType,
	BallotThreshold:      cp.BallotThreshold,
	BallotStatus:         types.BallotStatus_BallotInProgress,
	BallotCreationHeight: ctx.BlockHeight(),
}

Any observers who are not included in the above voter list are not allowed to vote on the ballot, as the vote will be rejected in AddVote.

Later, when observers are removed due to slashing or unbonding (via hooks in node/x/observer/keeper/hooks.go), they are only removed from the observer set but not from the voter lists of active ballots.
https://github.com/sherlock-audit/2025-04-zetachain-cross-chain/blob/main/node/x/observer/keeper/hooks.go#L104-L106:

Go
func (k Keeper) CleanSlashedValidator(
	ctx context.Context,
	valAddress sdk.ValAddress,
	fraction sdkmath.LegacyDec,
) error {
	// ... snip ...
	if resultingTokens.LT(mindelegation) {
		k.RemoveObserverFromSet(sdkCtx, accAddress.String())
	}
	return nil
}

https://github.com/sherlock-audit/2025-04-zetachain-cross-chain/blob/main/node/x/observer/keeper/hooks.go#L117:

Go
func (k Keeper) CleanObservers(ctx context.Context, valAddress sdk.ValAddress) error {
	// ... snip ...
	k.RemoveObserverFromSet(sdkCtx, accAddress.String())
	return nil
}

If enough observers are removed, the number of available voters might drop below the threshold needed to finalize the ballot, making it impossible to ever reach the required vote count, effectively deadlocking the active ballots.

NB:
This issue also exists for TSS votes: a TSS ballot expects 100% of the node accounts to vote.
If any node account is updated after the ballot has been created, the ballot cannot be finalized anymore, similarly getting stuck forever.

Root Cause

When an observer is removed from the observer set during an active ballot, the ballot's voter list is not updated accordingly. Since ballots expect a threshold of successful votes based on the original voter set size, removing observers (due to slashing or undelegation) can make it mathematically impossible to meet the threshold, causing the ballot to remain stuck and never finalize.

Internal Pre-conditions

  • A ballot is in progress (BallotStatus = BallotInProgress).
  • One or more voters in the ballot are later removed from the observer set (e.g., delegation drops below minimum).
  • Ballot threshold is based on the original number of voters.

External Pre-conditions

  • Delegators or slashing mechanisms cause an observer's self-delegation to fall below the minimum delegation threshold.
  • The observer set gets updated, but ballots referencing old observers are not updated.

Attack Path

  1. A ballot is created with an initial set of N observers.
  2. Some observers lose their self-delegation or are slashed and removed from the observer set.
  3. Because the ballot's VoterList is static and not updated, votes from the removed observers are still required.
  4. Remaining active observers can never reach the ballot's quorum.
  5. The ballot remains stuck indefinitely in BallotInProgress.

Impact

Ballots can get stuck forever, causing operational deadlocks, and all protocols depending on successful ballot finalization (e.g., blame handling, inbound/outbound tx validation) could freeze.

PoC

Add the following in node/x/observer/keeper/voting_test.go:

Go
func TestRemovedObserverDeadlock(t *testing.T) {
	k, ctx, sdkk, _ := keepertest.ObserverKeeper(t)

	// Create 5 observers
	r := rand.New(rand.NewSource(10))
	observers := make([]stakingtypes.Validator, 5)
	accAddrs := make([]string, 5)

	for i := range 5 {
		validator := sample.Validator(t, r)
		validator.DelegatorShares = sdkmath.LegacyNewDec(1)
		validator.Tokens = sdkmath.NewInt(1)
		sdkk.StakingKeeper.SetValidator(ctx, validator)

		accAddr, err := types.GetAccAddressFromOperatorAddress(validator.OperatorAddress)
		require.NoError(t, err)

		minDelegation, err := types.GetMinObserverDelegationDec()
		require.NoError(t, err)

		sdkk.StakingKeeper.SetDelegation(ctx, stakingtypes.Delegation{
			DelegatorAddress: accAddr.String(),
			ValidatorAddress: validator.GetOperator(),
			Shares:           minDelegation,
		})

		observers[i] = validator
		accAddrs[i] = accAddr.String()
	}

	// Set all 5 as observers
	k.SetObserverSet(ctx, types.ObserverSet{ObserverList: accAddrs})

	threshold, err := sdkmath.LegacyNewDecFromStr("0.75")
	require.NoError(t, err)

	// Set ChainParams
	chainID := getValidEthChainIDWithIndex(t, 0)
	k.SetChainParamsList(ctx, types.ChainParamsList{
		ChainParams: []*types.ChainParams{
			{
				ChainId:         chainID,
				IsSupported:     true,
				BallotThreshold: threshold,
			},
		},
	})
	index := sample.ZetaIndex(t)

	msgServer := keeper.NewMsgServerImpl(*k)

	// Observer 0 initiates a vote blame
	msg := &types.MsgVoteBlame{
		Creator:   accAddrs[0],
		ChainId:   chainID,
		BlameInfo: types.Blame{Index: index},
	}
	_, err = msgServer.VoteBlame(ctx, msg)
	require.NoError(t, err)

	// Simulate observer1 losing delegation — set delegation to 0
	sdkk.StakingKeeper.SetDelegation(ctx, stakingtypes.Delegation{
		DelegatorAddress: accAddrs[1],
		ValidatorAddress: observers[1].GetOperator(),
		Shares:           sdkmath.LegacyZeroDec(),
	})
	// Remove observer1 from ObserverSet
	err = k.CheckObserverSelfDelegation(ctx, accAddrs[1])
	require.NoError(t, err)

	// Simulate observer2 losing delegation — set delegation to 0
	sdkk.StakingKeeper.SetDelegation(ctx, stakingtypes.Delegation{
		DelegatorAddress: accAddrs[2],
		ValidatorAddress: observers[2].GetOperator(),
		Shares:           sdkmath.LegacyZeroDec(),
	})
	// Remove observer2 from ObserverSet
	err = k.CheckObserverSelfDelegation(ctx, accAddrs[2])
	require.NoError(t, err)

	// Observer 3 and 4 can't vote blame
	_, err = msgServer.VoteBlame(ctx, &types.MsgVoteBlame{
		Creator:   accAddrs[3], // active observers
		ChainId:   chainID,
		BlameInfo: types.Blame{Index: index},
	})
	require.NoError(t, err)

	_, err = msgServer.VoteBlame(ctx, &types.MsgVoteBlame{
		Creator:   accAddrs[4], // active observers
		ChainId:   chainID,
		BlameInfo: types.Blame{Index: index},
	})
	require.NoError(t, err)

	// Observers 1 and 2 can't vote blame
	_, err = msgServer.VoteBlame(ctx, &types.MsgVoteBlame{
		Creator:   accAddrs[1], // non-active observers
		ChainId:   chainID,
		BlameInfo: types.Blame{Index: index},
	})
	require.Error(t, err)

	_, err = msgServer.VoteBlame(ctx, &types.MsgVoteBlame{
		Creator:   accAddrs[2], // non-active observers
		ChainId:   chainID,
		BlameInfo: types.Blame{Index: index},
	})
	require.Error(t, err)

	// At this point the success percentage is 3/5 = 0.6
	// While the threshold is 0.75, so the threshold will never be reached

	ballot, found := k.GetBallot(ctx, msg.Digest())
	require.True(t, found)
	require.Equal(t, types.BallotStatus_BallotInProgress, ballot.BallotStatus)
}

This PoC shows that after removing two observers mid-ballot, the threshold can no longer be reached, and the ballot remains stuck in BallotInProgress.

Mitigation

When removing an observer from the observer set (e.g., during self-delegation checks or slashing events), the system should update all active ballots to also remove the observer from their VoterList.

The original report as published on Sherlock, by 0xAlix2. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

When an observer is removed from the observer set, the voter lists of already-active ballots are not updated, so the threshold is still calculated against the original, larger voter set.

Impact

Ballots can get stuck forever, causing operational deadlocks, and all protocols depending on successful ballot finalization (e.g., blame handling, inbound/outbound tx validation) could freeze.

What the attacker needed

A ballot already in progress; an observer removed mid-ballot; threshold based on original voter count

The fix

When an observer is removed from the observer set, the system should also remove that observer from the voter list of every active ballot.

How it was found

  1. Create a ballot with an initial set of observers.
  2. Remove one or more of those observers from the observer set, for example by dropping their delegation below the minimum.
  3. Have the remaining active observers vote on the ballot.
  4. Observe that the removed observers cannot vote and the remaining votes fall short of the threshold, leaving the ballot in progress.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A ballot is a vote that needs a certain share of a fixed group of voters to agree before it can finish. The group is copied when the vote starts, but if some members are later kicked out, they are still counted in the total, so the remaining members can never reach the required share. The vote then hangs forever.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0xAlix2

View all

39 more disclosed reports, best first.

More from ZetaChain Cross-Chain

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.