fix: clean e2e tests logs (#495)

This commit is contained in:
Victorien Gauch
2025-01-06 15:37:32 +01:00
committed by GitHub
parent 643110c696
commit 87163c936e
9 changed files with 197 additions and 103 deletions

View File

@@ -52,7 +52,7 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => {
const l1TokenAddress = await l1Token.getAddress();
const allowanceL1Account = await l1Token.allowance(l1Account.address, l1TokenBridgeAddress);
logger.info(`Current allowance of L1 account to L1 TokenBridge is ${allowanceL1Account.toString()}`);
logger.debug(`Current allowance of L1 account to L1 TokenBridge is ${allowanceL1Account.toString()}`);
logger.debug("Calling the bridgeToken function on the L1 TokenBridge contract");
@@ -79,18 +79,18 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => {
);
const l1TokenBalance = await l1Token.balanceOf(l1Account.address);
logger.info(`Token balance of L1 account is ${l1TokenBalance.toString()}`);
logger.debug(`Token balance of L1 account is ${l1TokenBalance.toString()}`);
expect(l1TokenBalance).toEqual(0n);
logger.info("Waiting for MessageSent event on L1.");
logger.debug("Waiting for MessageSent event on L1.");
const messageNumber = messageSentEvent[messageSentEventMessageNumberIndex];
const messageHash = messageSentEvent[messageSentEventMessageHashIndex];
logger.info(`Message sent on L1. messageHash=${messageHash}`);
logger.debug(`Message sent on L1. messageHash=${messageHash}`);
logger.info("Waiting for anchoring...");
logger.debug("Waiting for anchoring...");
const [rollingHashUpdatedEvent] = await waitForEvents(
l2MessageService,
@@ -106,9 +106,9 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => {
expect(anchoredStatus).toBeGreaterThan(0);
logger.info(`Message anchored. event=${JSON.stringify(rollingHashUpdatedEvent)}`);
logger.debug(`Message anchored. event=${JSON.stringify(rollingHashUpdatedEvent)}`);
logger.info("Waiting for MessageClaimed event on L2...");
logger.debug("Waiting for MessageClaimed event on L2...");
const [claimedEvent] = await waitForEvents(l2MessageService, l2MessageService.filters.MessageClaimed(messageHash));
expect(claimedEvent).not.toBeNull();
@@ -116,14 +116,14 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => {
const [newTokenDeployed] = await waitForEvents(l2TokenBridge, l2TokenBridge.filters.NewTokenDeployed());
expect(newTokenDeployed).not.toBeNull();
logger.info(`Message claimed on L2. event=${JSON.stringify(claimedEvent)}.`);
logger.debug(`Message claimed on L2. event=${JSON.stringify(claimedEvent)}.`);
const l2Token = config.getL2BridgedTokenContract(newTokenDeployed.args.bridgedToken);
logger.info("Verify the token balance on L2");
logger.debug("Verify the token balance on L2");
const l2TokenBalance = await l2Token.balanceOf(l2Account.address);
logger.info(`Token balance of L2 account is ${l2TokenBalance.toString()}`);
logger.debug(`Token balance of L2 account is ${l2TokenBalance.toString()}`);
expect(l2TokenBalance).toEqual(bridgeAmount);
});
@@ -163,8 +163,8 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => {
]);
const allowanceL2Account = await l2Token.allowance(l2Account.address, l2TokenBridge.getAddress());
logger.info(`Current allowance of L2 account to L2 TokenBridge is ${allowanceL2Account.toString()}`);
logger.info(`Current balance of L2 account is ${await l2Token.balanceOf(l2Account)}`);
logger.debug(`Current allowance of L2 account to L2 TokenBridge is ${allowanceL2Account.toString()}`);
logger.debug(`Current balance of L2 account is ${await l2Token.balanceOf(l2Account)}`);
logger.debug("Calling the bridgeToken function on the L2 TokenBridge contract");
@@ -189,22 +189,22 @@ describe("Bridge ERC20 Tokens L1 -> L2 and L2 -> L1", () => {
);
const messageHash = messageSentEvent[messageSentEventMessageHashIndex];
logger.info("Waiting for L1 MessageClaimed event.");
logger.debug("Waiting for L1 MessageClaimed event.");
const [claimedEvent] = await waitForEvents(lineaRollup, lineaRollup.filters.MessageClaimed(messageHash));
expect(claimedEvent).not.toBeNull();
logger.info(`Message claimed on L1. event=${JSON.stringify(claimedEvent)}`);
logger.debug(`Message claimed on L1. event=${JSON.stringify(claimedEvent)}`);
const [newTokenDeployed] = await waitForEvents(l1TokenBridge, l1TokenBridge.filters.NewTokenDeployed());
expect(newTokenDeployed).not.toBeNull();
const l1BridgedToken = config.getL1BridgedTokenContract(newTokenDeployed.args.bridgedToken);
logger.info("Verify the token balance on L1");
logger.debug("Verify the token balance on L1");
const l1BridgedTokenBalance = await l1BridgedToken.balanceOf(l1Account.address);
logger.info(`Token balance of L1 account is ${l1BridgedTokenBalance.toString()}`);
logger.debug(`Token balance of L1 account is ${l1BridgedTokenBalance.toString()}`);
expect(l1BridgedTokenBalance).toEqual(bridgeAmount);
});

View File

@@ -1,5 +1,8 @@
import { AbiCoder, AbstractSigner, BaseContract, ContractFactory, Wallet, ethers } from "ethers";
import { ProxyAdmin__factory, TransparentUpgradeableProxy__factory, ProxyAdmin } from "../typechain";
import { createTestLogger } from "../config/logger";
const logger = createTestLogger();
export const encodeData = (types: string[], values: unknown[], packed?: boolean) => {
if (packed) {

View File

@@ -310,7 +310,7 @@ export async function sendTransactionsToGenerateTrafficWithInterval(
clearTimeout(timeoutId);
timeoutId = null;
}
logger.info("Transaction loop stopped.");
logger.info("Stopped generating traffic on L2");
};
sendTransaction();

View File

@@ -8,23 +8,35 @@ const l2Provider = config.getL2Provider();
describe("Gas limit test suite", () => {
const setGasLimit = async (account: Wallet): Promise<ContractTransactionReceipt | null> => {
logger.debug(`setGasLimit called with account=${account.address}`);
const opcodeTestContract = config.getOpcodeTestContract(account);
const nonce = await l2Provider.getTransactionCount(account.address, "pending");
logger.debug(`Fetched nonce. nonce=${nonce} account=${account.address}`);
const { maxPriorityFeePerGas, maxFeePerGas } = await l2Provider.getFeeData();
logger.debug(`Fetched fee data. maxPriorityFeePerGas=${maxPriorityFeePerGas} maxFeePerGas=${maxFeePerGas}`);
const tx = await opcodeTestContract.connect(account).setGasLimit({
nonce: nonce,
maxPriorityFeePerGas: maxPriorityFeePerGas,
maxFeePerGas: maxFeePerGas,
});
logger.debug(`setGasLimit transaction sent. transactionHash=${tx.hash}`);
const receipt = await tx.wait();
logger.debug(`Transaction receipt received. transactionHash=${tx.hash} status=${receipt?.status}`);
return receipt;
};
const getGasLimit = async (): Promise<bigint> => {
const opcodeTestContract = config.getOpcodeTestContract();
return await opcodeTestContract.getGasLimit();
const gasLimit = await opcodeTestContract.getGasLimit();
logger.debug(`Current gas limit retrieved. gasLimit=${gasLimit}`);
return gasLimit;
};
it.concurrent("Should successfully invoke OpcodeTestContract.setGasLimit()", async () => {
@@ -42,13 +54,15 @@ describe("Gas limit test suite", () => {
// Ok to type assertion here, because txReceipt won't be null if it passed above assertion.
const txBlockNumber = <number>txReceipt?.blockNumber;
logger.info(`Waiting for ${txBlockNumber} to be finalized...`);
logger.debug(`Waiting for block to be finalized... blockNumber=${txBlockNumber}`);
const isBlockFinalized = await pollForContractMethodReturnValueExceedTarget(
lineaRollupV6.currentL2BlockNumber,
BigInt(txBlockNumber),
);
logger.debug(`Block finalized. blockNumber=${txBlockNumber}`);
expect(isBlockFinalized).toEqual(true);
});
@@ -60,13 +74,13 @@ describe("Gas limit test suite", () => {
const account = await l2AccountManager.generateAccount();
const lineaRollupV6 = config.getLineaRollupContract();
logger.info(`Target block gas limit: ${targetBlockGasLimit}`);
logger.debug(`Target block gasLimit=${targetBlockGasLimit}`);
while (!isTargetBlockGasLimitReached) {
const txReceipt = await setGasLimit(account);
expect(txReceipt?.status).toEqual(1);
const blockGasLimit = await getGasLimit();
logger.info("blockGasLimit: ", blockGasLimit);
if (blockGasLimit === targetBlockGasLimit) {
isTargetBlockGasLimitReached = true;
// Ok to type assertion here, because txReceipt won't be null if it passed above assertion.
@@ -75,13 +89,15 @@ describe("Gas limit test suite", () => {
await wait(1000);
}
logger.info(`Waiting for ${blockNumberToCheckFinalization} to be finalized...`);
logger.debug(`Waiting for block to be finalized... blockNumber=${blockNumberToCheckFinalization}`);
const isBlockFinalized = await pollForContractMethodReturnValueExceedTarget(
lineaRollupV6.currentL2BlockNumber,
BigInt(blockNumberToCheckFinalization),
);
logger.debug(`Block finalized. blockNumber=${blockNumberToCheckFinalization}`);
expect(isBlockFinalized).toEqual(true);
// Timeout of 6 hrs
}, 21_600_000);

View File

@@ -13,24 +13,32 @@ describe("Layer 2 test suite", () => {
const account = await l2AccountManager.generateAccount();
const dummyContract = config.getL2DummyContract(account);
await expect(
dummyContract.connect(account).setPayload(ethers.randomBytes(TRANSACTION_CALLDATA_LIMIT)),
).rejects.toThrow("missing revert data");
const oversizedData = ethers.randomBytes(TRANSACTION_CALLDATA_LIMIT);
logger.debug(`Generated oversized transaction data. dataLength=${oversizedData.length}`);
await expect(dummyContract.connect(account).setPayload(oversizedData)).rejects.toThrow("missing revert data");
logger.debug("Transaction correctly reverted due to oversized data.");
});
it.concurrent("Should succeed if transaction data size is below the limit", async () => {
const account = await l2AccountManager.generateAccount();
const dummyContract = config.getL2DummyContract(account);
const nonce = await l2Provider.getTransactionCount(account.address, "pending");
logger.debug(`Fetched nonce. nonce=${nonce} account=${account.address}`);
const { maxPriorityFeePerGas, maxFeePerGas } = await l2Provider.getFeeData();
logger.debug(`Fetched fee data. maxPriorityFeePerGas=${maxPriorityFeePerGas} maxFeePerGas=${maxFeePerGas}`);
const tx = await dummyContract.connect(account).setPayload(ethers.randomBytes(1000), {
nonce: nonce,
maxPriorityFeePerGas: maxPriorityFeePerGas,
maxFeePerGas: maxFeePerGas,
});
logger.debug(`setPayload transaction sent. transactionHash=${tx.hash}`);
const receipt = await tx.wait();
logger.debug(`Transaction receipt received. transactionHash=${tx.hash} status=${receipt?.status}`);
expect(receipt?.status).toEqual(1);
});
@@ -38,17 +46,21 @@ describe("Layer 2 test suite", () => {
const account = await l2AccountManager.generateAccount();
const { gasPrice } = await config.getL2Provider().getFeeData();
logger.debug(`Fetched gasPrice=${gasPrice}`);
const receipt = await (
await account.sendTransaction({
type: 0,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
gasPrice,
value: etherToWei("0.01"),
gasLimit: "0x466124",
chainId: config.getL2ChainId(),
})
).wait();
const tx = await account.sendTransaction({
type: 0,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
gasPrice,
value: etherToWei("0.01"),
gasLimit: "0x466124",
chainId: config.getL2ChainId(),
});
logger.debug(`Legacy transaction sent. transactionHash=${tx.hash}`);
const receipt = await tx.wait();
logger.debug(`Legacy transaction receipt received. transactionHash=${tx.hash} status=${receipt?.status}`);
expect(receipt).not.toBeNull();
});
@@ -57,18 +69,22 @@ describe("Layer 2 test suite", () => {
const account = await l2AccountManager.generateAccount();
const { maxPriorityFeePerGas, maxFeePerGas } = await config.getL2Provider().getFeeData();
logger.debug(`Fetched fee data. maxPriorityFeePerGas=${maxPriorityFeePerGas} maxFeePerGas=${maxFeePerGas}`);
const receipt = await (
await account.sendTransaction({
type: 2,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
maxPriorityFeePerGas,
maxFeePerGas,
value: etherToWei("0.01"),
gasLimit: "21000",
chainId: config.getL2ChainId(),
})
).wait();
const tx = await account.sendTransaction({
type: 2,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
maxPriorityFeePerGas,
maxFeePerGas,
value: etherToWei("0.01"),
gasLimit: "21000",
chainId: config.getL2ChainId(),
});
logger.debug(`EIP1559 transaction sent. transactionHash=${tx.hash}`);
const receipt = await tx.wait();
logger.debug(`EIP1559 transaction receipt received. transactionHash=${tx.hash} status=${receipt?.status}`);
expect(receipt).not.toBeNull();
});
@@ -77,17 +93,23 @@ describe("Layer 2 test suite", () => {
const account = await l2AccountManager.generateAccount();
const { gasPrice } = await config.getL2Provider().getFeeData();
logger.debug(`Fetched gasPrice=${gasPrice}`);
const receipt = await (
await account.sendTransaction({
type: 1,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
gasPrice,
value: etherToWei("0.01"),
gasLimit: "21000",
chainId: config.getL2ChainId(),
})
).wait();
const tx = await account.sendTransaction({
type: 1,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
gasPrice,
value: etherToWei("0.01"),
gasLimit: "21000",
chainId: config.getL2ChainId(),
});
logger.debug(`Empty access list transaction sent. transactionHash=${tx.hash}`);
const receipt = await tx.wait();
logger.debug(
`Empty access list transaction receipt received. transactionHash=${tx.hash} status=${receipt?.status}`,
);
expect(receipt).not.toBeNull();
});
@@ -96,6 +118,8 @@ describe("Layer 2 test suite", () => {
const account = await l2AccountManager.generateAccount();
const { gasPrice } = await config.getL2Provider().getFeeData();
logger.debug(`Fetched gasPrice=${gasPrice}`);
const accessList = {
"0x8D97689C9818892B700e27F316cc3E41e17fBeb9": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
@@ -103,17 +127,19 @@ describe("Layer 2 test suite", () => {
],
};
const receipt = await (
await account.sendTransaction({
type: 1,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
gasPrice,
value: etherToWei("0.01"),
gasLimit: "200000",
chainId: config.getL2ChainId(),
accessList: ethers.accessListify(accessList),
})
).wait();
const tx = await account.sendTransaction({
type: 1,
to: "0x8D97689C9818892B700e27F316cc3E41e17fBeb9",
gasPrice,
value: etherToWei("0.01"),
gasLimit: "200000",
chainId: config.getL2ChainId(),
accessList: ethers.accessListify(accessList),
});
logger.debug(`Access list transaction sent. transactionHash=${tx.hash}`);
const receipt = await tx.wait();
logger.debug(`Access list transaction receipt received. transactionHash=${tx.hash} status=${receipt?.status}`);
expect(receipt).not.toBeNull();
});
@@ -134,6 +160,9 @@ describe("Layer 2 test suite", () => {
for (let i = 0; i < 5; i++) {
const { maxPriorityFeePerGas, maxFeePerGas } = await config.getL2Provider().getFeeData();
logger.debug(
`Fetched fee data. transactionNumber=${i + 1} maxPriorityFeePerGas=${maxPriorityFeePerGas} maxFeePerGas=${maxFeePerGas}`,
);
await (
await account.sendTransaction({
@@ -154,6 +183,9 @@ describe("Layer 2 test suite", () => {
logger.debug(`shomeiBlock=${shomeiBlock}, shomeiFrontendBlock=${shomeiFrontendBlock}`);
expect(shomeiBlock).toBeGreaterThan(shomeiFrontendBlock);
logger.debug(
`shomeiBlock is greater than shomeiFrontendBlock. shomeiBlock=${shomeiBlock} shomeiFrontendBlock=${shomeiFrontendBlock}`,
);
}
}, 150_000);
});

View File

@@ -30,7 +30,12 @@ async function sendL1ToL2Message(
const l1Provider = config.getL1Provider();
const { maxPriorityFeePerGas, maxFeePerGas } = await l1Provider.getFeeData();
logger.debug(`Fetched fee data. maxPriorityFeePerGas=${maxPriorityFeePerGas} maxFeePerGas=${maxFeePerGas}`);
const nonce = await l1Provider.getTransactionCount(l1Account.address, "pending");
logger.debug(`Fetched nonce. nonce=${nonce} account=${l1Account.address}`);
const tx = await lineaRollup.sendMessage(destinationAddress, valueAndFee, calldata, {
value: valueAndFee,
nonce,
@@ -38,12 +43,16 @@ async function sendL1ToL2Message(
maxFeePerGas,
});
logger.debug(`sendMessage transaction sent. transactionHash=${tx.hash}`);
let receipt = await tx.wait();
while (!receipt) {
logger.info("Waiting for transaction to be mined...");
logger.debug(`Waiting for transaction to be mined... transactionHash=${tx.hash}`);
receipt = await tx.wait();
}
logger.debug(`Transaction mined. transactionHash=${tx.hash} status=${receipt.status}`);
return { tx, receipt };
}
@@ -70,7 +79,10 @@ async function sendL2ToL1Message(
const destinationAddress = withCalldata ? await dummyContract.getAddress() : l1Account.address;
const nonce = await l2Provider.getTransactionCount(l2Account.address, "pending");
logger.debug(`Fetched nonce. nonce=${nonce} account=${l2Account.address}`);
const { maxPriorityFeePerGas, maxFeePerGas } = await l2Provider.getFeeData();
logger.debug(`Fetched fee data. maxPriorityFeePerGas=${maxPriorityFeePerGas} maxFeePerGas=${maxFeePerGas}`);
const tx = await l2MessageService.sendMessage(destinationAddress, valueAndFee, calldata, {
value: valueAndFee,
@@ -79,13 +91,17 @@ async function sendL2ToL1Message(
maxFeePerGas,
});
logger.debug(`sendMessage transaction sent. transactionHash=${tx.hash}`);
let receipt = await tx.wait();
while (!receipt) {
logger.info("Waiting for transaction to be mined...");
logger.debug(`Waiting for transaction to be mined... transactionHash=${tx.hash}`);
receipt = await tx.wait();
}
logger.debug(`Transaction mined. transactionHash=${tx.hash} status=${receipt.status}`);
return { tx, receipt };
}
@@ -105,17 +121,19 @@ describe("Messaging test suite", () => {
const [messageSentEvent] = receipt.logs.filter((log) => log.topics[0] === MESSAGE_SENT_EVENT_SIGNATURE);
const messageHash = messageSentEvent.topics[3];
logger.info(`L1 message sent. messageHash=${messageHash} transaction=${JSON.stringify(tx)}`);
logger.debug(`L1 message sent. messageHash=${messageHash} transaction=${JSON.stringify(tx)}`);
logger.info("Waiting for MessageClaimed event on L2.");
logger.debug(`Waiting for MessageClaimed event on L2. messageHash=${messageHash}`);
const l2MessageService = config.getL2MessageServiceContract();
const [messageClaimedEvent] = await waitForEvents(
l2MessageService,
l2MessageService.filters.MessageClaimed(messageHash),
);
logger.info(`Message claimed on L2. event=${JSON.stringify(messageClaimedEvent)}`);
expect(messageClaimedEvent).toBeDefined();
logger.debug(
`Message claimed on L2. messageHash=${messageClaimedEvent.args._messageHash} transactionHash=${messageClaimedEvent.transactionHash}`,
);
},
100_000,
);
@@ -132,16 +150,18 @@ describe("Messaging test suite", () => {
const [messageSentEvent] = receipt.logs.filter((log) => log.topics[0] === MESSAGE_SENT_EVENT_SIGNATURE);
const messageHash = messageSentEvent.topics[3];
logger.info(`L1 message sent. messageHash=${messageHash} transaction=${JSON.stringify(tx)}`);
logger.debug(`L1 message sent. messageHash=${messageHash} transactionHash=${tx.hash}`);
logger.info("Waiting for MessageClaimed event on L2.");
logger.debug(`Waiting for MessageClaimed event on L2. messageHash=${messageHash}`);
const l2MessageService = config.getL2MessageServiceContract();
const [messageClaimedEvent] = await waitForEvents(
l2MessageService,
l2MessageService.filters.MessageClaimed(messageHash),
);
logger.info(`Message claimed on L2. event=${JSON.stringify(messageClaimedEvent)}`);
expect(messageClaimedEvent).toBeDefined();
logger.debug(
`Message claimed on L2. messageHash=${messageClaimedEvent.args._messageHash} transactionHash=${messageClaimedEvent.transactionHash}`,
);
},
100_000,
);
@@ -159,24 +179,26 @@ describe("Messaging test suite", () => {
const [messageSentEvent] = receipt.logs.filter((log) => log.topics[0] === MESSAGE_SENT_EVENT_SIGNATURE);
const messageHash = messageSentEvent.topics[3];
logger.info(`L2 message sent. messageHash=${messageHash} transaction=${JSON.stringify(tx)}`);
logger.debug(`L2 message sent. messageHash=${messageHash} transaction=${JSON.stringify(tx)}`);
logger.info(`Waiting for L2MessagingBlockAnchored with blockNumber=${messageSentEvent.blockNumber}...`);
logger.debug(`Waiting for L2MessagingBlockAnchored event... blockNumber=${messageSentEvent.blockNumber}`);
await waitForEvents(
lineaRollup,
lineaRollup.filters.L2MessagingBlockAnchored(messageSentEvent.blockNumber),
1_000,
);
logger.info("Waiting for MessageClaimed event on L1.");
logger.debug(`Waiting for MessageClaimed event on L1... messageHash=${messageHash}`);
const [messageClaimedEvent] = await waitForEvents(
lineaRollup,
lineaRollup.filters.MessageClaimed(messageHash),
1_000,
);
logger.info(`Message claimed on L1. event=${JSON.stringify(messageClaimedEvent)}`);
expect(messageClaimedEvent).toBeDefined();
logger.debug(
`Message claimed on L1. messageHash=${messageClaimedEvent.args._messageHash} transactionHash=${messageClaimedEvent.transactionHash}`,
);
},
150_000,
);
@@ -194,24 +216,27 @@ describe("Messaging test suite", () => {
const [messageSentEvent] = receipt.logs.filter((log) => log.topics[0] === MESSAGE_SENT_EVENT_SIGNATURE);
const messageHash = messageSentEvent.topics[3];
logger.info(`L2 message sent. messageHash=${messageHash} transaction=${JSON.stringify(tx)}`);
logger.debug(`L2 message sent. messageHash=${messageHash} transaction=${JSON.stringify(tx)}`);
logger.info(`Waiting for L2MessagingBlockAnchored with blockNumber=${messageSentEvent.blockNumber}...`);
logger.debug(`Waiting for L2MessagingBlockAnchored event... blockNumber=${messageSentEvent.blockNumber}`);
await waitForEvents(
lineaRollup,
lineaRollup.filters.L2MessagingBlockAnchored(messageSentEvent.blockNumber),
1_000,
);
logger.info("Waiting for MessageClaimed event on L1.");
logger.debug(`Waiting for MessageClaimed event on L1. messageHash=${messageHash}`);
const [messageClaimedEvent] = await waitForEvents(
lineaRollup,
lineaRollup.filters.MessageClaimed(messageHash),
1_000,
);
logger.info(`Message claimed on L1. event=${JSON.stringify(messageClaimedEvent)}`);
expect(messageClaimedEvent).toBeDefined();
logger.debug(
`Message claimed on L1. messageHash=${messageClaimedEvent.args._messageHash} transactionHash=${messageClaimedEvent.transactionHash}`,
);
},
150_000,
);

View File

@@ -17,13 +17,13 @@ let coordinatorHasRestarted = false;
async function waitForCoordinatorRestart(logger: Logger) {
testsWaitingForRestart += 1;
while (testsWaitingForRestart < TOTAL_TESTS_WAITING) {
logger.info("Both tests have reached the restart point. Restarting coordinator...");
logger.debug("Both tests have reached the restart point. Restarting coordinator...");
await wait(1_000);
if (!coordinatorHasRestarted) {
coordinatorHasRestarted = true;
try {
await execDockerCommand("restart", "coordinator");
logger.info("Coordinator restarted.");
logger.debug("Coordinator restarted.");
return;
} catch (error) {
logger.error(`Failed to restart coordinator: ${error}`);
@@ -40,7 +40,7 @@ describe("Coordinator restart test suite", () => {
"When the coordinator restarts it should resume blob submission and finalization",
async () => {
if (process.env.TEST_ENV !== "local") {
logger.info("Skipping test because it's not running on a local environment.");
logger.warn("Skipping test because it's not running on a local environment.");
return;
}
const lineaRollup = config.getLineaRollupContract();
@@ -54,6 +54,13 @@ describe("Coordinator restart test suite", () => {
const lastDataSubmittedEventBeforeRestart = dataSubmittedEventsBeforeRestart.slice(-1)[0];
const lastDataFinalizedEventsBeforeRestart = dataFinalizedEventsBeforeRestart.slice(-1)[0];
logger.debug(
`DataSubmittedV3 event before coordinator restart found. event=${JSON.stringify(lastDataSubmittedEventBeforeRestart)}`,
);
logger.debug(
`DataFinalizedV3 event before coordinator restart found. event=${JSON.stringify(lastDataFinalizedEventsBeforeRestart)}`,
);
// Just some sanity checks
// Check that the coordinator has submitted and finalized data before the restart
expect(lastDataSubmittedEventBeforeRestart.blockNumber).toBeGreaterThan(0n);
@@ -63,7 +70,7 @@ describe("Coordinator restart test suite", () => {
const currentBlockNumberAfterRestart = await l1Provider.getBlockNumber();
logger.info("Waiting for DataSubmittedV3 event after coordinator restart...");
logger.debug("Waiting for DataSubmittedV3 event after coordinator restart...");
const [dataSubmittedV3EventAfterRestart] = await waitForEvents(
lineaRollup,
lineaRollup.filters.DataSubmittedV3(),
@@ -72,9 +79,11 @@ describe("Coordinator restart test suite", () => {
"latest",
async (events) => events.filter((event) => event.blockNumber > lastDataSubmittedEventBeforeRestart.blockNumber),
);
logger.info(`New DataSubmittedV3 event found. event=${JSON.stringify(dataSubmittedV3EventAfterRestart)}`);
logger.debug(
`DataSubmittedV3 event after coordinator restart found. event=${JSON.stringify(dataSubmittedV3EventAfterRestart)}`,
);
logger.info("Waiting for DataFinalized event after coordinator restart...");
logger.debug("Waiting for DataFinalizedV3 event after coordinator restart...");
const [dataFinalizedEventAfterRestart] = await waitForEvents(
lineaRollup,
lineaRollup.filters.DataFinalizedV3(),
@@ -86,7 +95,9 @@ describe("Coordinator restart test suite", () => {
(event) => event.args.endBlockNumber > lastDataFinalizedEventsBeforeRestart.args.endBlockNumber,
),
);
logger.info(`New DataFinalized event found. event=${JSON.stringify(dataFinalizedEventAfterRestart)}`);
logger.debug(
`DataFinalizedV3 event after coordinator restart found. event=${JSON.stringify(dataFinalizedEventAfterRestart)}`,
);
expect(dataFinalizedEventAfterRestart.args.endBlockNumber).toBeGreaterThan(
lastDataFinalizedEventsBeforeRestart.args.endBlockNumber,
@@ -99,7 +110,7 @@ describe("Coordinator restart test suite", () => {
"When the coordinator restarts it should resume anchoring",
async () => {
if (process.env.TEST_ENV !== "local") {
logger.info("Skipping test because it's not running on a local environment.");
logger.warn("Skipping test because it's not running on a local environment.");
return;
}
@@ -117,7 +128,9 @@ describe("Coordinator restart test suite", () => {
const l1MessagesPromises = [];
let l1MessageSenderNonce = await l1Provider.getTransactionCount(l1MessageSender.address);
const { maxPriorityFeePerGas, maxFeePerGas } = await l1Provider.getFeeData();
logger.debug(`Fetched fee data. maxPriorityFeePerGas=${maxPriorityFeePerGas} maxFeePerGas=${maxFeePerGas}`);
logger.debug("Sending messages L1 -> L2 before coordinator restart...");
for (let i = 0; i < 5; i++) {
l1MessagesPromises.push(
sendMessage(
@@ -145,7 +158,7 @@ describe("Coordinator restart test suite", () => {
// Wait for L2 Anchoring
const lastNewL1MessageNumber = l1Messages.slice(-1)[0].messageNumber;
logger.info(`Waiting for L1->L2 anchoring. messageNumber=${lastNewL1MessageNumber}`);
logger.debug(`Waiting for L1->L2 anchoring before coordinator restart. messageNumber=${lastNewL1MessageNumber}`);
await waitForEvents(
l2MessageService,
l2MessageService.filters.RollingHashUpdated(),
@@ -161,6 +174,7 @@ describe("Coordinator restart test suite", () => {
await waitForCoordinatorRestart(logger);
const l1Fees = await l1Provider.getFeeData();
logger.debug("Sending messages L1 -> L2 after coordinator restart...");
// Send more messages L1 -> L2
for (let i = 0; i < 5; i++) {
l1MessagesPromises.push(
@@ -189,7 +203,7 @@ describe("Coordinator restart test suite", () => {
// Wait for messages to be anchored on L2
const lastNewL1MessageNumberAfterRestart = l1MessagesAfterRestart.slice(-1)[0].messageNumber;
logger.info(
logger.debug(
`Waiting for L1->L2 anchoring after coordinator restart. messageNumber=${lastNewL1MessageNumberAfterRestart}`,
);
const [rollingHashUpdatedEventAfterRestart] = await waitForEvents(

View File

@@ -21,7 +21,7 @@ describe("Submission and finalization test suite", () => {
const l1MessageSender = new NonceManager(await l1AccountManager.generateAccount());
const lineaRollup = config.getLineaRollupContract();
logger.info("Sending messages on L1");
logger.debug("Sending messages on L1...");
// Send L1 messages
const l1MessagesPromises = [];
@@ -45,7 +45,7 @@ describe("Submission and finalization test suite", () => {
const l1Receipts = await Promise.all(l1MessagesPromises);
logger.info("Messages sent on L1.");
logger.debug("Messages sent on L1.");
// Extract message events
const l1Messages = getMessageSentEventFromLogs(lineaRollup, l1Receipts);
@@ -65,7 +65,7 @@ describe("Submission and finalization test suite", () => {
// Wait for the last L1->L2 message to be anchored on L2
const lastNewL1MessageNumber = l1Messages.slice(-1)[0].messageNumber;
logger.info("Waiting for the anchoring using rolling hash...");
logger.debug(`Waiting for the anchoring using rolling hash... messageNumber=${lastNewL1MessageNumber}`);
const [rollingHashUpdatedEvent] = await waitForEvents(
l2MessageService,
l2MessageService.filters.RollingHashUpdated(),
@@ -82,7 +82,7 @@ describe("Submission and finalization test suite", () => {
expect(lastNewMessageRollingHash).toEqual(rollingHashUpdatedEvent.args.rollingHash);
expect(lastAnchoredL1MessageNumber).toEqual(rollingHashUpdatedEvent.args.messageNumber);
logger.info("New anchoring using rolling hash done.");
logger.debug(`New anchoring using rolling hash done. rollingHash=${lastNewMessageRollingHash}`);
},
150_000,
);
@@ -94,10 +94,10 @@ describe("Submission and finalization test suite", () => {
const currentL2BlockNumber = await lineaRollupV6.currentL2BlockNumber();
logger.info("Waiting for DataSubmittedV3 used to finalize with proof...");
logger.debug("Waiting for DataSubmittedV3 used to finalize with proof...");
await waitForEvents(lineaRollupV6, lineaRollupV6.filters.DataSubmittedV3(), 1_000);
logger.info("Waiting for the first DataFinalizedV3 event with proof...");
logger.debug("Waiting for DataFinalizedV3 event with proof...");
const [dataFinalizedEvent] = await waitForEvents(
lineaRollupV6,
lineaRollupV6.filters.DataFinalizedV3(currentL2BlockNumber + 1n),
@@ -112,7 +112,7 @@ describe("Submission and finalization test suite", () => {
expect(lastBlockFinalized).toBeGreaterThanOrEqual(dataFinalizedEvent.args.endBlockNumber);
expect(newStateRootHash).toEqual(dataFinalizedEvent.args.finalStateRootHash);
logger.info("Finalization with proof done.");
logger.debug(`Finalization with proof done. lastFinalizedBlockNumber=${lastBlockFinalized}`);
},
150_000,
);
@@ -122,7 +122,7 @@ describe("Submission and finalization test suite", () => {
async () => {
const sequencerEndpoint = config.getSequencerEndpoint();
if (!sequencerEndpoint) {
logger.info('Skipped the "Check L2 safe/finalized tag update on sequencer" test');
logger.warn('Skipped the "Check L2 safe/finalized tag update on sequencer" test');
return;
}
@@ -147,7 +147,7 @@ describe("Submission and finalization test suite", () => {
expect(safeL2BlockNumber).toBeGreaterThanOrEqual(lastFinalizedL2BlockNumberOnL1);
expect(finalizedL2BlockNumber).toBeGreaterThanOrEqual(lastFinalizedL2BlockNumberOnL1);
logger.info("L2 safe/finalized tag update on sequencer done.");
logger.debug("L2 safe/finalized tag update on sequencer done.");
},
150_000,
);

View File

@@ -30,7 +30,7 @@ describe("Transaction exclusion test suite", () => {
await l2AccountLocal.sendTransaction(txRequest);
} catch (err) {
// This shall return error with traces limit overflow
logger.debug(`sendTransaction expected err: ${JSON.stringify(err)}`);
logger.debug(`sendTransaction expected. error=${JSON.stringify(err)}`);
}
expect(rejectedTxHash).toBeDefined();
@@ -42,6 +42,8 @@ describe("Transaction exclusion test suite", () => {
getResponse = await transactionExclusionClient.getTransactionExclusionStatusV1(rejectedTxHash!);
} while (!getResponse?.result);
logger.debug(`Transaction exclusion status received. response=${JSON.stringify(getResponse.result)}`);
expect(getResponse.result.txHash).toStrictEqual(rejectedTxHash);
expect(getResponse.result.txRejectionStage).toStrictEqual("RPC");
expect(getResponse.result.from.toLowerCase()).toStrictEqual(l2AccountLocal.address.toLowerCase());
@@ -68,6 +70,8 @@ describe("Transaction exclusion test suite", () => {
getResponse = await transactionExclusionClient.getTransactionExclusionStatusV1(rejectedTxHash);
} while (!getResponse?.result);
logger.debug(`Transaction exclusion status received. response=${JSON.stringify(getResponse.result)}`);
expect(getResponse.result.txHash).toStrictEqual(rejectedTxHash);
expect(getResponse.result.txRejectionStage).toStrictEqual("SEQUENCER");
expect(getResponse.result.from.toLowerCase()).toStrictEqual(l2AccountLocal.address.toLowerCase());