Skip to content

Commit

Permalink
remove kludges for gateway testing
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless committed Dec 17, 2024
1 parent 68ddadf commit b3aa336
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 101 deletions.
39 changes: 0 additions & 39 deletions l1-contracts/deploy-scripts/DeployL2Contracts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
49 changes: 0 additions & 49 deletions l1-contracts/deploy-scripts/GatewayPreparation.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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));

Expand All @@ -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(
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 0 additions & 11 deletions l1-contracts/deploy-scripts/RegisterZKChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions l1-contracts/deploy-scripts/upgrade/BytecodePublisher.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b3aa336

Please sign in to comment.