Skip to content

Commit

Permalink
feat: checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
0xDiscotech committed Aug 9, 2024
1 parent cfb3f68 commit 6e0a27a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/contracts-bedrock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"gas-snapshot": "pnpm build:go-ffi && pnpm gas-snapshot:no-build",
"kontrol-summary": "./test/kontrol/scripts/make-summary-deployment.sh",
"kontrol-summary-fp": "KONTROL_FP_DEPLOYMENT=true pnpm kontrol-summary",
"medusa":"FOUNDRY_PROFILE=medusa medusa fuzz",
"medusa": "FOUNDRY_PROFILE=medusa medusa fuzz",
"snapshots": "forge build && npx tsx scripts/autogen/generate-snapshots.ts && pnpm kontrol-summary-fp && pnpm kontrol-summary",
"snapshots:check": "./scripts/checks/check-snapshots.sh",
"semver-lock": "forge script scripts/SemverLock.s.sol",
Expand Down Expand Up @@ -62,6 +62,7 @@
"eslint-plugin-jsdoc": "^48.8.3",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^4.0.0",
"halmos-cheatcodes#c0d8655": "github:a16z/halmos-cheatcodes#c0d8655",
"prettier": "^2.8.0",
"tsx": "^4.16.2",
"typescript": "^5.5.4"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import { Test } from "forge-std/Test.sol";

import { SuperchainERC20Factory } from "src/L2/SuperchainERC20Factory.sol";
import { SymTest } from "halmos-cheatcodes/SymTest.sol";

interface IHevm {
function chainid() external view returns (uint256);
}

contract HalmosTest is SymTest, Test { }

contract SuperchainERC20Factory_SymbTest is Test {
struct DeployParams {
address remoteToken;
string name;
string symbol;
uint8 decimals;
}

SuperchainERC20Factory internal factory;
IHevm hevm = IHevm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);

constructor() {
factory = new SuperchainERC20Factory();
}

// this is a stateless check, so halmos will probably supersede it
function check_contractAddressDependsOnParams(DeployParams memory left, DeployParams memory right) external {
require(
left.remoteToken != right.remoteToken || keccak256(bytes(left.name)) != keccak256(bytes(right.name))
|| keccak256(bytes(left.symbol)) != keccak256(bytes(right.symbol)) || left.decimals != right.decimals
);
address superc20Left = factory.deploy(left.remoteToken, left.name, left.symbol, left.decimals);
address superc20Right = factory.deploy(right.remoteToken, right.name, right.symbol, right.decimals);
assert(superc20Left != superc20Right);
}

// function check_contractAddressDoesNotDependOnChainId(
// DeployParams memory params,
// uint256 chainIdLeft,
// uint256 chainIdRight
// )
// external
// {
// vm.chainId(chainIdLeft);
// address superc20Left = factory.deploy(params.remoteToken, params.name, params.symbol, params.decimals);
// vm.chainId(chainIdRight);
// address superc20Right = factory.deploy(params.remoteToken, params.name, params.symbol, params.decimals);
// assert(superc20Left == superc20Right);
// }
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6e0a27a

Please sign in to comment.