Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: ensure we init rpc client with timeout #2602
fix: ensure we init rpc client with timeout #2602
Changes from 3 commits
5e7038a
9d28be8
ab9be68
b10fd79
4faa650
84251fe
5d96621
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Check warning on line 76 in bin/sozo/src/commands/call.rs
Codecov / codecov/patch
bin/sozo/src/commands/call.rs#L70-L76
Check warning on line 82 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L81-L82
Check warning on line 86 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L86
Check warning on line 88 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L88
Check warning on line 121 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L121
Check warning on line 40 in bin/sozo/src/commands/inspect.rs
Codecov / codecov/patch
bin/sozo/src/commands/inspect.rs#L40
Check warning on line 62 in bin/sozo/src/commands/migrate.rs
Codecov / codecov/patch
bin/sozo/src/commands/migrate.rs#L61-L62
Check warning on line 104 in bin/sozo/src/commands/migrate.rs
Codecov / codecov/patch
bin/sozo/src/commands/migrate.rs#L104
Check warning on line 30 in bin/sozo/src/commands/options/starknet.rs
Codecov / codecov/patch
bin/sozo/src/commands/options/starknet.rs#L30
Check warning on line 33 in bin/sozo/src/commands/options/starknet.rs
Codecov / codecov/patch
bin/sozo/src/commands/options/starknet.rs#L33
Check warning on line 39 in bin/sozo/src/commands/options/starknet.rs
Codecov / codecov/patch
bin/sozo/src/commands/options/starknet.rs#L35-L39
Check warning on line 41 in bin/sozo/src/commands/options/starknet.rs
Codecov / codecov/patch
bin/sozo/src/commands/options/starknet.rs#L41
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.
Consider adding error handling for client builder.
The current implementation uses
unwrap()
which could panic if the client builder fails. Consider proper error handling.📝 Committable suggestion
Check warning on line 45 in bin/sozo/src/commands/options/starknet.rs
Codecov / codecov/patch
bin/sozo/src/commands/options/starknet.rs#L44-L45
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.
not sure if we need to expose the timeout config to user tho. perhaps having a sensible default value should suffice ?
the same goes for the timeout on the
TransactionWaiter
dojo/crates/dojo/utils/src/tx/invoker.rs
Lines 64 to 69 in 861d0b6
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.
I'm just wondering at which poing a declaration can last based on the network + size of a class. This is the main reason why I exposed it.
But I do agree, if we can find something that could be handled without actually exposing it, it's definitely better I agree.
Retry once with bigger timeout and fail afterward perhaps?
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.
Hmmm good point.
I think if we do retry, we'd just be sending the same request twice. In the case of class declaration, the timeout will be caused by the server processing the request too slow. And because the timeout is happening on the client, the server would still be processing the request, no?
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.
Yep, that's a good point. Which may lead to undesired effect.
So I guess it's preferable to have a longer timeout, but may be shortened manually then?
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.
not exactly sure... a longer timeout (something like 20s) is probably a good number. if a request takes more than 20s, and if its not due to super slow machine, then there's probably something wrong in how katana process the request.
katana also times out at 20s.
dojo/crates/katana/node/src/lib.rs
Lines 308 to 311 in 712422f
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.
i should benchmark the
addDeclareTransaction
endpointCheck warning on line 106 in bin/sozo/src/utils.rs
Codecov / codecov/patch
bin/sozo/src/utils.rs#L106
Check warning on line 116 in bin/sozo/src/utils.rs
Codecov / codecov/patch
bin/sozo/src/utils.rs#L116
Check warning on line 148 in bin/sozo/src/utils.rs
Codecov / codecov/patch
bin/sozo/src/utils.rs#L148
Check warning on line 155 in bin/sozo/src/utils.rs
Codecov / codecov/patch
bin/sozo/src/utils.rs#L155
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.
🛠️ Refactor suggestion
Consider adding timeout validation and documentation, sensei!
While the transaction configuration integration looks good, consider these improvements:
txn_config
parameterApply this diff to enhance the documentation:
Consider adding timeout validation: