Skip to content

Commit

Permalink
Update foundry
Browse files Browse the repository at this point in the history
  • Loading branch information
jbearer committed Dec 12, 2023
1 parent 39a0689 commit 76c686d
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 93 deletions.
6 changes: 3 additions & 3 deletions flake.lock

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

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@
permittedInsecurePackages = [ "nodejs-16.20.2" ];
};
};
# nixWithFlakes allows pre v2.4 nix installations to use
# flake commands (like `nix flake update`)
nixWithFlakes = pkgs.writeShellScriptBin "nix" ''
exec ${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@"
'';
in
{
devShells.default = pkgs.mkShell {
COMPOSE_DOCKER_CLI_BUILD=1;
DOCKER_BUILDKIT=1;
packages = with pkgs; [
nixWithFlakes
go
# goimports, godoc, etc.
gotools
Expand Down
32 changes: 8 additions & 24 deletions packages/contracts-bedrock/scripts/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ contract Deploy is Deployer {

/// @notice Deploy the ProxyAdmin
function deployProxyAdmin() public broadcast returns (address addr_) {
ProxyAdmin admin = new ProxyAdmin({
_owner: msg.sender
});
ProxyAdmin admin = new ProxyAdmin({ _owner: msg.sender });
require(admin.owner() == msg.sender);

AddressManager addressManager = AddressManager(mustGetAddress("AddressManager"));
Expand Down Expand Up @@ -241,9 +239,7 @@ contract Deploy is Deployer {
/// @notice Deploy the L2OutputOracleProxy
function deployL2OutputOracleProxy() public broadcast returns (address addr_) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
Proxy proxy = new Proxy({ _admin: proxyAdmin });

address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
Expand Down Expand Up @@ -275,9 +271,7 @@ contract Deploy is Deployer {
/// @notice Deploy the OptimismPortalProxy
function deployOptimismPortalProxy() public broadcast returns (address addr_) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
Proxy proxy = new Proxy({ _admin: proxyAdmin });

address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
Expand All @@ -291,9 +285,7 @@ contract Deploy is Deployer {
/// @notice Deploy the OptimismMintableERC20FactoryProxy
function deployOptimismMintableERC20FactoryProxy() public broadcast returns (address addr_) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
Proxy proxy = new Proxy({ _admin: proxyAdmin });

address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
Expand All @@ -307,9 +299,7 @@ contract Deploy is Deployer {
/// @notice Deploy the L1ERC721BridgeProxy
function deployL1ERC721BridgeProxy() public broadcast returns (address addr_) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
Proxy proxy = new Proxy({ _admin: proxyAdmin });

address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
Expand All @@ -323,9 +313,7 @@ contract Deploy is Deployer {
/// @notice Deploy the SystemConfigProxy
function deploySystemConfigProxy() public broadcast returns (address addr_) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
Proxy proxy = new Proxy({ _admin: proxyAdmin });

address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
Expand All @@ -339,9 +327,7 @@ contract Deploy is Deployer {
/// @notice Deploy the DisputeGameFactoryProxy
function deployDisputeGameFactoryProxy() public onlyDevnet broadcast returns (address addr_) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
Proxy proxy = new Proxy({ _admin: proxyAdmin });

address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
Expand All @@ -355,9 +341,7 @@ contract Deploy is Deployer {
/// @notice Deploy the ProtocolVersionsProxy
function deployProtocolVersionsProxy() public broadcast returns (address addr_) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
});
Proxy proxy = new Proxy({ _admin: proxyAdmin });

address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);
Expand Down
8 changes: 2 additions & 6 deletions packages/contracts-bedrock/scripts/DeployPeriphery.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ contract DeployPeriphery is Deployer {
save("ProxyAdmin", preComputedAddress);
addr_ = preComputedAddress;
} else {
ProxyAdmin admin = new ProxyAdmin{ salt: salt }({
_owner: msg.sender
});
ProxyAdmin admin = new ProxyAdmin{ salt: salt }({ _owner: msg.sender });
require(admin.owner() == msg.sender);

save("ProxyAdmin", address(admin));
Expand All @@ -108,9 +106,7 @@ contract DeployPeriphery is Deployer {
save("FaucetProxy", preComputedAddress);
addr_ = preComputedAddress;
} else {
Proxy proxy = new Proxy{ salt: salt }({
_admin: proxyAdmin
});
Proxy proxy = new Proxy{ salt: salt }({ _admin: proxyAdmin });
address admin = address(uint160(uint256(vm.load(address(proxy), OWNER_KEY))));
require(admin == proxyAdmin);

Expand Down
4 changes: 2 additions & 2 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"src/periphery/op-nft/OptimistAllowlist.sol": "0x53e9a9dfecbae036fd468e8f34c80c7d9c35bd8908c8a6483db44dbc5128ad69",
"src/periphery/op-nft/OptimistInviter.sol": "0xfdd5b9d45205ef9372ba37f7a6394724695e676d27a47cb154ee6e4148490013",
"src/universal/OptimismMintableERC20.sol": "0x716db294648fce1bb41c5f95a20f92445f165a568886f21edd922d5c9b2cb0b5",
"src/universal/OptimismMintableERC20Factory.sol": "0xfcf2eb56777478f47f3bf2f1111aa2e3769d5ed28a6f5fceff4517683447131a",
"src/universal/OptimismMintableERC20Factory.sol": "0x552b8e7cd025ccf0cb7b41b13c93c6092f96b3c1195db8fb5f8678cb57d4baf6",
"src/universal/OptimismMintableERC721.sol": "0x4c73bf8474fa7eb091796a4db7e57bc5f26d50a3d1cfcb78d5efa47ced5ced2b",
"src/universal/OptimismMintableERC721Factory.sol": "0x935fd97018b6ef10fa813d9d43ab7a77c80885f7a8d7feb430097645cb2abd2c",
"src/universal/OptimismMintableERC721Factory.sol": "0x62921f778f710678123534ff0fc51d363cafa8f35d6a5a416c86c719643dd9fc",
"src/universal/StorageSetter.sol": "0x6372647d8a67d243bc2fb40d2c4bf5807022d94d52d9423cfed27a7d57918635"
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ contract OptimismMintableERC20Factory is ISemver, Initializable {

bytes32 salt = keccak256(abi.encode(_remoteToken, _name, _symbol, _decimals));
address localToken =
address(new OptimismMintableERC20{salt: salt}(bridge, _remoteToken, _name, _symbol, _decimals));
address(new OptimismMintableERC20{ salt: salt }(bridge, _remoteToken, _name, _symbol, _decimals));

// Emit the old event too for legacy support.
emit StandardL2TokenCreated(_remoteToken, localToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract OptimismMintableERC721Factory is ISemver {

bytes32 salt = keccak256(abi.encode(_remoteToken, _name, _symbol));
address localToken =
address(new OptimismMintableERC721{salt: salt}(BRIDGE, REMOTE_CHAIN_ID, _remoteToken, _name, _symbol));
address(new OptimismMintableERC721{ salt: salt }(BRIDGE, REMOTE_CHAIN_ID, _remoteToken, _name, _symbol));

isOptimismMintableERC721[localToken] = true;
emit OptimismMintableERC721Created(localToken, _remoteToken, msg.sender);
Expand Down
5 changes: 1 addition & 4 deletions packages/contracts-bedrock/test/CommonTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,7 @@ contract Messenger_Initializer is Portal_Initializer {
// Setup the address manager and proxy
vm.prank(multisig);
addressManager.setAddress("OVM_L1CrossDomainMessenger", address(L1MessengerImpl));
ResolvedDelegateProxy proxy = new ResolvedDelegateProxy(
addressManager,
"OVM_L1CrossDomainMessenger"
);
ResolvedDelegateProxy proxy = new ResolvedDelegateProxy(addressManager, "OVM_L1CrossDomainMessenger");
L1Messenger = L1CrossDomainMessenger(address(proxy));
L1Messenger.initialize(op);

Expand Down
6 changes: 1 addition & 5 deletions packages/contracts-bedrock/test/Faucet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ contract Faucet_Initializer is Test {
vm.deal(address(faucetContractAdmin), 5 ether);
vm.deal(address(nonAdmin), 5 ether);

optimistNftFam = new AdminFaucetAuthModule(
faucetAuthAdmin,
optimistNftFamName,
optimistNftFamVersion
);
optimistNftFam = new AdminFaucetAuthModule(faucetAuthAdmin, optimistNftFamName, optimistNftFamVersion);
githubFam = new AdminFaucetAuthModule(faucetAuthAdmin, githubFamName, githubFamVersion);

faucetHelper = new FaucetHelper();
Expand Down
20 changes: 3 additions & 17 deletions packages/contracts-bedrock/test/FaultDisputeGame.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {

// Deploy an implementation of the fault game
gameImpl = new FaultDisputeGame(
GAME_TYPE,
absolutePrestate,
4,
Duration.wrap(7 days),
new AlphabetVM(absolutePrestate),
oracle,
blockOracle
GAME_TYPE, absolutePrestate, 4, Duration.wrap(7 days), new AlphabetVM(absolutePrestate), oracle, blockOracle
);
// Register the game implementation with the factory.
factory.setImplementation(GAME_TYPE, gameImpl);
Expand Down Expand Up @@ -990,11 +984,7 @@ contract FaultDisputeGame_ResolvesCorrectly_IncorrectRootFuzz is OneVsOne_Arena
uint256 snapshot = vm.snapshot();

GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(
ABSOLUTE_PRESTATE,
_dishonestTraceLength,
i
);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, _dishonestTraceLength, i);
super.init(dishonest, honest, _dishonestTraceLength - 1);

// Play the game until a step is forced.
Expand All @@ -1021,11 +1011,7 @@ contract FaultDisputeGame_ResolvesCorrectly_CorrectRootFuzz is OneVsOne_Arena {
uint256 snapshot = vm.snapshot();

GamePlayer honest = new HonestPlayer(ABSOLUTE_PRESTATE);
GamePlayer dishonest = new VariableDivergentPlayer(
ABSOLUTE_PRESTATE,
_dishonestTraceLength,
i
);
GamePlayer dishonest = new VariableDivergentPlayer(ABSOLUTE_PRESTATE, _dishonestTraceLength, i);
super.init(honest, dishonest, 15);

// Play the game until a step is forced.
Expand Down
6 changes: 1 addition & 5 deletions packages/contracts-bedrock/test/L2OutputOracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ contract L2OutputOracle_constructor_Test is L2OutputOracle_Initializer {
/// @dev Tests that the constructor reverts if the submissionInterval is zero.
function test_constructor_submissionInterval_reverts() external {
vm.expectRevert("L2OutputOracle: submission interval must be greater than 0");
new L2OutputOracle({
_submissionInterval: 0,
_l2BlockTime: l2BlockTime,
_finalizationPeriodSeconds: 7 days
});
new L2OutputOracle({ _submissionInterval: 0, _l2BlockTime: l2BlockTime, _finalizationPeriodSeconds: 7 days });
}

/// @dev Tests that initialize reverts if the starting timestamp is invalid.
Expand Down
12 changes: 6 additions & 6 deletions packages/contracts-bedrock/test/LivenessModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -374,12 +374,12 @@ contract LivenessModule_RemoveOwnersFuzz_Test is LivenessModule_TestInit {
safeInstance = _setupSafe(keys, threshold);
livenessGuard = new LivenessGuard(safeInstance.safe);
livenessModule = new LivenessModule({
_safe: safeInstance.safe,
_livenessGuard: livenessGuard,
_livenessInterval: livenessInterval,
_minOwners: minOwners_,
_fallbackOwner: fallbackOwner
});
_safe: safeInstance.safe,
_livenessGuard: livenessGuard,
_livenessInterval: livenessInterval,
_minOwners: minOwners_,
_fallbackOwner: fallbackOwner
});
safeInstance.setGuard(address(livenessGuard));
safeInstance.enableModule(address(livenessModule));

Expand Down
8 changes: 1 addition & 7 deletions packages/contracts-bedrock/test/OptimismMintableERC721.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ contract OptimismMintableERC721_Test is ERC721Bridge_Initializer {

// Set up the token pair.
L1NFT = new ERC721("L1NFT", "L1T");
L2NFT = new OptimismMintableERC721(
address(L2NFTBridge),
1,
address(L1NFT),
"L2NFT",
"L2T"
);
L2NFT = new OptimismMintableERC721(address(L2NFTBridge), 1, address(L1NFT), "L2NFT", "L2T");

// Label the addresses for nice traces.
vm.label(address(L1NFT), "L1ERC721Token");
Expand Down
6 changes: 2 additions & 4 deletions packages/contracts-bedrock/test/Optimist.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ contract Optimist_Initializer is Test {
vm.expectEmit(true, true, false, false);
emit Initialized(1);

optimistInviter = new OptimistInviter({
_inviteGranter: eve_inviteGranter,
_attestationStation: attestationStation
});
optimistInviter =
new OptimistInviter({ _inviteGranter: eve_inviteGranter, _attestationStation: attestationStation });

optimistInviter.initialize("OptimistInviter");

Expand Down
5 changes: 1 addition & 4 deletions packages/contracts-bedrock/test/OptimistAllowlist.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ contract OptimistAllowlist_Initializer is Test {
optimistInviter.initialize("OptimistInviter");

optimistAllowlist = new OptimistAllowlist(
attestationStation,
alice_allowlistAttestor,
sally_coinbaseQuestAttestor,
address(optimistInviter)
attestationStation, alice_allowlistAttestor, sally_coinbaseQuestAttestor, address(optimistInviter)
);

optimistInviterHelper = new OptimistInviterHelper(optimistInviter, "OptimistInviter");
Expand Down
5 changes: 1 addition & 4 deletions packages/contracts-bedrock/test/StandardBridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ contract StandardBridge_Stateless_Test is CommonTest {
function setUp() public override {
super.setUp();

bridge = new StandardBridgeTester({
_messenger: payable(address(0)),
_otherBridge: payable(address(0))
});
bridge = new StandardBridgeTester({ _messenger: payable(address(0)), _otherBridge: payable(address(0)) });

mintable = new OptimismMintableERC20({
_bridge: address(0),
Expand Down

0 comments on commit 76c686d

Please sign in to comment.