Skip to content
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

fix: Added rateLimiter to fileCreate. #2632

Closed
wants to merge 3 commits into from

Conversation

ebadiere
Copy link
Contributor

Adds HBar rate limiter to the createFile method

Related issue(s): #2631

@ebadiere ebadiere added the bug Something isn't working label Jun 27, 2024
@ebadiere ebadiere added this to the 0.50.0 milestone Jun 27, 2024
@ebadiere ebadiere self-assigned this Jun 27, 2024
Copy link

Tests

    2 files  157 suites   14s ⏱️
854 tests 853 ✔️ 1 💤 0
866 runs  865 ✔️ 1 💤 0

Results for commit c062b0b.

Copy link

github-actions bot commented Jun 27, 2024

Acceptance Tests

     31 files     482 suites   44m 57s ⏱️
   609 tests    597 ✔️   4 💤   8
1 758 runs  1 721 ✔️ 21 💤 16

Results for commit c062b0b.

♻️ This comment has been updated with latest results.

@ebadiere ebadiere requested review from Nana-EC and quiet-node June 27, 2024 23:56
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's confirm we're capturing all the FileCreate/FileAppend expenses

@@ -257,7 +257,7 @@ export class SDKClient {
fileId = await this.createFile(
ethereumTransactionData.callData,
this.clientMain,
requestId,
requestId ?? 'create-file-from-submit-ethereum-transaction',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the goal of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optional parameter on the requestId causes Argument of type 'string | undefined' is not assignable to parameter of type 'string'.. I can remove the optional all the way to the sendRawTransaction

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is the choice of string.
Doesn't seem consistent with anything we've done.
Either the requestId is provided by a user of one is generated higher up if not present.

Why do we need this workaround only here?


// Ensure that the calldata file is not empty
if (fileId) {
const fileSize = await (await new FileInfoQuery().setFileId(fileId).execute(client)).size;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: does this have a cost associated with it?
If so can you open a ticket so we come back and see if this is needed still and more so also capture its cost in the metric and rate limits

interactingEntity,
);

this.hbarLimiter.addExpense(transactionFee.toTinybars().toNumber(), currentDateNow);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only adds the file create transaction cost.
What about the fileAppend transaction(s)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

}

// Ensure that the calldata file is not empty
if (fileId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Where's the actual logic to add the costs of the FileCreate and FileAppend to the hbar rate limiter?

Copy link

@ebadiere
Copy link
Contributor Author

Replaced by #2634

@ebadiere ebadiere closed this Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants