func ValidateVoteExtensions(
	ctx sdk.Context,
	valStore ValidatorStore,
	height int64,
	chainID string,
	extCommit cometabci.ExtendedCommitInfo,
) error {
	// ...

	var (
		// Total voting power of all validators in current validator store.
		totalVP int64
		// Total voting power of all validators that submitted valid vote extensions.
		sumVP int64
	)

	totalBondedTokens, err := valStore.TotalBondedTokens(ctx)
	if err != nil {
		return err
	}
	totalVP = totalBondedTokens.Int64()

	for _, vote := range extCommit.Votes {
		valConsAddr := sdk.ConsAddress(vote.Validator.Address)
		power, err := valStore.GetPowerByConsAddr(ctx, valConsAddr)
		if err != nil {
			// return fmt.Errorf("failed to get validator %X power: %w", valConsAddr, err)

			// use only current validator set, so ignore if the validator of the vote is not in the set.
			continue
		}

		// snip... (unrelated code)

		sumVP += power.Int64()
	}

	// This check is probably unnecessary, but better safe than sorry.
	if totalVP <= 0 {
		return fmt.Errorf("total voting power must be positive, got: %d", totalVP)
	}

	// If the sum of the voting power has not reached (2/3 + 1) we need to error.
	if requiredVP := ((totalVP * 2) / 3) + 1; sumVP < requiredVP {
		return fmt.Errorf(
			"insufficient cumulative voting power received to verify vote extensions; got: %d, expected: >=%d",
			sumVP, requiredVP,
		)
	}

	return nil
}
	func ValidateVoteExtensions(
		ctx sdk.Context,
		valStore ValidatorStore,
		height int64,
		chainID string,
		extCommit cometabci.ExtendedCommitInfo,
	) error {
		// ...

		totalBondedTokens, err := valStore.TotalBondedTokens(ctx)
		if err != nil {
			return err
		}
		totalVP = totalBondedTokens.Int64()

+		seenValidators := make(map[string]bool)

		for _, vote := range extCommit.Votes {
+			if seenValidators[vote.Validator.String()] {
+				return fmt.Errorf("duplicate vote for validator %s", vote.Validator.String())
+			}
+			seenValidators[vote.Validator.String()] = true

			// ...
		}

		// ...
	}
