You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python Version (output of python --version): 3.11.9
What's your issue about?
I've tried a few different possibilities for this:
using the docs, it mentions that 0 is treated as a minimum for a dynamic structure's sizes. That doesn't work:
ArrayIndexException: Subscript must be greater than 0contract"contracts/Validator.vyi:16", function "validate", line 16:1815 amount_per_second: uint256,
--->16 reason: Bytes[0], # NOTE: Represents lower-bound of implementation --------------------------^17 ) ->uint256:
I tried 1, which is mentioned in the docs somewhat implicitly in the example (instead of 0 which I thought would work). Doesn't work either (downstream uses 1024):
TypeMismatch:Given reference has type Bytes[1024], expected Bytes[1]
contract"contracts/Validator.vyi:16", function "validate", line 16:415 amount_per_second: uint256,
--->16 reason: Bytes[1], # NOTE: Represents lower-bound of implementation ------------^17 ) ->uint256:
I tried a larger value, thinking maybe the docs were mistating the "minimum behavior" of sizes in interfaces. Nope (the error actually isn't entirely clear, but I assume this is the root cause):
InterfaceViolation:Contract does not implement all interface functions: validate(address,interface [...]/IERC20.vyi,uint256,Bytes[65535])
contract"contracts/test/TestValidator.vy:8", line 8:07--->8 implements: Validator
-------^9
The only thing that works if they exactly match the specific value that I am using in the implementation with the interface. This makes Interfaces brittle to deploy, especially when using interfaces from 2nd party libraries.
How can it be fixed?
Now, this may be intended behavior that the 2nd party developer may have! They might want to specify a specific value that is accepted for that field (the size can always be less, but not more) for some downstream logic that may be called into by some other function (since I can use interfaces as types in other modules). Something to keep in mind.
At the very least, the ability to specify "I really don't care what you set this too" should be easy and natural to do w/ Vyper. My suggestion is that we allow ... (the Elipsis AST node) to define "ignore whatever this says for the purposes of determining interface alignment in a downstream implementation".
The text was updated successfully, but these errors were encountered:
Version Information
vyper --version
): 0.4.0python --version
): 3.11.9What's your issue about?
I've tried a few different possibilities for this:
0
is treated as a minimum for a dynamic structure's sizes. That doesn't work:1
, which is mentioned in the docs somewhat implicitly in the example (instead of 0 which I thought would work). Doesn't work either (downstream uses 1024):The only thing that works if they exactly match the specific value that I am using in the implementation with the interface. This makes Interfaces brittle to deploy, especially when using interfaces from 2nd party libraries.
How can it be fixed?
Now, this may be intended behavior that the 2nd party developer may have! They might want to specify a specific value that is accepted for that field (the size can always be less, but not more) for some downstream logic that may be called into by some other function (since I can use interfaces as types in other modules). Something to keep in mind.
At the very least, the ability to specify "I really don't care what you set this too" should be easy and natural to do w/ Vyper. My suggestion is that we allow
...
(the Elipsis AST node) to define "ignore whatever this says for the purposes of determining interface alignment in a downstream implementation".The text was updated successfully, but these errors were encountered: