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

Switch all hex to bytes conversions to ethjs equivalents #632

Closed
wants to merge 4 commits into from

Conversation

alivia-g
Copy link

fixes #624

@acolytec3
Copy link
Collaborator

Thanks for the PR. I'm not 100% sure what all you were working on here but this shouldn't require updating any dependencies (notably eslint and related plugins) and there should be no updates to docs. This is purely changing the fromHexString/toHexString methods over to the equivalents from @ethereumjs/util. We won't be able to take this in without removing all the extra stuff.

Notably, if you want to continue with this, it should be pretty close a simple "find/replace" across 3 main packages (portalnetwork, cli, era).

Let me know if you want to continue on this one.

@alivia-g
Copy link
Author

I will continue working on this one, thank you for explaining.

fixing tests

Revert "Switch all hex to bytes conversions to ethjs equivalents"

This reverts commit 040ff32933c5a9fb178d224c71f793fc25e2f1da.
Currently passing portalnetwork test and integration test, cli test still have 1 failed test. I'm not sure how to proceed from here.

Here is the failed cli test case:
```
 FAIL  test/rpc/portal/beaconLocalContent.spec.ts > portal_beaconLocalContent tests > should not find any local content
AssertionError: expected -32603 to equal -32009

- Expected
+ Received

- -32009
+ -32603

 ❯ test/rpc/portal/beaconLocalContent.spec.ts:20:12
     18|       ),
     19|     ])
     20|     assert.equal(res.error.code, -32009)
       |            ^
     21|     ultralight.kill(9)
     22|   }, 10000)
```
@alivia-g
Copy link
Author

Currently it's passing portalnetwork test and integration test, cli test still have 1 failed test. I'm not sure how to proceed from here.

Here is the failed cli test case:

 FAIL  test/rpc/portal/beaconLocalContent.spec.ts > portal_beaconLocalContent tests > should not find any local content
AssertionError: expected -32603 to equal -32009

- Expected
+ Received

- -32009
+ -32603

 ❯ test/rpc/portal/beaconLocalContent.spec.ts:20:12
     18|       ),
     19|     ])
     20|     assert.equal(res.error.code, -32009)
       |            ^
     21|     ultralight.kill(9)
     22|   }, 10000)

Copy link
Collaborator

@ScottyPoi ScottyPoi left a comment

Choose a reason for hiding this comment

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

Regarding the hex / bytes conversion functions --

hexToBytes and bytesToHex must be imported from @ethereumjs/util. There are several files in which you are attempting to import these from other libraries.

any other changes (such as to package.json) should be reverted. keep the scope of this PR limited to the conversion functions.

@@ -11,9 +11,8 @@ import {
NodeLookup,
PingPongCustomDataType,
PortalWireMessageType,
fromHexString,
hexToBytes,
Copy link
Collaborator

@ScottyPoi ScottyPoi Sep 30, 2024

Choose a reason for hiding this comment

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

bytesToHex and hexToBytes should be imported from @ethereumjs/util

@acolytec3
Copy link
Collaborator

@alivia-g we updated package-lock so maybe the dev issues you were seeing should be resolved now. Are you still interested in giving this a go? If so, can you redo this PR along the lines @ScottyPoi described. Basically, everywhere you see toHexString and fromHexString imported from @chainsafe/discv5, those imports should be replaced by bytesToHex and hexToBytes imported from @ethereumjs/util.

@acolytec3 acolytec3 closed this Oct 19, 2024
@acolytec3
Copy link
Collaborator

Closed due to lack of follow up

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

Successfully merging this pull request may close these issues.

Switch all hex to bytes conversions to ethjs equivalents
3 participants