diff --git a/contracts/src/BeefyClient.sol b/contracts/src/BeefyClient.sol index eeb27bfc42..1ed214d7f9 100644 --- a/contracts/src/BeefyClient.sol +++ b/contracts/src/BeefyClient.sol @@ -253,7 +253,7 @@ contract BeefyClient { signatureUsageCount = currentValidatorSet.usageCounters.get(proof.index); currentValidatorSet.usageCounters.set(proof.index, signatureUsageCount.saturatingAdd(1)); vset = currentValidatorSet; - } else if (commitment.validatorSetID == nextValidatorSet.id) { + } else if (commitment.validatorSetID >= nextValidatorSet.id) { signatureUsageCount = nextValidatorSet.usageCounters.get(proof.index); nextValidatorSet.usageCounters.set(proof.index, signatureUsageCount.saturatingAdd(1)); vset = nextValidatorSet; @@ -345,7 +345,7 @@ contract BeefyClient { bool is_next_session = false; ValidatorSetState storage vset; - if (commitment.validatorSetID == nextValidatorSet.id) { + if (commitment.validatorSetID > currentValidatorSet.id) { is_next_session = true; vset = nextValidatorSet; } else if (commitment.validatorSetID == currentValidatorSet.id) { @@ -359,7 +359,7 @@ contract BeefyClient { bytes32 newMMRRoot = ensureProvidesMMRRoot(commitment); if (is_next_session) { - if (leaf.nextAuthoritySetID != nextValidatorSet.id + 1) { + if (leaf.nextAuthoritySetID <= nextValidatorSet.id) { revert InvalidMMRLeaf(); } bool leafIsValid =