Skip to content

Commit

Permalink
Fix for boundary update
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Jun 1, 2024
1 parent 40f9592 commit c11ed7d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contracts/src/BeefyClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ contract BeefyClient {

ValidatorSetState storage vset;
uint16 signatureUsageCount;
if (commitment.validatorSetID == currentValidatorSet.id) {
if (commitment.validatorSetID == currentValidatorSet.id || commitment.validatorSetID == nextValidatorSet.id - 1)
{
signatureUsageCount = currentValidatorSet.usageCounters.get(proof.index);
currentValidatorSet.usageCounters.set(proof.index, signatureUsageCount.saturatingAdd(1));
vset = currentValidatorSet;
Expand Down Expand Up @@ -354,11 +355,12 @@ contract BeefyClient {

bool is_next_session = false;
ValidatorSetState storage vset;
if (commitment.validatorSetID > currentValidatorSet.id) {
if (commitment.validatorSetID == currentValidatorSet.id || commitment.validatorSetID == nextValidatorSet.id - 1)
{
vset = currentValidatorSet;
} else if (commitment.validatorSetID >= nextValidatorSet.id) {
is_next_session = true;
vset = nextValidatorSet;
} else if (commitment.validatorSetID == currentValidatorSet.id) {
vset = currentValidatorSet;
} else {
revert InvalidCommitment();
}
Expand Down

0 comments on commit c11ed7d

Please sign in to comment.