Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Sep 10, 2024
1 parent 2a43247 commit 76e6380
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 29 deletions.
10 changes: 2 additions & 8 deletions contracts/test/Upgrade.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ contract UpgradeTest is Test, Utils {
config.startingTimestamp = exampleTimestamp;
ZKL2OutputOracle l2oo = ZKL2OutputOracle(deployWithConfig(config));

assertEq(
l2oo.getL2Output(l2oo.latestOutputIndex()).outputRoot,
exampleOutputRoot
);
assertEq(
l2oo.getL2Output(l2oo.latestOutputIndex()).timestamp,
exampleTimestamp
);
assertEq(l2oo.getL2Output(l2oo.latestOutputIndex()).outputRoot, exampleOutputRoot);
assertEq(l2oo.getL2Output(l2oo.latestOutputIndex()).timestamp, exampleTimestamp);
}
}
32 changes: 11 additions & 21 deletions contracts/test/helpers/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,18 @@ contract Utils is Test, JSONDecoder {
return cfg.l2OutputOracleProxy;
}

function upgradeAndInitialize(
address impl,
Config memory cfg,
address _spoofedAdmin
) public {
function upgradeAndInitialize(address impl, Config memory cfg, address _spoofedAdmin) public {
// require that the verifier gateway is deployed
require(
address(cfg.verifierGateway).code.length > 0,
"ZKUpgrader: verifier gateway not deployed"
);
require(address(cfg.verifierGateway).code.length > 0, "ZKUpgrader: verifier gateway not deployed");

ZKL2OutputOracle.ZKInitParams memory zkInitParams = ZKL2OutputOracle
.ZKInitParams({
chainId: cfg.chainId,
verifierGateway: cfg.verifierGateway,
vkey: cfg.vkey,
owner: cfg.owner,
startingOutputRoot: cfg.startingOutputRoot,
rollupConfigHash: cfg.rollupConfigHash
});
ZKL2OutputOracle.ZKInitParams memory zkInitParams = ZKL2OutputOracle.ZKInitParams({
chainId: cfg.chainId,
verifierGateway: cfg.verifierGateway,
vkey: cfg.vkey,
owner: cfg.owner,
startingOutputRoot: cfg.startingOutputRoot,
rollupConfigHash: cfg.rollupConfigHash
});

// If we are spoofing the admin (used in testing), start prank.
if (_spoofedAdmin != address(0)) vm.startPrank(_spoofedAdmin);
Expand All @@ -65,9 +57,7 @@ contract Utils is Test, JSONDecoder {
}

// Read the config from the json file.
function readJson(
string memory filepath
) public view returns (Config memory) {
function readJson(string memory filepath) public view returns (Config memory) {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/", filepath);
string memory json = vm.readFile(path);
Expand Down

0 comments on commit 76e6380

Please sign in to comment.