-
Notifications
You must be signed in to change notification settings - Fork 201
[Flow EVM] Implement ABI encoding/decoding for arrays of Solidity tuples #8371
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
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThe changes implement ABI encoding and decoding support for arrays of Solidity tuples. A context parameter was added to the type resolution function, tuple-encodable composite detection logic was introduced, and array element handling was updated to properly encode/decode struct arrays as tuple sequences. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Input: Cadence Array
participant Encoder as ABI Encoder
participant TypeResolver as Type Resolver (goType)
participant ElementHandler as Element Processor
participant Output as Output: EVM Bytes
Client->>Encoder: encodeABI([struct1, struct2, ...])
Encoder->>TypeResolver: goType(context, arrayType)
TypeResolver->>TypeResolver: Detect tuple-encodable composite
TypeResolver-->>Encoder: Return array of tuple type
Encoder->>ElementHandler: For each struct element
ElementHandler->>ElementHandler: Check isTuple flag
ElementHandler->>ElementHandler: Indirect from pointer if needed
ElementHandler-->>Encoder: Processed element
Encoder->>Output: Encode to EVM tuple format
Output-->>Client: Return encoded ABI bytes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
8dd3fb0 to
9846bf6
Compare
| // - `EVM.EVMBytes4` | ||
| // - `EVM.EVMBytes32` | ||
| semaType := interpreter.MustConvertStaticToSemaType(staticType, context) | ||
| if compositeType := asTupleEncodableCompositeType(semaType); compositeType != nil { |
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.
In the case where compositeType != nil , we are not making use of the compositeType, instead, we are reading from the staticType and context all over again.
I feel we might be able to get rid of this check, just rely on gethABIType to return ok, and check if ok == true, for when the type is a tuple. In other words, if compositeType != nil, then ok must be true, and if it's false, then it should be a fatal error, no?
Thoughts?
Closes: #8370
Related: onflow/FlowYieldVaultsEVM#40
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.