Skip to content

Commit

Permalink
Remove transient storage and downgrade solidity version (#75)
Browse files Browse the repository at this point in the history
* Remove transient storage and downgrade solidity version

* remove evm version
  • Loading branch information
prateek105 authored Jun 5, 2024
1 parent 430f4db commit 42c5165
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ auto_detect_solc = true
fs_permissions = [{ access = "read", path = "./"}]
optimizer = true
optimizer_runs = 200
evm_version="Cancun"

[rpc_endpoints]
localhost = "http://127.0.0.1:8545"
Expand Down
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 42c5165

Please sign in to comment.