-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Off-by-one error in zero_pad
#1599
Comments
@daejunpark could you please take a look at 5a84571 and let me know if you think it is a reasonable solution? |
@charles-cooper thanks for this. It is a really clever trick, and I like it (from my hacker instinct)! But I have a concern about this kind of off-label uses of opcodes for the long term in general. For example, if people discuss the behavior change of I have a question. Is the zero padding size always less than 32? (I cannot think of a counterexample.) If so, you may want to consider to use the
where |
Yes, I've been thinking about this approach for awhile. In this case the zero-pad is always <32 bytes, but having this technique for zeroing arbitrary amounts of memory would be handy. So we could always guarantee that the source is a zeroed block of memory simply by reading from past-the-end of where we have allocated, or some number so large it would be impractical to write to (e.g. 2**32). But I think reasoning about where the past-the-end pointer should be for
I was also concerned about this. However, I feel like the existing semantics were carefully considered and were written that way for a reason. Note the difference in semantics between |
@charles-cooper I agree with all of your points, but please note that the overhead of updating the @CarlBeek what do you think about this in terms of the deposit contract operation? |
FYI, this is also related: #1610 |
Thanks for the note. My assumption was that, if the opcode semantics are ever changed, it would be as an EVM version update so that only contracts deployed after |
I want to do the quick fix for the |
Thanks for the quick fix! It will help to facilitate the deposit contract verification process. BTW, my understanding is that even a contract deployed before certain fork will be ran using the new semantics of the folk. (Or, I may misunderstood your explanation.) |
@daejunpark there are several proposals to add versioning to the EVM https://github.com/ethereum-cat-herders/PM/issues/53. I don't believe (and this is just my educated guess) such a significant semantic change to |
Initially it seemed to me that this was too off-label to be a part of compiler behaviour, but after taking a look at the yellow paper, Geth, and py-evm implementations, I agree with @charles-cooper that this would be something that would need to be specified via EVM versioning. On the topic of longevity and redeployment, the deposit contract is intended to live until at least the death of Eth1 somewhere way in the future and thus it is vital that this be resolved in a robust manner. As mentioned above, however, I don't think that this will present a problem. |
Thought I'd chime in and just say that, in my mind, the likelihood that |
Note from meeting: relying on |
Just to make sure, I do not have an objection to the |
Version Information
vyper --version
): 0.1.0b12+commit.8663ac5What's your issue about?
Off-by-one error in
zero_pad()
:https://github.com/ethereum/vyper/blob/ab39d4e9c5168eff2646dd29e23d7212654b636d/vyper/parser/parser_utils.py#L904
Logically, the loop termination condition should use
ge
instead ofgt
.How can it be fixed?
It can be fixed by replace
gt
byge
in the above, but I'm not sure if such a fix does not affect others.The text was updated successfully, but these errors were encountered: