Skip to content

Commit 9562b28

Browse files
authored
Merge pull request #935 from graphprotocol/mde/pr935-fix-oz-l-01
fix: added input validation for executionThreshold (OZ L-01)
2 parents 1ad7935 + fbdf6af commit 9562b28

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/contracts/contracts/rewards/SubgraphAvailabilityManager.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ contract SubgraphAvailabilityManager is Governed {
103103
_executionThreshold >= NUM_ORACLES.div(2).add(1),
104104
"SAM: executionThreshold too low"
105105
);
106+
require(_executionThreshold <= NUM_ORACLES, "SAM: executionThreshold too high");
106107

107108
// Oracles should not be address zero
108109
for (uint256 i = 0; i < _oracles.length; i++) {

packages/contracts/test/rewards/subgraphAvailability.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ describe('SubgraphAvailabilityManager', () => {
151151
}),
152152
).to.be.revertedWith('SAM: executionThreshold too low')
153153
})
154+
155+
it('should revert if executionThreshold is too high', async () => {
156+
await expect(
157+
deploy(DeployType.Deploy, governor, {
158+
name: 'SubgraphAvailabilityManager',
159+
args: [governor.address, rewardsManager.address, '6', voteTimeLimit, oracles],
160+
}),
161+
).to.be.revertedWith('SAM: executionThreshold too high')
162+
})
154163
})
155164

156165
describe('initializer', () => {

0 commit comments

Comments
 (0)