diff --git a/contracts b/contracts index b9f26d282191..f9a86ef36750 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit b9f26d282191b8a61e6040121edf6035bed28bf1 +Subproject commit f9a86ef36750022bc69b29b6b6ac6aa962e2d827 diff --git a/core/tests/ts-integration/src/constants.ts b/core/tests/ts-integration/src/constants.ts index c5fe149d826b..98ab5c4ce08c 100644 --- a/core/tests/ts-integration/src/constants.ts +++ b/core/tests/ts-integration/src/constants.ts @@ -58,3 +58,6 @@ export const ArtifactL1AssetRouter = readContract(`${ARTIFACTS_PATH}`, 'L1AssetR export const ArtifactL1AssetTracker = readContract(`${ARTIFACTS_PATH}`, 'L1AssetTracker'); export const ArtifactL2AssetTracker = readContract(`${ARTIFACTS_PATH}`, 'L2AssetTracker'); export const ArtifactDummyInteropRecipient = readContract(`${L1_ZK_ARTIFACTS_PATH}`, 'DummyInteropRecipient'); +export const ArtifactIBridgehubBase = readContract(`${ARTIFACTS_PATH}`, 'IBridgehubBase'); +export const ArtifactIGetters = readContract(`${ARTIFACTS_PATH}`, 'IGetters'); +export const ArtifactIChainAssetHandler = readContract(`${ARTIFACTS_PATH}`, 'IChainAssetHandler'); diff --git a/core/tests/ts-integration/src/helpers.ts b/core/tests/ts-integration/src/helpers.ts index ae3ab3e70746..aa58de6d2740 100644 --- a/core/tests/ts-integration/src/helpers.ts +++ b/core/tests/ts-integration/src/helpers.ts @@ -9,7 +9,9 @@ import { GATEWAY_CHAIN_ID, L2_INTEROP_ROOT_STORAGE_ADDRESS, L2_BRIDGEHUB_ADDRESS, - ArtifactL2InteropRootStorage + ArtifactL2InteropRootStorage, + ArtifactIBridgehubBase, + ArtifactIGetters } from './constants'; import { log } from 'console'; @@ -107,17 +109,9 @@ export async function waitUntilBlockExecutedOnGateway( gwWallet: zksync.Wallet, blockNumber: number ) { - const bridgehub = new ethers.Contract( - L2_BRIDGEHUB_ADDRESS, - ['function getZKChain(uint256) view returns (address)'], - gwWallet - ); - const zkChainAddr = await bridgehub.getZKChain(await wallet.provider.getNetwork().then((net) => net.chainId)); - const gettersFacet = new ethers.Contract( - zkChainAddr, - ['function getTotalBatchesExecuted() view returns (uint256)'], - gwWallet - ); + const bridgehub = new ethers.Contract(L2_BRIDGEHUB_ADDRESS, ArtifactIBridgehubBase.abi, gwWallet); + const zkChainAddr = await bridgehub.getZKChain(await wallet.provider.getNetwork().then((net: any) => net.chainId)); + const gettersFacet = new ethers.Contract(zkChainAddr, ArtifactIGetters.abi, gwWallet); let batchNumber = (await wallet.provider.getBlockDetails(blockNumber)).l1BatchNumber; let currentExecutedBatchNumber = 0; diff --git a/core/tests/upgrade-test/tests/upgrade.test.ts b/core/tests/upgrade-test/tests/upgrade.test.ts index d9b76a7ba082..6859626a3dd0 100644 --- a/core/tests/upgrade-test/tests/upgrade.test.ts +++ b/core/tests/upgrade-test/tests/upgrade.test.ts @@ -591,15 +591,10 @@ async function publishBytecode( nonce: number ): Promise { const hash = zksync.utils.hashBytecode(bytecode); - const abi = [ - 'function publishBytecode(bytes calldata _bytecode) public', - 'function publishingBlock(bytes32 _hash) public view returns (uint256)' - ]; - - const contract = new ethers.Contract(bytecodeSupplierAddr, abi, wallet); + const contract = new ethers.Contract(bytecodeSupplierAddr, contracts.bytecodesSupplierAbi, wallet); const block = await contract.publishingBlock(hash); if (block == BigInt(0)) { - const tx = await contract.publishBytecode(bytecode, { nonce }); + const tx = await contract.publishEraBytecode(bytecode, { nonce }); await tx.wait(); return 1; } @@ -778,7 +773,7 @@ async function pauseMigrationsCalldata( // For gateway, get the ChainAssetHandler address from L2 Bridgehub const l2BridgehubContract = new ethers.Contract( L2_BRIDGEHUB_ADDRESS, - ['function chainAssetHandler() external view returns (address)'], + contracts.bridgehubAbi, gatewayInfo.gatewayProvider ); chainAssetHandlerAddr = await l2BridgehubContract.chainAssetHandler(); @@ -786,13 +781,13 @@ async function pauseMigrationsCalldata( // For L1, get the ChainAssetHandler address from L1 Bridgehub const bridgehubContract = new ethers.Contract( l1BridgehubAddr, - ['function chainAssetHandler() external view returns (address)'], + contracts.bridgehubAbi, l1Provider ); chainAssetHandlerAddr = await bridgehubContract.chainAssetHandler(); } - const iface = new ethers.Interface(['function pauseMigration() external']); + const iface = contracts.chainAssetHandlerAbi; return prepareGovernanceCalldata( chainAssetHandlerAddr, diff --git a/core/tests/upgrade-test/tests/utils.ts b/core/tests/upgrade-test/tests/utils.ts index d3d7c2387355..d1c67dddb528 100644 --- a/core/tests/upgrade-test/tests/utils.ts +++ b/core/tests/upgrade-test/tests/utils.ts @@ -41,6 +41,9 @@ export interface Contracts { complexUpgraderAbi: any; counterBytecode: any; chainTypeManager: any; + bytecodesSupplierAbi: any; + bridgehubAbi: any; + chainAssetHandlerAbi: any; } export function initContracts(pathToHome: string, zkStack: boolean): Contracts { @@ -70,6 +73,15 @@ export function initContracts(pathToHome: string, zkStack: boolean): Contracts { ).deployedBytecode, chainTypeManager: new ethers.Interface( require(`${CONTRACTS_FOLDER}/l1-contracts/out/EraChainTypeManager.sol/EraChainTypeManager.json`).abi + ), + bytecodesSupplierAbi: new ethers.Interface( + require(`${CONTRACTS_FOLDER}/l1-contracts/out/BytecodesSupplier.sol/BytecodesSupplier.json`).abi + ), + bridgehubAbi: new ethers.Interface( + require(`${CONTRACTS_FOLDER}/l1-contracts/out/IBridgehubBase.sol/IBridgehubBase.json`).abi + ), + chainAssetHandlerAbi: new ethers.Interface( + require(`${CONTRACTS_FOLDER}/l1-contracts/out/IChainAssetHandler.sol/IChainAssetHandler.json`).abi ) }; } else { @@ -99,6 +111,15 @@ export function initContracts(pathToHome: string, zkStack: boolean): Contracts { .deployedBytecode, chainTypeManager: new ethers.Interface( require(`${L1_CONTRACTS_FOLDER}/state-transition/ChainTypeManager.sol/ChainTypeManager.json`).abi + ), + bytecodesSupplierAbi: new ethers.Interface( + require(`${L1_CONTRACTS_FOLDER}/upgrades/BytecodesSupplier.sol/BytecodesSupplier.json`).abi + ), + bridgehubAbi: new ethers.Interface( + require(`${L1_CONTRACTS_FOLDER}/core/bridgehub/IBridgehubBase.sol/IBridgehubBase.json`).abi + ), + chainAssetHandlerAbi: new ethers.Interface( + require(`${L1_CONTRACTS_FOLDER}/core/chain-asset-handler/IChainAssetHandler.sol/IChainAssetHandler.json`).abi ) }; }