Skip to content

Commit

Permalink
Merge pull request #935 from graphprotocol/mde/pr935-fix-oz-l-01
Browse files Browse the repository at this point in the history
fix: added input validation for executionThreshold (OZ L-01)
  • Loading branch information
Maikol authored Feb 20, 2024
2 parents 1ad7935 + fbdf6af commit 9562b28
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 9562b28

Please sign in to comment.