Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.

Fix secp256k1 verification #17

Merged
merged 4 commits into from
Sep 29, 2020
Merged

Conversation

vorot93
Copy link
Member

@vorot93 vorot93 commented Sep 25, 2020

Long map/and_then chains caused the real verification result to be obscured behind layers of Results.

@vorot93 vorot93 requested a review from AgeManning September 25, 2020 20:21
Copy link
Contributor

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires storing all underlying values as RLP encoded data.

This looks correct to me as is. After a few more tests, I think we should merge down.

@AgeManning AgeManning mentioned this pull request Sep 29, 2020
@AgeManning
Copy link
Contributor

This resolves #18

@vorot93 vorot93 merged commit af3f815 into master Sep 29, 2020
@vorot93 vorot93 deleted the vorot93/fix-secp256k1-validation branch September 29, 2020 03:27
@holiman
Copy link

holiman commented Sep 29, 2020

Since this PR fixes #18, it would be good if it also includes the actual ENR-data from #18 as a unit-test too. Personally, I'd import a hundred or so ENR-entries from e.g. https://github.com/ethereum/discv4-dns-lists/blob/master/all.ropsten.ethdisco.net/nodes.json as unit-tests

@AgeManning
Copy link
Contributor

The interesting this is, that one of those ENR's is already a unit test.

The RLP mismatch came up earlier in decoding the actual RLP. @vorot93 found a bug where I missed verifying the signature. Once he corrected that, we realised we were not verifying the signature of this kind of RLP data, because the signature is dependent on how we re-encode the received data.

As a result this PR was failing the unit tests. I corrected this PR to correctly handle this RLP encoding edge case, which in turns lead to passing all the unit tests, which includes an ENR from the list you gave.

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

Successfully merging this pull request may close these issues.

3 participants