From 9afe7c21cf3389974d865468a3b88b354c42bdb2 Mon Sep 17 00:00:00 2001 From: Logan Nguyen Date: Fri, 25 Oct 2024 12:44:42 -0400 Subject: [PATCH] test: added e2e test for EXTENDED and PRIVILEGED tier users (#3147) * test: added e2e test for privileged tier users Signed-off-by: Logan Nguyen * fix: generalized test cases Signed-off-by: Logan Nguyen * fix: renamed test suite Signed-off-by: Logan Nguyen Co-authored-by: Victor Yanev <161485803+victor-yanev@users.noreply.github.com> Signed-off-by: Logan Nguyen * chore: renamed test suite Signed-off-by: Logan Nguyen Co-authored-by: Victor Yanev <161485803+victor-yanev@users.noreply.github.com> Signed-off-by: Logan Nguyen * fix: fixed preconfigured plans test logic Signed-off-by: Logan Nguyen * chore: added more evmAddresses to config file Signed-off-by: Logan Nguyen * fix: moved confirming plan's validity logic to createAliasForNonBasicPlans() Signed-off-by: Logan Nguyen * chore: renamed test case Signed-off-by: Logan Nguyen Co-authored-by: Victor Yanev <161485803+victor-yanev@users.noreply.github.com> Signed-off-by: Logan Nguyen * chore: added tolerance var Signed-off-by: Logan Nguyen Co-authored-by: Victor Yanev <161485803+victor-yanev@users.noreply.github.com> Signed-off-by: Logan Nguyen * chore: reused fileAppendChunkSize Signed-off-by: Logan Nguyen * fix: added reusable test cases for both EXTENDED and PRIVILEGED tiers Signed-off-by: Logan Nguyen * fix: override spending limit env vars in acceptancetest:hbarlimiter script, with lower HBAR limits, to improve test performance Override spending limit environment variables in the `acceptancetest:hbarlimiter` script to set lower HBAR limits at boot time. The HbarLimiter test suite includes several tests that exhaust the total HBAR limit for multiple plans, and using high spending limits can generate unnecessary traffic on the local node and extend the test duration. Overriding with lower limit values improves performance and reduces test execution time. Signed-off-by: Logan Nguyen * chore: added more information to HBAR Rate Limit warning log Signed-off-by: Logan Nguyen * test: added checks to make sure tiered users can deploy a certain amount of large contracts Signed-off-by: Logan Nguyen --------- Signed-off-by: Logan Nguyen Signed-off-by: Logan Nguyen Co-authored-by: Victor Yanev <161485803+victor-yanev@users.noreply.github.com> --- package.json | 2 +- .../lib/services/hbarLimitService/index.ts | 6 +- .../tests/acceptance/hbarLimiter.spec.ts | 198 ++++++++++++++++-- packages/server/tests/localAcceptance.env | 1 + .../server/tests/previewnetAcceptance.env | 1 + .../server/tests/testSpendingPlansConfig.json | 32 +++ packages/server/tests/testnetAcceptance.env | 1 + 7 files changed, 220 insertions(+), 21 deletions(-) create mode 100644 packages/server/tests/testSpendingPlansConfig.json diff --git a/package.json b/package.json index c0c8ef3aa8..90dd6d24db 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "acceptancetest:api_batch3": "nyc ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@api-batch-3' --exit", "acceptancetest:erc20": "nyc ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@erc20' --exit", "acceptancetest:ratelimiter": "nyc ts-mocha packages/ws-server/tests/acceptance/index.spec.ts -g '@web-socket-ratelimiter' --exit && ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@ratelimiter' --exit", - "acceptancetest:hbarlimiter": "nyc ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@hbarlimiter' --exit", + "acceptancetest:hbarlimiter": "HBAR_RATE_LIMIT_TINYBAR=5000000000 HBAR_RATE_LIMIT_BASIC=1000000000 HBAR_RATE_LIMIT_EXTENDED=1500000000 HBAR_RATE_LIMIT_PRIVILEGED=2000000000 nyc ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@hbarlimiter' --exit", "acceptancetest:tokencreate": "nyc ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@tokencreate' --exit", "acceptancetest:tokenmanagement": "nyc ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@tokenmanagement' --exit", "acceptancetest:htsprecompilev1": "nyc ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@htsprecompilev1' --exit", diff --git a/packages/relay/src/lib/services/hbarLimitService/index.ts b/packages/relay/src/lib/services/hbarLimitService/index.ts index 0f56545393..9c469ba32c 100644 --- a/packages/relay/src/lib/services/hbarLimitService/index.ts +++ b/packages/relay/src/lib/services/hbarLimitService/index.ts @@ -209,7 +209,11 @@ export class HbarLimitService implements IHbarLimitService { exceedsLimit ? 'has' : 'has NOT' } exceeded HBAR rate limit threshold: user=${user}, amountSpent=${ spendingPlan.amountSpent - }, estimatedTxFee=${estimatedTxFee}, spendingLimit=${spendingLimit}, txConstructorName=${txConstructorName}, mode=${mode}, methodName=${methodName}`, + }, estimatedTxFee=${estimatedTxFee}, spendingLimit=${spendingLimit}, spandingPlanId=${ + spendingPlan.id + }, subscriptionTier=${ + spendingPlan.subscriptionTier + }, txConstructorName=${txConstructorName}, mode=${mode}, methodName=${methodName}`, ); return exceedsLimit; diff --git a/packages/server/tests/acceptance/hbarLimiter.spec.ts b/packages/server/tests/acceptance/hbarLimiter.spec.ts index 4e988360d9..78d69b2e84 100644 --- a/packages/server/tests/acceptance/hbarLimiter.spec.ts +++ b/packages/server/tests/acceptance/hbarLimiter.spec.ts @@ -22,6 +22,7 @@ import fs from 'fs'; import { expect } from 'chai'; import { resolve } from 'path'; import { Logger } from 'pino'; +import findConfig from 'find-config'; import { Registry } from 'prom-client'; import dotenv, { config } from 'dotenv'; import { BaseContract, ethers } from 'ethers'; @@ -35,15 +36,14 @@ import RelayClient from '../clients/relayClient'; import MirrorClient from '../clients/mirrorClient'; import MetricsClient from '../clients/metricsClient'; import { AliasAccount } from '../types/AliasAccount'; -import { - estimateFileTransactionsFee, - overrideEnvsInMochaDescribe -} from '@hashgraph/json-rpc-relay/tests/helpers'; import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services'; import { ITransfer, RequestDetails } from '@hashgraph/json-rpc-relay/dist/lib/types'; +import { SpendingPlanConfig } from '@hashgraph/json-rpc-relay/src/lib/types/spendingPlanConfig'; import { HbarLimitService } from '@hashgraph/json-rpc-relay/dist/lib/services/hbarLimitService'; import { CacheService } from '@hashgraph/json-rpc-relay/dist/lib/services/cacheService/cacheService'; import { SubscriptionTier } from '@hashgraph/json-rpc-relay/dist/lib/db/types/hbarLimiter/subscriptionTier'; +import { estimateFileTransactionsFee, overrideEnvsInMochaDescribe } from '@hashgraph/json-rpc-relay/tests/helpers'; +import { IDetailedHbarSpendingPlan } from '@hashgraph/json-rpc-relay/dist/lib/db/types/hbarLimiter/hbarSpendingPlan'; import { HbarSpendingPlanRepository } from '@hashgraph/json-rpc-relay/dist/lib/db/repositories/hbarLimiter/hbarSpendingPlanRepository'; import { IPAddressHbarSpendingPlanRepository } from '@hashgraph/json-rpc-relay/dist/lib/db/repositories/hbarLimiter/ipAddressHbarSpendingPlanRepository'; import { EthAddressHbarSpendingPlanRepository } from '@hashgraph/json-rpc-relay/dist/lib/db/repositories/hbarLimiter/ethAddressHbarSpendingPlanRepository'; @@ -74,11 +74,15 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { metrics: MetricsClient; relayIsLocal: boolean; } = global; + const mockTTL = 60000; // 60 secs const operatorAccount = ConfigService.get('OPERATOR_ID_MAIN') || DOT_ENV.OPERATOR_ID_MAIN || ''; const fileAppendChunkSize = Number(ConfigService.get('FILE_APPEND_CHUNK_SIZE')) || 5120; const requestId = 'hbarLimiterTest'; const requestDetails = new RequestDetails({ requestId: requestId, ipAddress: '0.0.0.0' }); const cacheService = new CacheService(logger.child({ name: 'cache-service' }), new Registry()); + const maxBasicSpendingLimit = HbarLimitService.TIER_LIMITS.BASIC.toTinybars().toNumber(); + const maxExtendedSpendingLimit = HbarLimitService.TIER_LIMITS.EXTENDED.toTinybars().toNumber(); + const maxPrivilegedSpendingLimit = HbarLimitService.TIER_LIMITS.PRIVILEGED.toTinybars().toNumber(); const ethAddressSpendingPlanRepository = new EthAddressHbarSpendingPlanRepository(cacheService, logger); const ipSpendingPlanRepository = new IPAddressHbarSpendingPlanRepository(cacheService, logger); @@ -194,10 +198,6 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { }; before(async function () { - // Restart the relay to reset the limits - await global.restartLocalRelay(); - await cacheService.clear(requestDetails); - logger.info(`${requestDetails.formattedRequestId} Creating accounts`); logger.info( `${requestDetails.formattedRequestId} HBAR_RATE_LIMIT_TINYBAR: ${ConfigService.get( @@ -258,12 +258,12 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { await expect(relay.call(testConstants.ETH_ENDPOINTS.ETH_SEND_RAW_TRANSACTION, [signedTx], requestId)).to.be .fulfilled; + const expectedCost = await getExpectedCostOfLastSmallTx(requestId); // awaiting for HBAR limiter to finish updating expenses in the background await Utils.wait(6000); const remainingHbarsAfter = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); - const expectedCost = await getExpectedCostOfLastSmallTx(requestId); verifyRemainingLimit(expectedCost, remainingHbarsBefore, remainingHbarsAfter); }); @@ -273,12 +273,12 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { expect(remainingHbarsBefore).to.be.gt(0); const contract = await deployContract(largeContractJson, accounts[0].wallet); + const expectedCost = await getExpectedCostOfLastLargeTx(contract.deploymentTransaction()!.data); // awaiting for HBAR limiter to finish updating expenses in the background await Utils.wait(6000); const remainingHbarsAfter = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); - const expectedCost = await getExpectedCostOfLastLargeTx(contract.deploymentTransaction()!.data); verifyRemainingLimit(expectedCost, remainingHbarsBefore, remainingHbarsAfter); }); @@ -289,12 +289,12 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { // This flow should not spend any major amount of hbars from the operator but only small query fees await deployContract(EstimateGasContract, accounts[0].wallet); + const expectedCost = await getExpectedCostOfLastSmallTx(requestId); // awaiting for HBAR limiter to finish updating expenses in the background await Utils.wait(6000); const remainingHbarsAfter = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); - const expectedCost = await getExpectedCostOfLastSmallTx(requestId); verifyRemainingLimit(expectedCost, remainingHbarsBefore, remainingHbarsAfter); }); @@ -305,12 +305,13 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { // This flow should spend hbars from the operator, for fileCreate const contract = await deployContract(mediumSizeContract, accounts[0].wallet); + const expectedCost = await getExpectedCostOfLastLargeTx(contract.deploymentTransaction()!.data); // awaiting for HBAR limiter to finish updating expenses in the background await Utils.wait(6000); const remainingHbarsAfter = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); - const expectedCost = await getExpectedCostOfLastLargeTx(contract.deploymentTransaction()!.data); + verifyRemainingLimit(expectedCost, remainingHbarsBefore, remainingHbarsAfter); }); @@ -321,6 +322,7 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { const operatorBalanceBefore = (await mirrorNode.get(`/accounts/${operatorAccount}`, requestId)).balance .balance; const largeContract = await deployContract(largeContractJson, accounts[0].wallet); + const totalOperatorFees = await getExpectedCostOfLastLargeTx(largeContract.deploymentTransaction()!.data); // awaiting for HBAR limiter to finish updating expenses in the background await Utils.wait(6000); @@ -330,7 +332,6 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { const amountPaidByOperator = operatorBalanceBefore - operatorBalanceAfter; - const totalOperatorFees = await getExpectedCostOfLastLargeTx(largeContract.deploymentTransaction()!.data); const remainingHbarsAfter = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); const hbarLimitReducedAmount = remainingHbarsBefore - remainingHbarsAfter; @@ -350,10 +351,9 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { contract.deploymentTransaction()!.data, ); - const fileChunkSize = Number(ConfigService.get('FILE_APPEND_CHUNK_SIZE')) || 5120; const estimatedTxFee = estimateFileTransactionsFee( contract.deploymentTransaction()!.data.length, - fileChunkSize, + fileAppendChunkSize, exchangeRateInCents, ); @@ -449,8 +449,7 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { }); it('should eventually exhaust the hbar limit for a BASIC user after multiple deployments of large contracts', async function () { - const fileChunkSize = Number(ConfigService.get('FILE_APPEND_CHUNK_SIZE')) || 5120; - const maxBasicSpendingLimit = HbarLimitService.TIER_LIMITS.BASIC.toTinybars().toNumber(); + let deploymentCounts: number = 0; const remainingHbarsBefore = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); const exchangeRateResult = (await mirrorNode.get(`/network/exchangerate`, requestId)).current_rate; const exchangeRateInCents = exchangeRateResult.cent_equivalent / exchangeRateResult.hbar_equivalent; @@ -463,19 +462,22 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { const deployedTransaction = await factory.getDeployTransaction(); const estimatedTxFee = estimateFileTransactionsFee( deployedTransaction.data.length, - fileChunkSize, + fileAppendChunkSize, exchangeRateInCents, ); //Unlinking the ipAdress, since ipAddress when running tests in CI and locally is the same expect(ethAddressSpendingPlanRepository.findByAddress(accounts[2].address, requestDetails)).to.be.rejected; try { - for (let i = 0; i < 50; i++) { + for (deploymentCounts = 0; deploymentCounts < 50; deploymentCounts++) { await deployContract(largeContractJson, accounts[2].wallet); } expect.fail(`Expected an error but nothing was thrown`); } catch (e: any) { expect(e.message).to.contain(predefined.HBAR_RATE_LIMIT_EXCEEDED.message); + const largeContractDeploymentCost = await getExpectedCostOfLastLargeTx(deployedTransaction.data); + const expectedAmountOfDeployments = Math.floor(maxBasicSpendingLimit / largeContractDeploymentCost); + expect(deploymentCounts).to.eq(expectedAmountOfDeployments); // awaiting for HBAR limiter to finish updating expenses in the background await Utils.wait(6000); @@ -503,6 +505,164 @@ describe('@hbarlimiter HBAR Limiter Acceptance Tests', function () { } }); }); + + describe('Preconfigured Tiers', () => { + const createAliasForNonBasicPlans = async (subscriptionTier: SubscriptionTier) => { + const aliasAccount = await Utils.createAliasAccount( + mirrorNode, + global.accounts[0], + requestId, + initialBalance, + ); + + const hbarSpendingPlan = await hbarSpendingPlanRepository.create(subscriptionTier, requestDetails, mockTTL); + + await ethAddressSpendingPlanRepository.save( + { ethAddress: aliasAccount.address, planId: hbarSpendingPlan.id }, + requestDetails, + mockTTL, + ); + + const plan = await ethAddressSpendingPlanRepository.findByAddress(aliasAccount.address, requestDetails); + expect(plan.ethAddress).to.eq(aliasAccount.address); + expect(plan.planId).to.eq(hbarSpendingPlan.id); + const spendingPlan = await hbarSpendingPlanRepository.findByIdWithDetails(plan.planId, requestDetails); + expect(spendingPlan.active).to.be.true; + expect(spendingPlan.amountSpent).to.eq(0); + expect(spendingPlan.subscriptionTier).to.eq(subscriptionTier); + + return { aliasAccount, hbarSpendingPlan }; + }; + + const reusableTestsForNonBasicTiers = (subsriptionTier: SubscriptionTier, maxSpendingLimit: number) => { + let aliasAccount: AliasAccount; + let hbarSpendingPlan: IDetailedHbarSpendingPlan; + + beforeEach(async () => { + const result = await createAliasForNonBasicPlans(subsriptionTier); + aliasAccount = result.aliasAccount; + hbarSpendingPlan = result.hbarSpendingPlan; + }); + + it('Should increase the amount spent of the spending plan by the transaction cost', async () => { + const contract = await deployContract(largeContractJson, aliasAccount.wallet); + const expectedCost = await getExpectedCostOfLastLargeTx(contract.deploymentTransaction()!.data); + + // awaiting for HBAR limiter to finish updating expenses in the background + await Utils.wait(6000); + + const spendingPlan = await hbarSpendingPlanRepository.findByIdWithDetails( + hbarSpendingPlan.id, + requestDetails, + ); + + const amountSpent = spendingPlan.amountSpent; + + const tolerance = 0.01; + expect(amountSpent).to.be.approximately(expectedCost, tolerance * expectedCost); + }); + + it(`Should eventually exhaust the hbar limit for ${subsriptionTier} user`, async () => { + let deploymentCounts: number = 0; + const exchangeRateResult = (await mirrorNode.get(`/network/exchangerate`, requestId)).current_rate; + const exchangeRateInCents = exchangeRateResult.cent_equivalent / exchangeRateResult.hbar_equivalent; + const remainingHbarsBefore = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); + + const factory = new ethers.ContractFactory( + largeContractJson.abi, + largeContractJson.bytecode, + accounts[0].wallet, + ); + const deployedTransaction = await factory.getDeployTransaction(); + const estimatedTxFee = estimateFileTransactionsFee( + deployedTransaction.data.length, + fileAppendChunkSize, + exchangeRateInCents, + ); + + try { + for (deploymentCounts = 0; deploymentCounts < 50; deploymentCounts++) { + await deployContract(largeContractJson, aliasAccount.wallet); + } + expect.fail(`Expected an error but nothing was thrown`); + } catch (e: any) { + expect(e.message).to.contain(predefined.HBAR_RATE_LIMIT_EXCEEDED.message); + const largeContractDeploymentCost = await getExpectedCostOfLastLargeTx(deployedTransaction.data); + const expectedAmountOfDeployments = Math.floor(maxSpendingLimit / largeContractDeploymentCost); + expect(deploymentCounts).to.eq(expectedAmountOfDeployments); + + // awaiting for HBAR limiter to finish updating expenses in the background + await Utils.wait(6000); + + const spendingPlanAssociated = await hbarSpendingPlanRepository.findByIdWithDetails( + hbarSpendingPlan.id, + requestDetails, + ); + const amountSpent = spendingPlanAssociated.amountSpent; + const remainingHbarsAfter = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); + + // Explanation: + // An HBAR limit check triggers the HBAR_RATE_LIMIT_EXCEED error in two scenarios: + // a. if remainingHbarsBefore > maxSpendingLimit ===> (totalHbarSpentByPrivilegedPlan + estimatedTxFee) > maxSpendingLimit + // b. if remainingHbarsBefore <= maxSpendingLimit ===> remainingBudget < estimatedTxFee + if (remainingHbarsBefore > maxSpendingLimit) { + expect(amountSpent + estimatedTxFee).to.be.gt(maxSpendingLimit); + } else { + expect(remainingHbarsAfter).to.be.lt(estimatedTxFee); + } + } + }); + }; + + describe('given a valid JSON file with pre-configured spending plans', async () => { + const SPENDING_PLANS_CONFIG_FILE = ConfigService.get('HBAR_SPENDING_PLANS_CONFIG_FILE') as string; + const configPath = findConfig(SPENDING_PLANS_CONFIG_FILE); + const rawData = fs.readFileSync(configPath!, 'utf-8'); + const expectedNonBasicPlans2 = JSON.parse(rawData) as SpendingPlanConfig[]; + + it('Should successfully populate all pre-configured spending plans', async () => { + expectedNonBasicPlans2.forEach(async (expectedPlan) => { + const hbarSpendingPlan = await hbarSpendingPlanRepository.findByIdWithDetails( + expectedPlan.id, + requestDetails, + ); + expect(hbarSpendingPlan.active).to.be.true; + expect(hbarSpendingPlan.id).to.eq(expectedPlan.id); + expect(hbarSpendingPlan.subscriptionTier).to.eq(expectedPlan.subscriptionTier); + + if (expectedPlan.ethAddresses) { + expectedPlan.ethAddresses.forEach(async (evmAddress) => { + const associatedPlanByEVMAddress = await ethAddressSpendingPlanRepository.findByAddress( + evmAddress, + requestDetails, + ); + expect(associatedPlanByEVMAddress.planId).to.eq(expectedPlan.id); + expect(associatedPlanByEVMAddress.ethAddress).to.eq(evmAddress); + }); + } + + if (expectedPlan.ipAddresses) { + expectedPlan.ipAddresses.forEach(async (ipAddress) => { + const associatedPlanByIpAddress = await ipSpendingPlanRepository.findByAddress( + ipAddress, + requestDetails, + ); + expect(associatedPlanByIpAddress.planId).to.eq(expectedPlan.id); + expect(associatedPlanByIpAddress.ipAddress).to.eq(ipAddress); + }); + } + }); + }); + }); + + describe('EXTENDED Tier', () => { + reusableTestsForNonBasicTiers(SubscriptionTier.EXTENDED, maxExtendedSpendingLimit); + }); + + describe('PRIVILEGED Tier', () => { + reusableTestsForNonBasicTiers(SubscriptionTier.PRIVILEGED, maxPrivilegedSpendingLimit); + }); + }); }); }); } diff --git a/packages/server/tests/localAcceptance.env b/packages/server/tests/localAcceptance.env index e096ae3179..9652019eda 100644 --- a/packages/server/tests/localAcceptance.env +++ b/packages/server/tests/localAcceptance.env @@ -30,3 +30,4 @@ WRITE_SNAPSHOT_ON_MEMORY_LEAK=false HBAR_RATE_LIMIT_TINYBAR=5000000000# 50 HBARs HBAR_RATE_LIMIT_DURATION=80000# 80 seconds HBAR_RATE_LIMIT_BASIC=4000000000# 40 HBARs +HBAR_SPENDING_PLANS_CONFIG_FILE=./packages/server/tests/testSpendingPlansConfig.json diff --git a/packages/server/tests/previewnetAcceptance.env b/packages/server/tests/previewnetAcceptance.env index dcf0b85972..090a945de7 100644 --- a/packages/server/tests/previewnetAcceptance.env +++ b/packages/server/tests/previewnetAcceptance.env @@ -23,3 +23,4 @@ TEST_INITIAL_ACCOUNT_STARTING_BALANCE=500 HBAR_RATE_LIMIT_TINYBAR=5000000000# 50 HBARs HBAR_RATE_LIMIT_DURATION=80000# 80 seconds HBAR_RATE_LIMIT_BASIC=4000000000# 40 HBARs + diff --git a/packages/server/tests/testSpendingPlansConfig.json b/packages/server/tests/testSpendingPlansConfig.json new file mode 100644 index 0000000000..0f44431a8c --- /dev/null +++ b/packages/server/tests/testSpendingPlansConfig.json @@ -0,0 +1,32 @@ +[ + { + "id": "c758c095-342c-4607-9db5-867d7e90ab9d", + "name": "PRIVILEGED_ALPHA", + "ethAddresses": ["0x7d102fe71af42790fe31b126c1f49766376ca2b5"], + "ipAddresses": ["127.0.0.1"], + "subscriptionTier": "PRIVILEGED" + }, + { + "id": "a68488b0-6f7d-44a0-87c1-774ad64615f2", + "name": "PRIVILEGED_BETA", + "ethAddresses": ["0x40183ec818c1826114767391989ff2eaebc2b91e", "0xcdad5844f865f379bea057fb435aefef38361b68"], + "subscriptionTier": "PRIVILEGED" + }, + { + "id": "af13d6ed-d676-4d33-8b9d-cf05d1ad7134", + "name": "EXTENDED_ALPHA", + "ethAddresses": [ + "0x149294f355f62827748988071de70ab195d0eb23", + "0x17b2b8c63fa35402088640e426c6709a254c7ffb", + "0x6e5d3858f53fc66727188690946631bde0466b1a" + ], + "ipAddresses": ["127.0.0.2"], + "subscriptionTier": "EXTENDED" + }, + { + "id": "7f665aa3-6b73-41d7-bf9b-92d04cdab96b", + "name": "EXTENDED_BETA", + "ipAddresses": ["127.0.0.3"], + "subscriptionTier": "EXTENDED" + } +] diff --git a/packages/server/tests/testnetAcceptance.env b/packages/server/tests/testnetAcceptance.env index 9927c8fe3b..204f026933 100644 --- a/packages/server/tests/testnetAcceptance.env +++ b/packages/server/tests/testnetAcceptance.env @@ -22,3 +22,4 @@ TEST_INITIAL_ACCOUNT_STARTING_BALANCE=500 HBAR_RATE_LIMIT_TINYBAR=5000000000# 50 HBARs HBAR_RATE_LIMIT_DURATION=80000# 80 seconds HBAR_RATE_LIMIT_BASIC=4000000000# 40 HBARs +