fix: use ethers.js event interface parsing for escrowId extraction
Some checks failed
Contract Performance Benchmarks / benchmark-gas-usage (push) Has been skipped
Contract Performance Benchmarks / benchmark-execution-time (push) Has been skipped
Contract Performance Benchmarks / benchmark-throughput (push) Has been skipped
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Failing after 6s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 8s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Failing after 7s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Contract Performance Benchmarks / compare-benchmarks (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Failing after 1m19s
Deploy to Testnet / notify-deployment (push) Successful in 7s

- Replace direct topics[1] access with escrowService.interface.parseLog()
- Use event.args[0] to extract escrowId from parsed event
- Update all beforeEach hooks and time lock test to use proper event parsing
- This fixes 'Escrow does not exist' errors caused by invalid escrowId extraction
This commit is contained in:
aitbc
2026-04-29 13:33:27 +02:00
parent 98e112e26f
commit 0ad7585f95

View File

@@ -95,7 +95,8 @@ describe("EscrowService", function () {
); );
const receipt = await tx.wait(); const receipt = await tx.wait();
const escrowId = ethers.getBigInt(receipt.logs[0].topics[1]); const event = escrowService.interface.parseLog(receipt.logs[0]);
const escrowId = event.args[0];
expect(escrowId).to.not.be.undefined; expect(escrowId).to.not.be.undefined;
}); });
@@ -156,7 +157,8 @@ describe("EscrowService", function () {
"Test escrow" "Test escrow"
); );
const receipt = await tx.wait(); const receipt = await tx.wait();
escrowId = ethers.getBigInt(receipt.logs[0].topics[1]); const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
}); });
it("Should skip - fundEscrow not implemented", async function () { it("Should skip - fundEscrow not implemented", async function () {
@@ -189,7 +191,8 @@ describe("EscrowService", function () {
"Test escrow" "Test escrow"
); );
const receipt = await tx.wait(); const receipt = await tx.wait();
escrowId = ethers.getBigInt(receipt.logs[0].topics[1]); const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
}); });
it("Should release escrow to beneficiary", async function () { it("Should release escrow to beneficiary", async function () {
@@ -220,7 +223,8 @@ describe("EscrowService", function () {
"Test escrow" "Test escrow"
); );
const receipt = await tx.wait(); const receipt = await tx.wait();
const newEscrowId = ethers.getBigInt(receipt.logs[0].topics[1]); const event = escrowService.interface.parseLog(receipt.logs[0]);
const newEscrowId = event.args[0];
await expect( await expect(
escrowService.connect(depositor).releaseEscrow(newEscrowId, "Service completed") escrowService.connect(depositor).releaseEscrow(newEscrowId, "Service completed")
@@ -242,7 +246,8 @@ describe("EscrowService", function () {
"Test escrow" "Test escrow"
); );
const receipt = await tx.wait(); const receipt = await tx.wait();
escrowId = ethers.getBigInt(receipt.logs[0].topics[1]); const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
}); });
it("Should refund escrow to depositor", async function () { it("Should refund escrow to depositor", async function () {
@@ -309,7 +314,8 @@ describe("EscrowService", function () {
"Test escrow" "Test escrow"
); );
const receipt = await tx.wait(); const receipt = await tx.wait();
escrowId = ethers.getBigInt(receipt.logs[0].topics[1]); const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
}); });
it("Should get escrow details", async function () { it("Should get escrow details", async function () {