Skip to content

Commit

Permalink
Merge pull request #12 from matter-labs/sb-gateway-upgrade-test
Browse files Browse the repository at this point in the history
feat: Gateway upgrade test
  • Loading branch information
StanislavBreadless authored Nov 21, 2024
2 parents f9ac6e5 + 4f7a1fb commit dcf228e
Show file tree
Hide file tree
Showing 16 changed files with 486 additions and 295 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,15 @@ jobs:
#
# ci_run ./bin/run_on_all_chains.sh "zkstack dev test revert --no-deps --external-node --no-kill --ignore-prerequisites" ${{ env.CHAINS }} ${{ env.INTEGRATION_TESTS_LOGS_DIR }}
#
# # Upgrade tests should run last, because as soon as they
# # finish the bootloader will be different
# # TODO make upgrade tests safe to run multiple times
# - name: Run upgrade test
# run: |
# ci_run zkstack dev test upgrade --no-deps --chain era
# Upgrade tests should run last, because as soon as they
# finish the bootloader will be different
# TODO make upgrade tests safe to run multiple times
- name: Run upgrade test
run: |
ci_run killall -INT zksync_server || true
ci_run zkstack server --ignore-prerequisites --chain gateway &> ${{ env.SERVER_LOGS_DIR }}/gateway.log &
ci_run sleep 5
ci_run zkstack dev test upgrade --no-deps --chain era
- name: Upload logs
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
Expand Down
2 changes: 1 addition & 1 deletion contracts
11 changes: 5 additions & 6 deletions core/lib/config/src/configs/gateway.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct GatewayChainConfig {
pub validator_timelock_addr: Address,
pub multicall3_addr: Address,
pub diamond_proxy_addr: Address,
// FIXME: there is no "governnace" for a chain, only an admin, we
// need to figure out what we mean here
pub chain_admin_addr: Option<Address>,
pub governance_addr: Address,
pub settlement_layer: u64,
Expand All @@ -37,19 +39,16 @@ impl GatewayChainConfig {
pub fn from_gateway_and_chain_data(
gateway_config: &GatewayConfig,
diamond_proxy_addr: Address,
chain_admin_addr: Address,
l2_chain_admin_addr: Address,
settlement_layer: u64,
) -> Self {
// FIXME: there is no "governnace" for a chain, only an admin, we
// need to figure out what we mean here

Self {
state_transition_proxy_addr: gateway_config.state_transition_proxy_addr,
validator_timelock_addr: gateway_config.validator_timelock_addr,
multicall3_addr: gateway_config.multicall3_addr,
diamond_proxy_addr,
chain_admin_addr: Some(chain_admin_addr),
governance_addr: chain_admin_addr,
chain_admin_addr: Some(l2_chain_admin_addr),
governance_addr: l2_chain_admin_addr,
settlement_layer,
}
}
Expand Down
26 changes: 3 additions & 23 deletions core/node/consistency_checker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@ use zksync_eth_client::{
};
use zksync_health_check::{Health, HealthStatus, HealthUpdater, ReactiveHealthCheck};
use zksync_l1_contract_interface::{
i_executor::{
commit::kzg::ZK_SYNC_BYTES_PER_BLOB,
structures::{
CommitBatchInfo, StoredBatchInfo, PUBDATA_SOURCE_BLOBS, PUBDATA_SOURCE_CALLDATA,
PUBDATA_SOURCE_CUSTOM_PRE_GATEWAY, SUPPORTED_ENCODING_VERSION,
},
i_executor::structures::{
CommitBatchInfo, StoredBatchInfo, PUBDATA_SOURCE_BLOBS, PUBDATA_SOURCE_CALLDATA,
PUBDATA_SOURCE_CUSTOM_PRE_GATEWAY, SUPPORTED_ENCODING_VERSION,
},
Tokenizable,
};
Expand Down Expand Up @@ -240,23 +237,6 @@ impl LocalL1BatchCommitData {
let da = detect_da(protocol_version, reference, self.commitment_mode)
.context("cannot detect DA source from reference commitment token")?;

// For rollups with `PubdataSendingMode::Calldata`, it's required that the pubdata fits into a single blob.
if matches!(self.commitment_mode, L1BatchCommitmentMode::Rollup)
&& matches!(da, PubdataSendingMode::Calldata)
{
let pubdata_len = self
.l1_batch
.header
.pubdata_input
.as_ref()
.map_or_else(|| self.l1_batch.construct_pubdata().len(), Vec::len);
anyhow::ensure!(
pubdata_len <= ZK_SYNC_BYTES_PER_BLOB,
"pubdata size is too large when using calldata DA source: expected <={ZK_SYNC_BYTES_PER_BLOB} bytes, \
got {pubdata_len} bytes"
);
}

let local_token =
CommitBatchInfo::new(self.commitment_mode, &self.l1_batch, da).into_token();
anyhow::ensure!(
Expand Down
2 changes: 1 addition & 1 deletion core/tests/ts-integration/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Reporter } from './reporter';
import * as yaml from 'yaml';
import { L2_BASE_TOKEN_ADDRESS } from 'zksync-ethers/build/utils';
import { FileConfig, loadConfig, loadEcosystem, shouldLoadConfigFromFile } from 'utils/build/file-configs';
import { NodeSpawner } from './utils';
import { NodeSpawner } from 'utils';
import { logsTestPath } from 'utils/build/logs';
import * as nodefs from 'node:fs/promises';
import { exec } from 'utils';
Expand Down
2 changes: 1 addition & 1 deletion core/tests/ts-integration/tests/fees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { logsTestPath } from 'utils/build/logs';
import { sleep } from 'utils/build';
import { killPidWithAllChilds } from 'utils/build/kill';
import path from 'path';
import { NodeSpawner } from '../src/utils';
import { NodeSpawner } from 'utils';
import { sendTransfers } from '../src/context-owner';
import { Reporter } from '../src/reporter';

Expand Down
Loading

0 comments on commit dcf228e

Please sign in to comment.