Skip to content

Commit

Permalink
Add input check
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianst committed Dec 18, 2024
1 parent be1e4f5 commit 3141303
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tasks/sep/026-fp-holocene-upgrade-fix/NestedSignFromJson.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity ^0.8.15;

import {console2 as console} from "forge-std/console2.sol";
import {Vm} from "forge-std/Vm.sol";
import {stdJson} from "forge-std/StdJson.sol";
import {Simulation} from "@base-contracts/script/universal/Simulation.sol";
import {NestedSignFromJson as OriginalNestedSignFromJson} from "script/NestedSignFromJson.s.sol";
import {DisputeGameUpgrade} from "script/verification/DisputeGameUpgrade.s.sol";
Expand All @@ -17,6 +18,25 @@ contract NestedSignFromJson is OriginalNestedSignFromJson, CouncilFoundationNest
0xb51baD2d9Da9f94d6A4A5A493Ae6469005611B68 // permissionedDisputeGame
) {}

function setUp() public view {
checkInput();
}

function checkInput() public view {
string memory inputJson;
string memory path = "/tasks/sep/026-fp-holocene-upgrade-fix/input.json";
try vm.readFile(string.concat(vm.projectRoot(), path)) returns (string memory data) {
inputJson = data;
} catch {
revert(string.concat("Failed to read ", path));
}

address inputPermissionedDisputeGame = stdJson.readAddress(inputJson, "$.transactions[0].contractInputsValues._impl");
address inputFaultDisputeGame = stdJson.readAddress(inputJson, "$.transactions[1].contractInputsValues._impl");
require(expPermissionedDisputeGame == inputPermissionedDisputeGame, "input-pdg");
require(expFaultDisputeGame == inputFaultDisputeGame, "input-fdg");
}

function _postCheck(Vm.AccountAccess[] memory accesses, Simulation.Payload memory) internal view override {
console.log("Running post-deploy assertions");
checkStateDiff(accesses);
Expand Down

0 comments on commit 3141303

Please sign in to comment.