-
Notifications
You must be signed in to change notification settings - Fork 773
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
Util: should stripZeros really strip the last 0 as well? #1302
Comments
@davidmurdoch You could already help very much if you give an explicit stance on this here. Read closely what I wrote up above and go along where it might make sense to clarify, confirm or further investigate. Thanks! |
@holgerd77, I'd expect a function named I think the confusion on if a What may need to happen is that ethereumjs-tx/util's To complicate matters further, I could see |
@davidmurdoch Whew, had a first deep-read on this (also corrected some typos), and I think I got the problem, thanks for this! |
I have the feeling that we can do much much more on things like this once we go full |
@davidmurdoch I sketched up some quick code to check if I understand your explanation correctly. it is a simple and naive implementation of the idea that
The changes for ethereumjs-tx can be found here ethereumjs/ethereumjs-tx@prepend-0x-to-tx-data...quantity-fields-allow-zero-proof-of-concept I'll note that it deviates from your suggestion in that it is the setters and the signing function, and not the When you get a chance, can you check these? Does it accurately reflect a simple application of the general strategy you outlined? |
@danjm Looks good as far as preserving the original data. One thing to note here is that if the Additionally, we may need to ensure that when signing the |
I'm not sure hiding more complexity in |
@s1na Yes, that is a very good suggestion. I am going to put together a draft PR that attempts to do this while accounting for the issue raised by @davidmurdoch I will have time to work on that on the weekend, will get a PR up by Monday (Apr 4) |
Hmm, I am still not sure if there might be something to be drawn from this issue, e.g. an additional boolean switch for the Will for now keep the issue and transfer to the monorepo. |
Related: ethereumjs/ethereumjs-util#79 |
Outdated, will close. |
The stripZeros() function is intended to trim leading zeros from a
Buffer
or anArray
, e.g.:"0x034f" -> "34f"
"0x03" -> "3"
In the current implementation a zero value
0x00
is also trimmed down to an empty string like:"0x00" -> "" or also
"0x0" -> ""
Should this really be the case respectively is this intended (e.g. in the context of a simplified Ethereum zero value representation or something, stumbled e.g. on this (see Point 3.)?
This issue should be handled with care, this would also change the behavior of the
defineProperties()
creator on the allowLess setting and e.g. trickle down to a changedethereumjs-tx
Transaction initialization on zero values.The text was updated successfully, but these errors were encountered: