diff --git a/l1-contracts/deploy-scripts/DeployL2Contracts.sol b/l1-contracts/deploy-scripts/DeployL2Contracts.sol index ad8230f59..1923672b4 100644 --- a/l1-contracts/deploy-scripts/DeployL2Contracts.sol +++ b/l1-contracts/deploy-scripts/DeployL2Contracts.sol @@ -50,45 +50,6 @@ contract DeployL2Script is Script { function run() public { initializeConfig(); - // string memory root = vm.projectRoot(); - // string memory path = string.concat(root, "/script-out/gateway-deploy-governance-txs-1.json"); - - // bool fileExists = vm.isFile(path); - // if (fileExists) { - // string memory json = vm.readFile(path); - // for (uint i = 0; i < 10000; ++i) { - // string memory tmp = string.concat(".transactions[", vm.toString(i)); - // tmp = string.concat(tmp, "]"); - // bool exists = vm.keyExistsJson(json, tmp); - // if (!exists) { - // break; - // } else { - // address from = vm.parseJsonAddress(json, string.concat(tmp, ".transaction.from")); - // bool existsTo = vm.keyExistsJson(json, string.concat(tmp, ".transaction.to")); - // uint256 value = vm.parseJsonUint(json, string.concat(tmp, ".transaction.value")); - // if (existsTo) { - // bytes memory input = vm.parseJsonBytes(json, string.concat(tmp, ".transaction.input")); - // address to = vm.parseJsonAddress(json, string.concat(tmp, ".transaction.to")); - // vm.startBroadcast(from); - // to.call{value: value}(input); - // vm.stopBroadcast(); - // } else { - // bytes memory input = vm.parseJsonBytes(json, string.concat(tmp, ".transaction.input")); - // vm.startBroadcast(from); - // address deployedAddress; - // assembly { - // deployedAddress := create(value, add(input, 0x20), mload(input)) - - // if iszero(extcodesize(deployedAddress)) { - // revert(0, 0) - // } - // } - // vm.stopBroadcast(); - // } - // } - // } - // } - deploy(false); } diff --git a/l1-contracts/deploy-scripts/GatewayPreparation.s.sol b/l1-contracts/deploy-scripts/GatewayPreparation.s.sol index ec547a42a..1f2c518d8 100644 --- a/l1-contracts/deploy-scripts/GatewayPreparation.s.sol +++ b/l1-contracts/deploy-scripts/GatewayPreparation.s.sol @@ -185,7 +185,6 @@ contract GatewayPreparation is Script { /// @dev Requires the sender to be the owner of the contract function governanceRegisterGateway() public { initializeConfig(); - preRun(false); IBridgehub bridgehub = IBridgehub(config.bridgehub); @@ -210,7 +209,6 @@ contract GatewayPreparation is Script { /// @dev Requires the sender to be the owner of the contract function governanceWhitelistGatewayCTM(address gatewayCTMAddress, bytes32 governanoceOperationSalt) public { initializeConfig(); - preRun(false); bytes memory data = abi.encodeCall(IBridgehub.addChainTypeManager, (gatewayCTMAddress)); @@ -232,7 +230,6 @@ contract GatewayPreparation is Script { function governanceSetCTMAssetHandler(bytes32 governanoceOperationSalt) public { initializeConfig(); - preRun(false); L1AssetRouter sharedBridge = L1AssetRouter(config.sharedBridgeProxy); bytes memory data = abi.encodeCall( @@ -289,7 +286,6 @@ contract GatewayPreparation is Script { function registerAssetIdInBridgehub(address gatewayCTMAddress, bytes32 governanoceOperationSalt) public { initializeConfig(); - preRun(false); bytes memory secondBridgeData = abi.encodePacked( bytes1(0x01), @@ -630,54 +626,9 @@ contract GatewayPreparation is Script { } function executeGovernanceTxs() public { - preRun(true); saveOutput(); } - function preRun(bool skip_stage12) internal { - // string memory root = vm.projectRoot(); - // string memory path = string.concat(root, "/script-out/gateway-deploy-governance-txs-1.json"); - // bool fileExists = vm.isFile(path); - // if (fileExists) { - // uint256 idxFrom = 0; - // if (skip_stage12) { - // vm.pauseGasMetering(); - // idxFrom = 4; - // } - // string memory json = vm.readFile(path); - // for (uint i = idxFrom; i < 10000; ++i) { - // string memory tmp = string.concat(".transactions[", vm.toString(i)); - // tmp = string.concat(tmp, "]"); - // bool exists = vm.keyExistsJson(json, tmp); - // if (!exists) { - // break; - // } else { - // address from = vm.parseJsonAddress(json, string.concat(tmp, ".transaction.from")); - // bool existsTo = vm.keyExistsJson(json, string.concat(tmp, ".transaction.to")); - // uint256 value = vm.parseJsonUint(json, string.concat(tmp, ".transaction.value")); - // if (existsTo) { - // bytes memory input = vm.parseJsonBytes(json, string.concat(tmp, ".transaction.input")); - // address to = vm.parseJsonAddress(json, string.concat(tmp, ".transaction.to")); - // vm.startBroadcast(from); - // to.call{value: value}(input); - // vm.stopBroadcast(); - // } else { - // bytes memory input = vm.parseJsonBytes(json, string.concat(tmp, ".transaction.input")); - // vm.startBroadcast(from); - // address deployedAddress; - // assembly { - // deployedAddress := create(value, add(input, 0x20), mload(input)) - // if iszero(extcodesize(deployedAddress)) { - // revert(0, 0) - // } - // } - // vm.stopBroadcast(); - // } - // } - // } - // } - } - function governanceExecuteCalls(bytes memory callsToExecute, address governanceAddr) internal { IGovernance governance = IGovernance(governanceAddr); Ownable2Step ownable = Ownable2Step(governanceAddr); diff --git a/l1-contracts/deploy-scripts/RegisterZKChain.s.sol b/l1-contracts/deploy-scripts/RegisterZKChain.s.sol index 3285b2af5..5dbf2b2b1 100644 --- a/l1-contracts/deploy-scripts/RegisterZKChain.s.sol +++ b/l1-contracts/deploy-scripts/RegisterZKChain.s.sol @@ -109,17 +109,6 @@ contract RegisterZKChainScript is Script { function runInner(string memory outputPath) internal { string memory root = vm.projectRoot(); - // kludge - // string memory path = string.concat(root, "/script-out/gateway-upgrade-ecosystem.toml"); - // bool fileExists = vm.isFile(path); - // if (config.chainChainId == 505 && fileExists) { - // string memory toml = vm.readFile(path); - // bytes memory calls1 = toml.readBytes("$.governance_stage1_calls"); - // bytes memory calls2 = toml.readBytes("$.governance_stage2_calls"); - // governanceExecuteCalls(calls1, config.governance); - // governanceExecuteCalls(calls2, config.governance); - // } - outputPath = string.concat(root, outputPath); if (config.initializeLegacyBridge) { diff --git a/l1-contracts/deploy-scripts/upgrade/BytecodePublisher.s.sol b/l1-contracts/deploy-scripts/upgrade/BytecodePublisher.s.sol index aca79e2e1..3981da95a 100644 --- a/l1-contracts/deploy-scripts/upgrade/BytecodePublisher.s.sol +++ b/l1-contracts/deploy-scripts/upgrade/BytecodePublisher.s.sol @@ -14,10 +14,10 @@ library BytecodePublisher { address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code")))); Vm internal constant vm = Vm(VM_ADDRESS); - // 100 kb + /// @notice Maximal size of bytecodes' batch to be published at once uint256 constant MAX_BATCH_SIZE = 126_000; - /// @notice Publishes bytecodes in batches, each not exceeding 100KB + /// @notice Publishes bytecodes in batches, each not exceeding `MAX_BATCH_SIZE` /// @param bytecodes The array of bytecodes to publish function publishBytecodesInBatches(BytecodesSupplier bytecodesSupplier, bytes[] memory bytecodes) internal { uint256 totalBytecodes = bytecodes.length;