Skip to content

Commit

Permalink
feat: added explicitly assertion if tx exclusion is not defined and s…
Browse files Browse the repository at this point in the history
…implify the localStackPostgresDbOnly in build.gradle
  • Loading branch information
jonesho committed Oct 18, 2024
1 parent ceb57ce commit 2040841
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,12 @@ dockerCompose {
startedServices = [
"postgres"
]
composeAdditionalArgs = ["--profile", "l2", "--profile", "l1"]
useComposeFiles = ["${project.rootDir.path}/docker/compose.yml"]
waitForHealthyStateTimeout = Duration.ofMinutes(3)
waitForTcpPorts = false
removeOrphans = true
noRecreate = true
projectName = "docker"
environment.put("L1_GENESIS_TIME", "${Instant.now().plusSeconds(3).getEpochSecond()}")
}
}

Expand Down
22 changes: 8 additions & 14 deletions e2e/src/transaction-exclusion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ describe("Transaction exclusion test suite", () => {
it.concurrent(
"Should get the status of the rejected transaction reported from Besu RPC node",
async () => {
if (!config.getTransactionExclusionEndpoint()) {
// Skip this test if transaction exclusion endpoint is not defined
return;
}
expect(config.getTransactionExclusionEndpoint()).toBeDefined();

const transactionExclusionClient = new TransactionExclusionClient(config.getTransactionExclusionEndpoint()!!);
const l2Account = await l2AccountManager.generateAccount();
const l2AccountLocal = getWallet(l2Account.privateKey, config.getL2BesuNodeProvider()!!);
const testContract = config.getL2TestContract(l2AccountLocal)!!;

// This shall be rejected by the Besu node due to traces module limit overflow
let rejectedTxHash = "";
let rejectedTxHash;
try {
const txRequest: TransactionRequest = {
to: await testContract.getAddress(),
Expand All @@ -32,16 +29,16 @@ describe("Transaction exclusion test suite", () => {
await l2AccountLocal.sendTransaction(txRequest);
} catch (err) {
// This shall return error with traces limit overflow
console.log(`sendTransaction expected err: ${JSON.stringify(err)}`);
console.debug(`sendTransaction expected err: ${JSON.stringify(err)}`);
}

expect(!!rejectedTxHash).toBeTruthy();
expect(rejectedTxHash).toBeDefined();
console.log(`rejectedTxHash (RPC): ${rejectedTxHash}`);

let getResponse;
do {
await wait(5_000);
getResponse = await transactionExclusionClient.getTransactionExclusionStatusV1(rejectedTxHash);
await wait(1_000);
getResponse = await transactionExclusionClient.getTransactionExclusionStatusV1(rejectedTxHash!);
} while (!getResponse?.result);

expect(getResponse.result.txHash).toStrictEqual(rejectedTxHash);
Expand All @@ -52,10 +49,7 @@ describe("Transaction exclusion test suite", () => {
);

it.skip("Should get the status of the rejected transaction reported from Besu SEQUENCER node", async () => {
if (!config.getTransactionExclusionEndpoint()) {
// Skip this test if transaction exclusion endpoint is not defined
return;
}
expect(config.getTransactionExclusionEndpoint()).toBeDefined();

const transactionExclusionClient = new TransactionExclusionClient(config.getTransactionExclusionEndpoint()!!);
const l2Account = await l2AccountManager.generateAccount();
Expand All @@ -69,7 +63,7 @@ describe("Transaction exclusion test suite", () => {

let getResponse;
do {
await wait(5_000);
await wait(1_000);
getResponse = await transactionExclusionClient.getTransactionExclusionStatusV1(rejectedTxHash);
} while (!getResponse?.result);

Expand Down

0 comments on commit 2040841

Please sign in to comment.