-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: create e2e tests for basic spending plan limit #3094
base: main
Are you sure you want to change the base?
test: create e2e tests for basic spending plan limit #3094
Conversation
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Some queries like getAccountInfo, getBalanceInfo, FileContentsQuery, etc. also add expense to remainingBalance but don't necessarily need to have an originalCaller (ethAddress). Therefore, addExpense can accept nullable ethAddress value. Only when ethAddress or ipAddress is valid, utilize spendingPlan logic. Otherwise, skip completely. Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
…and IExecuteQueryEventPayload Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
This reverts commit fd9e119 and updated related tests Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
This reverts commit e45c321. Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
🚨 Memory Leak Detected 🚨A potential memory leak has been detected in the test titled Details📊 Memory Leak Detection Report 📊 GC Type: MarkSweepCompact Heap Statistics (before vs after executing the test):
Heap Space Statistics (before vs after executing the test):
RecommendationsPlease investigate the memory allocations in this test, focusing on objects that are not being properly deallocated. |
504eedb
to
6d559c8
Compare
6d559c8
to
2d6eb18
Compare
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
203f001
to
8f70db4
Compare
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
22e4ca3
to
69192f0
Compare
const remainingHbars = Number(await metrics.get(testConstants.METRICS.REMAINING_HBAR_LIMIT)); | ||
|
||
// Check that the BASIC spending plan is created after the first deployment only | ||
if (i === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@quiet-node Why is this deleted? I wanted to have this check here to ensure we create a basic plan as intended?
} | ||
const hbarPlan = await hbarSpendingPlanRepository.findByIdWithDetails(spendingPlanId, requestDetails); | ||
|
||
expect(hbarPlan.amountSpent).to.be.gt(spentToday); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@quiet-node And why remove this? I think it is still separate than what you are doing in the catch?
I want to ensure that in each call we calculate the amount spent correctly and we increase it and there was a problem with amount spent actually that i wanted to investigate?
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
|
||
it('should eventually exhaust the hbar limit for a BASIC user after multiple deployments of large contracts', async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@victor-yanev why is this whole test deleted??
This reverts commit f688a4e.
[SubscriptionTier.BASIC], | ||
requestDetails, | ||
); | ||
for (const plan of basicPlans) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@victor-yanev Why delete all the plans :?
6cb081b
to
2396bea
Compare
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
2396bea
to
ccdf203
Compare
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3094 +/- ##
==========================================
- Coverage 83.16% 82.66% -0.51%
==========================================
Files 63 62 -1
Lines 4236 4187 -49
Branches 830 821 -9
==========================================
- Hits 3523 3461 -62
- Misses 470 483 +13
Partials 243 243
Flags with carried forward coverage won't be shown. Click here to find out more.
|
): number { | ||
const fileCreateTransactions = 1; | ||
const fileCreateFeeInCents = constants.NETWORK_FEES_IN_CENTS.FILE_CREATE_PER_5_KB; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to validate that fileChunkSize
is not a zero value to prevent divide by zero issues in the next line?
if (fileChunkSize <= 0) {
throw new Error('fileChunkSize must be greater than zero.');
}
const fileCreateFeeInCents = constants.NETWORK_FEES_IN_CENTS.FILE_CREATE_PER_5_KB; | ||
|
||
// The first chunk goes in with FileCreateTransaciton, the rest are FileAppendTransactions | ||
const fileAppendTransactions = Math.floor(callDataSize / fileChunkSize) - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I am missing something here, but I think we want to use Math.ceil
here instead of .floor
Using .floor
will round down to the nearest integer, possibly missing the last chunk. .ceil
will round up to the nearest integer catching the last chunk even if the callDataSize
is not an exact multiple of the fileChunkSize
.
Description:
This PR adds acceptance tests to verify the scenarios listed in the issue that is linked
Related issue(s):
Fixes #3065
Notes for reviewer: