Skip to content

Commit

Permalink
fix: update based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed May 11, 2024
1 parent b85afee commit a6f7888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions contracts/v0.2/src/SubmissionProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,9 @@ contract SubmissionProxy is Ownable {
* @param _threshold The threshold
* @return The quorum
*/
function quorum(uint8 _threshold) internal view returns (uint8) {
function quorum(uint8 _threshold) internal view returns (uint256) {
uint256 nominator = oracles.length * _threshold;
return uint8((nominator / 100) + (nominator % 100 == 0 ? 0 : 1));
return (nominator / 100) + (nominator % 100 == 0 ? 0 : 1);
}

/**
Expand All @@ -514,14 +514,14 @@ contract SubmissionProxy is Ownable {
return false;
}

uint8 verifiedSignatures_ = 0;
uint256 verifiedSignatures_ = 0;
uint256 lastIndex_ = 0;

uint8 threshold_ = thresholds[_feedHash];
if (threshold_ == 0) {
threshold_ = defaultThreshold;
}
uint8 requiredSignatures_ = quorum(threshold_);
uint256 requiredSignatures_ = quorum(threshold_);

uint256 proofsLength_ = _proofs.length;
for (uint256 j = 0; j < proofsLength_; j++) {
Expand Down
8 changes: 4 additions & 4 deletions contracts/v0.2/test/SubmissionProxyMock.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Feed} from "../src/Feed.sol";
import {IFeed} from "../src/interfaces/IFeed.sol";

contract SubmissionProxyMock is SubmissionProxy {
function callQuorum(uint8 _threshold) external view returns (uint8) {
function callQuorum(uint8 _threshold) external view returns (uint256) {
return quorum(_threshold);
}

Expand All @@ -31,7 +31,7 @@ contract SubmissionProxyMockTest is Test {
function test_QuorumWithOneOracle() public {
submissionProxy.addOracle(makeAddr("zero"));

uint8 quorum_ = submissionProxy.callQuorum(1);
uint256 quorum_ = submissionProxy.callQuorum(1);
assertEq(quorum_, 1);

quorum_ = submissionProxy.callQuorum(100);
Expand All @@ -42,7 +42,7 @@ contract SubmissionProxyMockTest is Test {
submissionProxy.addOracle(makeAddr("zero"));
submissionProxy.addOracle(makeAddr("one"));

uint8 quorum_ = submissionProxy.callQuorum(1);
uint256 quorum_ = submissionProxy.callQuorum(1);
assertEq(quorum_, 1);

quorum_ = submissionProxy.callQuorum(50);
Expand All @@ -61,7 +61,7 @@ contract SubmissionProxyMockTest is Test {
submissionProxy.addOracle(makeAddr("one"));
submissionProxy.addOracle(makeAddr("two"));

uint8 quorum_ = submissionProxy.callQuorum(1);
uint256 quorum_ = submissionProxy.callQuorum(1);
assertEq(quorum_, 1);

quorum_ = submissionProxy.callQuorum(33);
Expand Down

0 comments on commit a6f7888

Please sign in to comment.