-
Notifications
You must be signed in to change notification settings - Fork 283
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: return DecodedReturn instead of any[] #1540
Conversation
3be7089
to
080415d
Compare
returnValues.push(this.decodeReturn(this.abi.returnTypes[i])); | ||
public decode(): DecodedReturn { | ||
if (this.abi.returnTypes.length > 1) { | ||
throw new Error('Multiple return values not supported'); |
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.
shouldn't this be different return types from one function is not supported
since you are checking returnTypes.length
?
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.
Update - add a comment how an array is not [Field, Field]
but [array{size:2, type:field}]
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.
WOOP WOOP!!
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.
Overall looks good to me, however I have concerns over how this will collide with my current pr #1515.
In this PR i alter public function's return values by pushing them into the return_values
object in the kernel. I'm overall not sure what the long term solution will be in regards to this as soon as we move public execution to the VM model.
You should be good to merge this, I think it will be my work that needs to change
Maybe we can get this into the typechain generator as well, so we get typed return types? I can tackle it after this PR is merged. |
25b97f1
to
8b1f1e9
Compare
Return a single
DecodedReturn
instead of theany[]
that we are currently returning when as the return values in execution results. As noir let you have one return value (that return value can be an array or struct etc) we should just return that directly instead of wrapping it inside an array for the return values. This makes it more straight-forward to use view functions as well as you can get structs directly that way (example from lending contract)Fixes a naming from
interestAccumulator
->interest_accumulator
as well.Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.