Fix EncodeUint256 to work with bigger buffers#13580
Conversation
|
|
Well, this PR is making |
|
Yes but if the calling code wants to pass a bigger byte slice, it already knows what it's doing, and should pass 32 instead. Otherwise, it might as well pass 31 or less, in which case it will break.
|
|
It's a matter of taste, of course, but here I'm following the robustness principle "be conservative in what you do, be liberal in what you accept from others". We could make The case when a buffer shorter than 32 bytes is passed is probably easier to detect because it'll panic. |
Follow-up to PR #12869 & #13574