Skip to content

Commit

Permalink
fix: Test clean up.
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Badiere <[email protected]>

fix: clean up of experimental code.

Signed-off-by: Eric Badiere <[email protected]>
  • Loading branch information
ebadiere committed Nov 13, 2024
1 parent 734ad20 commit 1938973
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/relay/src/lib/services/hbarLimitService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class HbarLimitService implements IHbarLimitService {
};

/**
* Disables the rate limiter.
* Flag to turn off the HBarRateLimitService.
* @private
*/
private readonly disableRateLimiter: boolean = false;
Expand Down
26 changes: 4 additions & 22 deletions packages/server/tests/acceptance/hbarLimiter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,24 +898,6 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () {
'HBAR_RATE_LIMIT_TINYBAR',
)}`,
);

const initialAccount: AliasAccount = global.accounts[0];

const neededAccounts: number = 1;
accounts.push(
...(await Utils.createMultipleAliasAccounts(
mirrorNode,
initialAccount,
neededAccounts,
initialBalance,
requestDetails,
)),
);
global.accounts.push(...accounts);
const basicPlans = await hbarSpendingPlanRepository.findAllActiveBySubscriptionTier(
[SubscriptionTier.BASIC],
requestDetails,
);
});

it('should eventually exhaust the hbar limit for a BASIC user after multiple deployments of large contracts, and not throw an error', async function () {
Expand All @@ -926,14 +908,14 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () {
let hbarSpendingPlan: IDetailedHbarSpendingPlan | null = null;

for (deploymentCounts = 0; deploymentCounts < 3; deploymentCounts++) {
const tx = await deployContract(largeContractJson, accounts[0].wallet);
const tx = await deployContract(largeContractJson, global.accounts[0].wallet);
await tx.waitForDeployment();

expectedTxCost ||= await getExpectedCostOfLastLargeTx(largeContractJson.bytecode);

if (!hbarSpendingPlan) {
const ethSpendingPlan = await ethAddressSpendingPlanRepository.findByAddress(
accounts[0].wallet.address,
global.accounts[0].wallet.address,
requestDetails,
);
hbarSpendingPlan = await hbarSpendingPlanRepository.findByIdWithDetails(
Expand All @@ -946,7 +928,7 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () {
}
if (!hbarSpendingPlan) {
const ethSpendingPlan = await ethAddressSpendingPlanRepository.findByAddress(
accounts[0].wallet.address,
global.accounts[0].wallet.address,
requestDetails,
);
hbarSpendingPlan = await hbarSpendingPlanRepository.findByIdWithDetails(
Expand All @@ -964,7 +946,7 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () {

// Confirm that deployments continued even after the limit was exhausted
expect(deploymentCounts).to.be.gte(1);
await expect(deployContract(largeContractJson, accounts[0].wallet)).to.be.fulfilled;
await expect(deployContract(largeContractJson, global.accounts[0].wallet)).to.be.fulfilled;
});
});
}
Expand Down

0 comments on commit 1938973

Please sign in to comment.