Closed kyranjamie closed 1 year ago
our implementation in a sense uses this approach.. the parser reads the first digit and checks if it matches the remaining data len, if not, it moves to the next digit, and now reads both as a len, and check if it matches the remaining data len and so on. but we can adjust to use this new approach, which is faster than read, check, advance and check again..
I believe so, yes
For the message Hello world!
we'd expect: \x17Stacks Signed Message:\n\fHello world!
As discussed in https://github.com/Zondax/ledger-stacks/issues/90 and this previous bug on geth, the message prefix should be encoded using a variable length integer.
I'm learning as I go, but as far as I understand, this is because ascii decimal encoding presents the issue that
...\n12...
is ambiguous. Is it length1
with value2
, or12
. And that using a varuint encoding fixes this.Stacks.js implementation using this encoding
:link: zboto Link