-
Notifications
You must be signed in to change notification settings - Fork 59
Fix topics decoding to work with zero values #1098
Conversation
philipcmonk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, don't use (cat a b c) if you want (add b (lsh a 1 c))!
|
I think ++can is the canonical way to assemble fixed-width blocks?
…On Wednesday, 6 March 2019, Philip Monk ***@***.***> wrote:
***@***.**** approved this pull request.
Indeed, don't use (cat a b c) if you want (add b (lsh a 1 c))!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1098 (review)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABxXhrzaSvw_Lvn9DtWZauGpQWaT4DaTks5vUHDOgaJpZM4bhNup>
.
|
|
Ah, yes, |
|
Or actually I'm also somewhat confused what the surrounding code is doing: is |
|
Yeah it looks like every single call to decode-topics accepts (I'm also not sure why |
|
…why is the compiler allowing lone terms in a $% o.o https://github.com/urbit/arvo/blob/master/sys/zuse.hoon#L7608-L7617 |
Don't encode it like you do %bytes-n, which limits length to 32 bytes.
|
I completely forgot about Thanks for the feedback @ohAitch! I have touched up the logic here to not do superfluous Found an issue in the encoding logic while I was trying to test my changes there. We probably want more thorough tests for encoding, and tests at all for decoding. Official test data (which the current tests are sourced from) don't reach further than simple cases. Currently have a Q out to Ethereum core devs for recommended test data, but if that comes up blank, I might just pull in these. Tests aside, this PR is ready for re-review. |
++decode-arguments now takes already-parsed words, rather than a @t of words, so that we operate on straight atom values instead of hex strings. For the ++decode-topics case, we no longer re-string and un-string the input data prior to processing.
ad5f8f4 to
84f3441
Compare
philipcmonk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to review because of the nature of parsing, so unit tests are the best way to verify correctness, but this looks correct.
|
I keep forgetting to write additional tests for this. I'll put that on my task-list, but merge for now, to at least get the fix in. |
Because
+catdoesn't care to left-shift if you append a zero value.Previously:
Now: