Skip to content

Commit

Permalink
Remove transient storage and downgrade solidity version
Browse files Browse the repository at this point in the history
  • Loading branch information
prateek105 committed Jun 5, 2024
1 parent 430f4db commit cbccdb8
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/proposals/Proposal.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity =0.8.25;
pragma solidity ^0.8.0;

import {Test} from "@forge-std/Test.sol";
import {VmSafe} from "@forge-std/Vm.sol";
Expand Down Expand Up @@ -205,19 +205,20 @@ abstract contract Proposal is Test, Script, IProposal {
uint256 value,
bytes memory data
) internal virtual {
// uses transition storage to check for duplicate actions
bytes32 actionHash = keccak256(abi.encodePacked(target, value, data));

uint256 found;

assembly {
found := tload(actionHash)
}

require(found == 0, "Duplicated action found");
uint256 actionsLength = actions.length;
for (uint256 i = 0; i < actionsLength; i++) {
// Check if the target, arguments and value matches with other exciting actions.
bool isDuplicateTarget = actions[i].target == target;
bool isDuplicateArguments = keccak256(actions[i].arguments) ==
keccak256(data);
bool isDuplicateValue = actions[i].value == value;

assembly {
tstore(actionHash, 1)
require(
!(isDuplicateTarget &&
isDuplicateArguments &&
isDuplicateValue),
"Duplicated action found"
);
}
}

Expand Down

0 comments on commit cbccdb8

Please sign in to comment.