diff --git a/core/tests/ts-integration/src/helpers.ts b/core/tests/ts-integration/src/helpers.ts index 2268c12864f..017ffd71b9a 100644 --- a/core/tests/ts-integration/src/helpers.ts +++ b/core/tests/ts-integration/src/helpers.ts @@ -111,12 +111,12 @@ export async function scaledGasPrice(wallet: ethers.Wallet | zksync.Wallet): Pro * * @returns Boolean that indicates whether it is Validium mode. */ -export async function getIsValidium(): Promise { +export async function isValidium(): Promise { + const filePath = `${process.env.ZKSYNC_HOME}/etc/env/dev.env`; try { const fileContent = await fs.promises.readFile(filePath, 'utf-8'); - const isValidiumMode = fileContent .split('\n') .map((line) => line.trim().split('=')) @@ -127,4 +127,5 @@ export async function getIsValidium(): Promise { console.error(`Error reading or parsing the config file ${filePath}:`, error); return false; // Return a default value or handle the error as needed } -} \ No newline at end of file +x} + diff --git a/core/tests/ts-integration/tests/contracts.test.ts b/core/tests/ts-integration/tests/contracts.test.ts index face3cd8504..84f08354f2a 100644 --- a/core/tests/ts-integration/tests/contracts.test.ts +++ b/core/tests/ts-integration/tests/contracts.test.ts @@ -7,7 +7,7 @@ */ import { TestMaster } from '../src/index'; -import { deployContract, getIsValidium, getTestContract, waitForNewL1Batch } from '../src/helpers'; +import { deployContract, isValidium, getTestContract, waitForNewL1Batch } from '../src/helpers'; import { shouldOnlyTakeFee } from '../src/modifiers/balance-checker'; import * as ethers from 'ethers'; @@ -320,7 +320,7 @@ describe('Smart contract behavior checks', () => { }); // If it is running in validium mode, there is no pubdata and the transaction will not be rejected. - if (await getIsValidium()) { + if (await isValidium()) { await expect( alice.sendTransaction({ to: alice.address, diff --git a/core/tests/ts-integration/tests/system.test.ts b/core/tests/ts-integration/tests/system.test.ts index 428b9bfe33e..3918c68ecf5 100644 --- a/core/tests/ts-integration/tests/system.test.ts +++ b/core/tests/ts-integration/tests/system.test.ts @@ -14,7 +14,7 @@ import * as ethers from 'ethers'; import { BigNumberish, BytesLike } from 'ethers'; import { serialize, hashBytecode } from 'zksync-web3/build/src/utils'; import { deployOnAnyLocalAddress, ForceDeployment } from '../src/system'; -import { getIsValidium, getTestContract } from '../src/helpers'; +import { isValidium, getTestContract } from '../src/helpers'; const contracts = { counter: getTestContract('Counter'), @@ -73,12 +73,12 @@ describe('System behavior checks', () => { }); test('Should accept transactions with small gasPerPubdataByte', async () => { - const isValidium = await getIsValidium(); + const isValidiumMode = await isValidium(); // The number "10" was chosen because we have a different error for lesser `smallGasPerPubdata`. // In validium mode, this minimum value is "55" - const smallGasPerPubdata = isValidium ? 55 : 10; + const smallGasPerPubdata = isValidiumMode ? 55 : 10; // In validium mode, the nonce is not required. - const senderNonce = isValidium ? undefined : await alice.getTransactionCount(); + const senderNonce = isValidiumMode ? undefined : await alice.getTransactionCount(); // This tx should be accepted by the server, but would never be executed, so we don't wait for the receipt. await alice.sendTransaction({