Skip to content

Commit 26f1c7a

Browse files
committed
fix: change mapping for an array to make storage cheaper
1 parent 48ffb3a commit 26f1c7a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/contracts/contracts/rewards/SubgraphAvailabilityManager.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ contract SubgraphAvailabilityManager is Governed {
4343

4444
/// @notice Mapping of current nonce to subgraph deployment ID to oracle index to timestamp of last deny vote
4545
/// currentNonce => subgraphDeploymentId => oracleIndex => timestamp
46-
mapping(uint256 => mapping(bytes32 => mapping(uint256 => uint256))) public lastDenyVote;
46+
mapping(uint256 => mapping(bytes32 => uint256[NUM_ORACLES])) public lastDenyVote;
4747

4848
/// @notice Mapping of current nonce to subgraph deployment ID to oracle index to timestamp of last allow vote
4949
/// currentNonce => subgraphDeploymentId => oracleIndex => timestamp
50-
mapping(uint256 => mapping(bytes32 => mapping(uint256 => uint256))) public lastAllowVote;
50+
mapping(uint256 => mapping(bytes32 => uint256[NUM_ORACLES])) public lastAllowVote;
5151

5252
// -- Events --
5353

@@ -195,7 +195,7 @@ contract SubgraphAvailabilityManager is Governed {
195195
uint256 timestamp = block.timestamp;
196196

197197
// corresponding votes based on _deny for a subgraph deployment
198-
mapping(uint256 => uint256) storage lastVoteForSubgraph = _deny
198+
uint256[NUM_ORACLES] storage lastVoteForSubgraph = _deny
199199
? lastDenyVote[currentNonce][_subgraphDeploymentID]
200200
: lastAllowVote[currentNonce][_subgraphDeploymentID];
201201
lastVoteForSubgraph[_oracleIndex] = timestamp;
@@ -222,7 +222,7 @@ contract SubgraphAvailabilityManager is Governed {
222222
uint256 voteTimeValidity = block.timestamp - voteTimeLimit;
223223

224224
// corresponding votes based on _deny for a subgraph deployment
225-
mapping(uint256 => uint256) storage lastVoteForSubgraph = _deny
225+
uint256[NUM_ORACLES] storage lastVoteForSubgraph = _deny
226226
? lastDenyVote[currentNonce][_subgraphDeploymentID]
227227
: lastAllowVote[currentNonce][_subgraphDeploymentID];
228228

0 commit comments

Comments
 (0)