Skip to content

Commit

Permalink
fix: added input validation for executionThreshold (OZ L-01)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maikol committed Feb 1, 2024
1 parent 1ad7935 commit fbdf6af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ contract SubgraphAvailabilityManager is Governed {
_executionThreshold >= NUM_ORACLES.div(2).add(1),
"SAM: executionThreshold too low"
);
require(_executionThreshold <= NUM_ORACLES, "SAM: executionThreshold too high");

// Oracles should not be address zero
for (uint256 i = 0; i < _oracles.length; i++) {
Expand Down
9 changes: 9 additions & 0 deletions packages/contracts/test/rewards/subgraphAvailability.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ describe('SubgraphAvailabilityManager', () => {
}),
).to.be.revertedWith('SAM: executionThreshold too low')
})

it('should revert if executionThreshold is too high', async () => {
await expect(
deploy(DeployType.Deploy, governor, {
name: 'SubgraphAvailabilityManager',
args: [governor.address, rewardsManager.address, '6', voteTimeLimit, oracles],
}),
).to.be.revertedWith('SAM: executionThreshold too high')
})
})

describe('initializer', () => {
Expand Down

0 comments on commit fbdf6af

Please sign in to comment.