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

Remove bazel-go-ethereum fork, use upstream go-ethereum #9725

Merged
merged 36 commits into from
Oct 19, 2021

Conversation

prestonvanloon
Copy link
Member

@prestonvanloon prestonvanloon commented Oct 3, 2021

What type of PR is this?

Other

What does this PR do? Why is it needed?

We have been maintaining bazel-go-ethereum for some time. The root cause is that bazel build file generation doesn't understand how to reference c dependencies in subdirectories.

The solution I have implemented here is to commit a few go-ethereum c dependencies into the vendor folder.

  • Add github.com/karalabe/usb to vendor directory. Disable all hid functionality.
  • Add a patch to the sepc256k1 BUILD file generation

I took a shortcut with the usb library. We don't use this in prysm at all and I was spinning tires trying to figure out the right combination of things to add to the build files.
So, the usb library is stripped to be disabled. This is the same behavior we've done in bazel-go-ethereum.

Which issues(s) does this PR fix?

This unblocks some desired behavior for the merge testing. #9716

Anyone can now drop in a replacement for go-ethereum and it should work without thinking about messy bazel stuff (unless the drop in has new exotic c/c++ deps). Example below.

go mod edit -replace github.com/ethereum/go-ethereum=github.com/MariusVanDerWijden/[email protected]
go mod tidy
bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%prysm_deps -prune=true
go mod tidy

Other notes for review

  • Bumps go-ethereum to v1.10.10
  • Some changes required to the toolchain for cross compile due to some more darwin dependencies upstream

Resolves #5418

@prestonvanloon prestonvanloon requested a review from a team as a code owner October 3, 2021 18:16
@prestonvanloon prestonvanloon marked this pull request as draft October 3, 2021 18:54
@prestonvanloon
Copy link
Member Author

Change to draft. Cross compile is broken on mac, need to test windows.

@prestonvanloon
Copy link
Member Author

Tested cross compiles
✔️ linux_amd64
✔️ linux_arm64
❌ darwin_arm64
✔️ windows_amd64

On darwin

external/com_github_rjeczalik_notify/watcher_fsevents_cgo.go:10:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Same issue as rjeczalik/notify#196

@prestonvanloon prestonvanloon added Cleanup Code health! Eth1chain Priority: High High priority item labels Oct 3, 2021
@prestonvanloon prestonvanloon marked this pull request as ready for review October 10, 2021 23:51
@prestonvanloon
Copy link
Member Author

Cross compile fixed.

Copy link
Member

@nisdas nisdas left a comment

Choose a reason for hiding this comment

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

For github.com/ethereum/go-ethereum/crypto/sepc256k1, is there anyway we can ensure that whenever we update our geth commit, our vendored dependency is always in sync with that commit ? Otherwise there is the possibility of the the dependency simply being out of date.

@prestonvanloon
Copy link
Member Author

For github.com/ethereum/go-ethereum/crypto/sepc256k1, is there anyway we can ensure that whenever we update our geth commit, our vendored dependency is always in sync with that commit ? Otherwise there is the possibility of the the dependency simply being out of date.

@nisdas I think we should consider applying patches to go_repository. This has been harder to maintain in the past but would be a safer check that sepc256k1 is the same code as upstream. I'll give this a try tomorrow and see how large the patch would be for sepc256k1. The root of the fix was to define a hdrs target and include it in the go_library target so that may not be a very big patch file. I also expect that the c header code will not change, but the go bindings might.

@prestonvanloon prestonvanloon marked this pull request as draft October 12, 2021 03:35
@prestonvanloon
Copy link
Member Author

Still working on this.

@prestonvanloon prestonvanloon marked this pull request as ready for review October 18, 2021 23:18
nisdas
nisdas previously approved these changes Oct 18, 2021
@prylabs-bulldozer prylabs-bulldozer bot merged commit 65db331 into develop Oct 19, 2021
@delete-merged-branch delete-merged-branch bot deleted the rm-bazel-go-ethereum branch October 19, 2021 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup Code health! Priority: High High priority item
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove dependency on go-ethereum fork
2 participants