Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 0.9.5 Early Epoch End #206

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions contracts/ConnectivityTrackerHbbft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ contract ConnectivityTrackerHbbft is
return _reporters[epoch][validator].length();
}

/// @dev Returns true if the specified validator was reported by the specified reporter at the given epoch.
function isReported(
uint256 epoch,
address validator,
address reporter
) external view returns (bool) {
return _reporters[currentEpoch()][validator].contains(reporter);
}

function checkReportMissingConnectivityCallable(
address caller,
address validator,
Expand Down Expand Up @@ -219,15 +228,22 @@ contract ConnectivityTrackerHbbft is
}
}

function countFaultyValidators(uint256 epoch)
public view returns (uint256) {
return _countFaultyValidators(epoch);
}

function _countFaultyValidators(
uint256 epoch
) private view returns (uint256) {
address[] memory flaggedValidators = getFlaggedValidators();

uint256 unflaggedValidatorsCount = validatorSetContract
.getCurrentValidatorsCount() - flaggedValidators.length;
.getCurrentValidatorsCount() - flaggedValidators.length; // 16 - 4 = 12



uint256 reportersThreshold = (unflaggedValidatorsCount * 2) / 3 + 1;
uint256 reportersThreshold = (2 * unflaggedValidatorsCount) / 3 + 1; // 24 / 3 + 1 = 9
uint256 result = 0;

for (uint256 i = 0; i < flaggedValidators.length; ++i) {
Expand Down
Loading