feat[lang]!: add unbounded types#4967
Conversation
Gas Changes
Summary
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb4bd59c39
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if self.length is INF: | ||
| # INF >= INF | ||
| # INF >= n | ||
| return True |
There was a problem hiding this comment.
Check element types for unbounded dynamic arrays
When the expected type is DynArray[..., INF], this branch returns True before comparing value_type, so a bounded array with the wrong element type is accepted as long as the length is finite (for example, DynArray[address, 1] type-checks against DynArray[uint256, INF]). This lets semantic validation accept calls or assignments that should be rejected and can defer the mismatch to later compiler stages.
Useful? React with 👍 / 👎.
📊 Bytecode Size Changes (venom)
Full bytecode sizes
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4967 +/- ##
==========================================
- Coverage 92.69% 92.69% -0.01%
==========================================
Files 186 187 +1
Lines 27405 27461 +56
Branches 4725 4733 +8
==========================================
+ Hits 25404 25454 +50
- Misses 1358 1368 +10
+ Partials 643 639 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What I did
Implement #4856
Fix interface implementation working backwards for the return type, this is a breaking change !
(text below mentions
Bytes, but the logic is the same forStringandDynArray)In interfaces, replace
Bytes[1]in return types and variables byBytes[...]to keep them behaving as previously.There is no replacement for
Bytes[<n>]in return types meaning "can be implemented byBytes[<k>]where k >= n"In return types,
Bytes[n]now means "can be implemented byBytes[<k>]where k <= n".Note that this is required for safety: if a function is guaranteed by its interface to return at most 2 bytes, we shouldn't be able to implement it with one which returns 3 bytes.
How I did it
How to verify it
Commit message
Description for the changelog
add wildcard length for interfaces, for example
Bytes[...]BREAKING fix interface return types, update your interfaces to use a wildcard length to fix it, example:
Bytes[1]->Bytes[...]add unbounded types, for example
Bytes[INF]Cute Animal Picture