Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts
Submodule contracts updated 27 files
+36 −35 .github/workflows/l1-contracts-ci.yaml
+47 −46 .github/workflows/system-contracts-ci.yaml
+19 −14 .github/workflows/update-hashes-on-demand.yaml
+377 −377 AllContractsHashes.json
+4 −2 l1-contracts/contracts/common/L1ContractErrors.sol
+26 −1 l1-contracts/contracts/common/libraries/FullMerkle.sol
+14 −0 l1-contracts/contracts/common/libraries/ZKSyncOSBytecodeInfo.sol
+2 −0 l1-contracts/contracts/core/message-root/IMessageRoot.sol
+22 −3 l1-contracts/contracts/core/message-root/MessageRootBase.sol
+4 −0 l1-contracts/contracts/dev-contracts/test/FullMerkleTest.sol
+50 −10 l1-contracts/contracts/upgrades/BytecodesSupplier.sol
+10 −2 l1-contracts/deploy-scripts/ctm/DeployCTM.s.sol
+3 −1 l1-contracts/deploy-scripts/ctm/DeployCTMUtils.s.sol
+4 −3 l1-contracts/deploy-scripts/gateway/GatewayVotePreparation.s.sol
+14 −4 l1-contracts/deploy-scripts/upgrade/default_upgrade/DefaultCTMUpgrade.s.sol
+4 −3 l1-contracts/deploy-scripts/utils/AddressIntrospector.sol
+1 −1 l1-contracts/deploy-scripts/utils/Types.sol
+41 −8 l1-contracts/deploy-scripts/utils/bytecode/BytecodePublisher.s.sol
+61 −17 l1-contracts/selectors
+3 −3 l1-contracts/test/foundry/l1/integration/upgrade-envs/script-out/local-core.toml
+58 −51 l1-contracts/test/foundry/l1/integration/upgrade-envs/script-out/local-ctm.toml
+51 −0 l1-contracts/test/foundry/l1/unit/concrete/Bridgehub/MessageRoot.t.sol
+20 −0 l1-contracts/test/foundry/l1/unit/concrete/Bridgehub/MessageRoot_Extended.t.sol
+62 −0 l1-contracts/test/foundry/l1/unit/concrete/common/libraries/FullMerkle/MerklePath.t.sol
+130 −14 l1-contracts/test/foundry/l1/unit/concrete/state-transition/BytecodesSupplier.t.sol
+10 −5 l1-contracts/zkstack-out/IDeployCTM.sol/IDeployCTM.json
+56 −0 l1-contracts/zkstack-out/MessageRootBase.sol/MessageRootBase.json
3 changes: 3 additions & 0 deletions core/tests/ts-integration/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
18 changes: 6 additions & 12 deletions core/tests/ts-integration/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 5 additions & 10 deletions core/tests/upgrade-test/tests/upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,15 +591,10 @@ async function publishBytecode(
nonce: number
): Promise<number> {
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;
}
Expand Down Expand Up @@ -778,21 +773,21 @@ 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();
} else {
// 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,
Expand Down
21 changes: 21 additions & 0 deletions core/tests/upgrade-test/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
)
};
}
Expand Down
Loading