Support fixed arrays and tuples#35
Closed
PeterMPhillips wants to merge 3 commits intoweiroll:mainfrom
PeterMPhillips:main
Closed
Support fixed arrays and tuples#35PeterMPhillips wants to merge 3 commits intoweiroll:mainfrom PeterMPhillips:main
PeterMPhillips wants to merge 3 commits intoweiroll:mainfrom
PeterMPhillips:main
Conversation
Arachnid
requested changes
Mar 14, 2022
Contributor
Arachnid
left a comment
There was a problem hiding this comment.
Thanks for this! I would like to resolve the issue with only accepting literals in arrays and tuples in this PR if we can. I think the easiest way to do this would be to introduce ArrayValue and TupleValue types, and when encoding them, handle them by iterating over their elements and checking what sort of value they are.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hi all. This PR adds fixes for #34 and weiroll/weiroll#56. It checks whether the array/tuple is fixed size or dynamic. If it's fixed, the parameter's value is broken up into 32 byte chunks and set as individual values in the
statearray. I've added some tests to confirm the functionality.As far as I can tell this only works for literal values, if I attempt to pass a return value into an array or tuple I get this error:
Error: invalid BigNumber value...since we're passing a ReturnValue object into the contract's function instead of a BigNumber. I suspect this requires further changes to theContracttype provided by planner.ts. Although I'm unsure what exactly is needed to fix this. Should I make this a separate issue or would you like it resolve in this PR?