fix: use return value from createEscrow instead of event parsing
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 7s
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 6s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Deploy to Testnet / deploy-testnet (push) Failing after 1m18s
Contract Performance Benchmarks / compare-benchmarks (push) Has been skipped
Deploy to Testnet / notify-deployment (push) Successful in 7s
P2P Network Verification / p2p-verification (push) Successful in 2s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 2s
Blockchain Synchronization Verification / sync-verification (push) Failing after 2s

- Replace event log parsing with direct use of createEscrow return value
- createEscrow function returns escrowId as uint256
- This avoids event parsing issues and provides reliable escrowId extraction
- Update all beforeEach hooks and time lock test to use return value
This commit is contained in:
aitbc
2026-04-29 13:35:48 +02:00
parent 0ad7585f95
commit de52315d81

View File

@@ -84,7 +84,7 @@ describe("EscrowService", function () {
describe("Escrow Creation", function () {
it("Should create standard escrow", async function () {
const tx = await escrowService.connect(depositor).createEscrow(
const escrowId = await escrowService.connect(depositor).createEscrow(
beneficiary.address,
arbiter.address,
ESCROW_AMOUNT,
@@ -93,10 +93,6 @@ describe("EscrowService", function () {
0, // Immediate release
"Test escrow"
);
const receipt = await tx.wait();
const event = escrowService.interface.parseLog(receipt.logs[0]);
const escrowId = event.args[0];
expect(escrowId).to.not.be.undefined;
});
@@ -147,7 +143,7 @@ describe("EscrowService", function () {
let escrowId;
beforeEach(async function () {
const tx = await escrowService.connect(depositor).createEscrow(
escrowId = await escrowService.connect(depositor).createEscrow(
beneficiary.address,
arbiter.address,
ESCROW_AMOUNT,
@@ -156,9 +152,6 @@ describe("EscrowService", function () {
0,
"Test escrow"
);
const receipt = await tx.wait();
const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
});
it("Should skip - fundEscrow not implemented", async function () {
@@ -181,7 +174,7 @@ describe("EscrowService", function () {
let escrowId;
beforeEach(async function () {
const tx = await escrowService.connect(depositor).createEscrow(
escrowId = await escrowService.connect(depositor).createEscrow(
beneficiary.address,
arbiter.address,
ESCROW_AMOUNT,
@@ -190,9 +183,6 @@ describe("EscrowService", function () {
0,
"Test escrow"
);
const receipt = await tx.wait();
const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
});
it("Should release escrow to beneficiary", async function () {
@@ -213,7 +203,7 @@ describe("EscrowService", function () {
it("Should revert if time lock not passed", async function () {
// Create new escrow
const latestTime = await ethers.provider.getBlock('latest').then(b => b.timestamp);
const tx = await escrowService.connect(depositor).createEscrow(
const newEscrowId = await escrowService.connect(depositor).createEscrow(
beneficiary.address,
arbiter.address,
ESCROW_AMOUNT,
@@ -222,9 +212,6 @@ describe("EscrowService", function () {
latestTime + 3600,
"Test escrow"
);
const receipt = await tx.wait();
const event = escrowService.interface.parseLog(receipt.logs[0]);
const newEscrowId = event.args[0];
await expect(
escrowService.connect(depositor).releaseEscrow(newEscrowId, "Service completed")
@@ -236,7 +223,7 @@ describe("EscrowService", function () {
let escrowId;
beforeEach(async function () {
const tx = await escrowService.connect(depositor).createEscrow(
escrowId = await escrowService.connect(depositor).createEscrow(
beneficiary.address,
arbiter.address,
ESCROW_AMOUNT,
@@ -245,9 +232,6 @@ describe("EscrowService", function () {
0,
"Test escrow"
);
const receipt = await tx.wait();
const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
});
it("Should refund escrow to depositor", async function () {
@@ -304,7 +288,7 @@ describe("EscrowService", function () {
let escrowId;
beforeEach(async function () {
const tx = await escrowService.connect(depositor).createEscrow(
escrowId = await escrowService.connect(depositor).createEscrow(
beneficiary.address,
arbiter.address,
ESCROW_AMOUNT,
@@ -313,9 +297,6 @@ describe("EscrowService", function () {
0,
"Test escrow"
);
const receipt = await tx.wait();
const event = escrowService.interface.parseLog(receipt.logs[0]);
escrowId = event.args[0];
});
it("Should get escrow details", async function () {