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
feat(sozo): support multicall for execute command #2897
feat(sozo): support multicall for execute command #2897
Changes from 2 commits
ad1ce8b
09b00d1
01aad32
6101109
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 51 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L51
Check warning on line 97 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L90-L97
Check warning on line 106 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L104-L106
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
Ohayo, sensei! Add validation for minimum number of calls
The iterator implementation should validate that at least one complete call (address + entrypoint) is provided.
Add this validation before the while loop:
📝 Committable suggestion
Check warning on line 110 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L108-L110
Check warning on line 114 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L112-L114
Check warning on line 116 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L116
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
Ohayo, sensei! Handle
ResourceDescriptor::Name
variant to prevent runtime panicsUsing
unimplemented!()
in the match arm forResourceDescriptor::Name(_)
will cause a runtime panic if this case is encountered. Consider implementing proper error handling for this variant to prevent unexpected panics.Apply this diff to handle the
Name
variant gracefully:Check warning on line 129 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L120-L129
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.
Ohayo, sensei! Fix the error message condition to display the suggestion correctly
Currently, the error message suggests running the command again with
--diff
whenself.diff
istrue
. However, ifself.diff
is alreadytrue
, the suggestion is redundant. The condition should be inverted to check whenself.diff
isfalse
.Apply this diff to fix the condition:
📝 Committable suggestion
Check warning on line 132 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L131-L132
Check warning on line 138 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L134-L138
Check warning on line 140 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L140
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.
Ohayo, sensei! Add safety check for calldata parsing
The calldata parsing loop could potentially continue indefinitely if a separator is missing. Additionally, there's no validation of calldata size.
Add safety checks:
📝 Committable suggestion
Check warning on line 143 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L143
Check warning on line 147 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L147
Check warning on line 153 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L150-L153
Check warning on line 157 in bin/sozo/src/commands/execute.rs
Codecov / codecov/patch
bin/sozo/src/commands/execute.rs#L157
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
Ohayo, sensei! Add transaction size validation
Before executing the multicall, validate the total transaction size.