-
Notifications
You must be signed in to change notification settings - Fork 75
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
Conversation
Signed-off-by: ebadiere <[email protected]>
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.
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', |
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.
What's the goal of this?
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.
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
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.
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; |
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.
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); |
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.
This only adds the file create transaction cost.
What about the fileAppend transaction(s)?
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.
Updated.
} | ||
|
||
// Ensure that the calldata file is not empty | ||
if (fileId) { |
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.
Q: Where's the actual logic to add the costs of the FileCreate and FileAppend to the hbar rate limiter?
Signed-off-by: ebadiere <[email protected]>
Signed-off-by: ebadiere <[email protected]>
Quality Gate passedIssues Measures |
Replaced by #2634 |
Adds HBar rate limiter to the
createFile
methodRelated issue(s): #2631