Skip to content

Commit

Permalink
yearn for the urn
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Dec 5, 2024
1 parent 6304fae commit 6f796c8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions yarn-project/end-to-end/src/spartan/gating-passive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const {
SPARTAN_DIR,
INSTANCE_NAME,
} = config;
const debugLogger = createDebugLogger('aztec:spartan-test:reorg');
const debugLogger = createDebugLogger('aztec:spartan-test:gating-passive');

describe('a test that passively observes the network in the presence of network chaos', () => {
jest.setTimeout(60 * 60 * 1000); // 60 minutes
Expand Down Expand Up @@ -126,14 +126,16 @@ describe('a test that passively observes the network in the presence of network
await sleep(Number(epochDuration * slotDuration) * 1000);
const newTips = await rollupCheatCodes.getTips();

const expectedPending =
controlTips.pending + BigInt(Math.floor((1 - MAX_MISSED_SLOT_PERCENT) * Number(epochDuration)));
expect(newTips.pending).toBeGreaterThan(expectedPending);
// calculate the percentage of slots missed
const perfectPending = controlTips.pending + BigInt(Math.floor(Number(epochDuration)));
const missedSlots = Number(perfectPending) - Number(newTips.pending);
const missedSlotsPercentage = (missedSlots / Number(epochDuration)) * 100;
debugLogger.info(`Missed ${missedSlots} slots, ${missedSlotsPercentage.toFixed(2)}%`);

// Ensure we missed at most the max allowed slots
// This is in place to ensure that we don't have a bad regression in the network
const maxMissedSlots = Math.floor(Number(epochDuration) * MAX_MISSED_SLOT_PERCENT);
expect(missedSlots).toBeLessThanOrEqual(maxMissedSlots);
}
});
});

0 comments on commit 6f796c8

Please sign in to comment.