Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are a few conversions happening when paying with a memo: In our example we use the memo
0xc8b21e166f0d1604
During the encoding we have the following process:
We go from a string to UTF8 encoded (which gives the same result)
0xc8b21e166f0d1604
->0xc8b21e166f0d1604
We then send it to a method called toRlp -
iov-core/packages/iov-ethereum/src/encoding.ts
Line 8 in 89f462d
Utf8 encoded result gets converted to hex (less the 0x at the start) -
iov-core/packages/iov-ethereum/src/ethereumcodec.ts
Line 85 in ccf3ec6
c8b21e166f0d1604
->63386232316531363666306431363034
It then gets broadcasted on the blockchain as the result of 2 + 0x =
0x63386232316531363666306431363034
However, at step 2 there is a small issue with the encoding. See below
toUtf8 =
48,120,99,56,98,50,49,101,49,54,54,102,48,100,49,54,48,52
toRlp =
146,48,120,99,56,98,50,49,101,49,54,54,102,48,100,49,54,48,52
The Utf8 encoding is fine, however the toRlp adds a non-ascii character during the encoding process. In turn this results in step 3 encoding as a hex which should not be happening.
Due to the incorrect character during the toRlp encoding it causes the exception to be thrown here:
iov-core/packages/iov-ethereum/src/ethereumcodec.ts
Line 83 in ccf3ec6
This fix decodes the data prior to running the
Encoding.fromUtf8(decodedRlp);
line, this removes the non-ascii character which stops the Exception being thrown.