Skip to content
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

rlp源码解析好像有点问题。 #8

Open
CaoQiNeng opened this issue May 29, 2018 · 1 comment
Open

rlp源码解析好像有点问题。 #8

CaoQiNeng opened this issue May 29, 2018 · 1 comment

Comments

@CaoQiNeng
Copy link

编码器 encode.go
首先定义了空字符串和空List的值,分别是 0x80和0xC0。 注意,整形的0值的对应值也是0x80。这个在黄皮书上面是没有看到有定义的。 然后定义了一个接口类型给别的类型实现 EncodeRLP。

我用go运行了0x80,得到的结果是128而不是0,不知道我有没有理解错误。

@walking4wq
Copy link
Contributor

是否跟这句话有关,全零数据为非法数据:
When interpreting RLP data, if an expected fragment is decoded as a scalar and leading zeroes are found in the byte sequence, clients are required to consider it non-canonical and treat it in the same manner as otherwise invalid RLP data, dismissing it completely.
There is no specifi c canonical encoding format for signed or floating-point values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants