Skip to content

Commit 1e83af8

Browse files
authored
Merge pull request #4544 from matter-labs/sb/fix-medium-interop-support
fix(v30): various interop fixes
2 parents 633b70d + 9e3368a commit 1e83af8

File tree

19 files changed

+126
-29
lines changed

19 files changed

+126
-29
lines changed

core/Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/lib/constants/src/contracts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub const GW_ASSET_TRACKER_ADDRESS: Address = H160([
234234

235235
pub const DUMMY_ADDRESS_1: Address = H160([
236236
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
237-
0x01, 0x01, 0x00, 0x0b,
237+
0x01, 0x01, 0x00, 0x0a,
238238
]);
239239

240240
pub const DUMMY_ADDRESS_2: Address = H160([

core/lib/dal/src/sync_dal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ impl SyncDal<'_, '_> {
1919
&mut self,
2020
numbers: std::ops::Range<L2BlockNumber>,
2121
) -> DalResult<Vec<SyncBlock>> {
22+
// FIXME: for some reason query below does not compile
2223
// Check if range is non-empty, because BETWEEN in SQL in `unordered`.
2324
if numbers.is_empty() {
2425
return Ok(vec![]);

core/lib/types/src/system_contracts.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use zksync_basic_types::{AccountTreeId, Address, U256};
44
use zksync_contracts::{read_sys_contract_bytecode, ContractLanguage, SystemContractsRepo};
55
use zksync_system_constants::{
66
BOOTLOADER_UTILITIES_ADDRESS, CODE_ORACLE_ADDRESS, COMPRESSOR_ADDRESS, CREATE2_FACTORY_ADDRESS,
7-
DUMMY_ADDRESS_2, DUMMY_ADDRESS_3, DUMMY_ADDRESS_4, EVENT_WRITER_ADDRESS,
7+
DUMMY_ADDRESS_1, DUMMY_ADDRESS_2, DUMMY_ADDRESS_3, DUMMY_ADDRESS_4, EVENT_WRITER_ADDRESS,
88
EVM_GAS_MANAGER_ADDRESS, EVM_HASHES_STORAGE_ADDRESS, EVM_PREDEPLOYS_MANAGER_ADDRESS,
99
GW_ASSET_TRACKER_ADDRESS, IDENTITY_ADDRESS, L2_ASSET_ROUTER_ADDRESS, L2_ASSET_TRACKER_ADDRESS,
1010
L2_BRIDGEHUB_ADDRESS, L2_CHAIN_ASSET_HANDLER_ADDRESS, L2_GENESIS_UPGRADE_ADDRESS,
@@ -32,7 +32,7 @@ use crate::{
3232
pub const TX_NONCE_INCREMENT: U256 = U256([1, 0, 0, 0]); // 1
3333
pub const DEPLOYMENT_NONCE_INCREMENT: U256 = U256([0, 0, 1, 0]); // 2^128
3434

35-
static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 48] = [
35+
static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 49] = [
3636
(
3737
"",
3838
"AccountCodeStorage",
@@ -295,7 +295,13 @@ static SYSTEM_CONTRACT_LIST: [(&str, &str, Address, ContractLanguage); 48] = [
295295
GW_ASSET_TRACKER_ADDRESS,
296296
ContractLanguage::Sol,
297297
),
298-
// FIXME: I DUMMY_ADDRESS_1 is missing
298+
// todo FIXME, deploy normally instead using DUMMY_ADDRESS and deploying on genesis
299+
(
300+
"../../l1-contracts/zkout/",
301+
"TransparentUpgradeableProxy",
302+
DUMMY_ADDRESS_1,
303+
ContractLanguage::Sol,
304+
),
299305
(
300306
"../../l1-contracts/zkout/",
301307
"BridgedStandardERC20",

core/lib/vm_executor/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ tokio.workspace = true
2424
anyhow.workspace = true
2525
tracing.workspace = true
2626
vise.workspace = true
27+
serde_json.workspace = true
28+
serde.workspace = true
2729

2830
[dev-dependencies]
2931
assert_matches.workspace = true

core/lib/vm_executor/src/batch/factory.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{fmt, marker::PhantomData, rc::Rc, sync::Arc, time::Duration};
1+
use std::{fmt, io::Write, marker::PhantomData, rc::Rc, sync::Arc, time::Duration};
22

33
use anyhow::Context as _;
44
use once_cell::sync::OnceCell;
@@ -249,7 +249,7 @@ impl<S: ReadStorage, Tr: BatchTracer> BatchVm<S, Tr> {
249249
with_compression: bool,
250250
) -> BatchTransactionExecutionResult {
251251
let legacy_tracer_result = Arc::new(OnceCell::default());
252-
let legacy_tracer = if Tr::TRACE_CALLS {
252+
let legacy_tracer = if true {
253253
vec![CallTracer::new(legacy_tracer_result.clone()).into_tracer_pointer()]
254254
} else {
255255
vec![]
@@ -296,6 +296,13 @@ impl<S: ReadStorage, Tr: BatchTracer> BatchVm<S, Tr> {
296296
}
297297
};
298298

299+
// Save the formatted call_traces to a file
300+
if let Ok(mut file) = std::fs::File::create("call_traces.json") {
301+
if let Ok(json) = serde_json::to_string(&call_traces) {
302+
let _ = writeln!(file, "{}", json);
303+
}
304+
}
305+
299306
BatchTransactionExecutionResult {
300307
tx_result: Box::new(tx_result),
301308
compression_result: compressed_bytecodes,

core/node/eth_sender/src/publish_criterion.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl GasConsts {
329329

330330
/// Additional gas cost of processing `Commit` operation per batch.
331331
/// It's applicable if SL is Gateway.
332-
const GATEWAY_BATCH_COMMIT_BASE_COST: u64 = 200_000;
332+
const GATEWAY_BATCH_COMMIT_BASE_COST: u64 = 2_000_000;
333333

334334
/// All gas cost of processing `PROVE` operation per batch.
335335
/// It's applicable if SL is GATEWAY.
@@ -342,7 +342,9 @@ impl GasConsts {
342342

343343
/// Base gas cost of processing `EXECUTION` operation per batch.
344344
/// It's applicable if SL is GATEWAY.
345-
const GATEWAY_BATCH_EXECUTION_COST: u64 = 100_000;
345+
/// FIXME: needs to be calculated properly since it will now include
346+
/// working through all interop transactions.
347+
const GATEWAY_BATCH_EXECUTION_COST: u64 = 2_000_000;
346348
/// Gas cost of processing `l1_operation` in batch.
347349
/// It's applicable if SL is GATEWAY.
348350
const GATEWAY_L1_OPERATION_COST: u64 = 4_000;
@@ -353,7 +355,7 @@ impl GasConsts {
353355

354356
/// Additional gas cost of processing `Execute` operation per batch.
355357
/// It's applicable iff SL is Ethereum.
356-
const L1_BATCH_EXECUTE_BASE_COST: u64 = 50_000;
358+
const L1_BATCH_EXECUTE_BASE_COST: u64 = 100_000;
357359

358360
/// Additional gas cost of processing `Execute` operation per L1->L2 tx.
359361
/// It's applicable iff SL is Ethereum.

core/tests/ts-integration/src/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export const L2_MESSAGE_ROOT_ADDRESS = '0x00000000000000000000000000000000000100
1414
export const L2_INTEROP_ROOT_STORAGE_ADDRESS = '0x0000000000000000000000000000000000010008';
1515
export const L2_MESSAGE_VERIFICATION_ADDRESS = '0x0000000000000000000000000000000000010009';
1616
export const L2_CHAIN_ASSET_HANDLER_ADDRESS = '0x000000000000000000000000000000000001000A';
17-
export const L2_INTEROP_CENTER_ADDRESS = '0x000000000000000000000000000000000001000B';
18-
export const L2_INTEROP_HANDLER_ADDRESS = '0x000000000000000000000000000000000001000C';
19-
export const L2_ASSET_TRACKER_ADDRESS = '0x000000000000000000000000000000000001000D';
17+
export const L2_INTEROP_CENTER_ADDRESS = '0x000000000000000000000000000000000001000C';
18+
export const L2_INTEROP_HANDLER_ADDRESS = '0x000000000000000000000000000000000001000D';
19+
export const L2_ASSET_TRACKER_ADDRESS = '0x000000000000000000000000000000000001000E';
2020

2121
// System contract addresses
2222
export const SYSTEM_CONTEXT_ADDRESS = '0x000000000000000000000000000000000000800b';

core/tests/ts-integration/src/helpers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { ZkSyncArtifact } from '@matterlabs/hardhat-zksync-solc/dist/src/types';
66
import * as path from 'path';
77
import { loadConfig } from 'utils/src/file-configs';
88

9+
import { log } from 'console';
10+
911
// import { L2_BRIDGEHUB_ADDRESS } from '../src/constants';
1012

1113
/**
@@ -175,13 +177,15 @@ export async function waitForBlockToBeFinalizedOnL1(wallet: zksync.Wallet, block
175177
}
176178

177179
export async function waitForL2ToL1LogProof(wallet: zksync.Wallet, blockNumber: number, txHash: string) {
180+
log('waiting for block to be finalized');
178181
// First, we wait for block to be finalized.
179182
await waitUntilBlockFinalized(wallet, blockNumber);
180183

184+
log('waiting for log proof');
181185
// Second, we wait for the log proof.
182186
let i = 0;
183187
while ((await wallet.provider.getLogProof(txHash)) == null) {
184-
console.log('Waiting for log proof...', i);
188+
log(`Waiting for log proof... ${i}`);
185189
await zksync.utils.sleep(wallet.provider.pollingInterval);
186190
i++;
187191
}

0 commit comments

Comments
 (0)