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

[WIP] medusa-geth module path refactor #584

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Xenomega
Copy link
Member

@Xenomega Xenomega commented Feb 20, 2025

This PR closes #205 (and addresses a bullet point in #218).

A primer on the current/previous state:

  • go.mod allows you to specify a replaces directive to redirect one package path to another.
  • medusa used this to redirect github.com/ethereum/go-ethereum paths to github.com/crytic/medusa-geth.
  • This way, medusa-geth updates just involved forking and applying our patches on top, then re-linking medusa to the new version.
  • However, the replaces directive only works on the top-level projects, so any attempt to use medusa as a dependency will not include the replaces directive and will break medusa's ability to be imported. This same problem is also why go install will not work (as replaces is not respected).
  • You should actually be doing a replace-all of the original module path with any forks then, it seems. Google discussed adding a new feature to better handle this in the future, but that has yet to be seen.

TLDR: We were prone to golang/go#44840 .

This new PR updates this by:

  • Refactoring all import/module paths in a new branch of medusa-geth.
  • Refactor all import paths for medusa-geth in the medusa project.
  • Replace the replaces directive with a proper import to github.com/crytic/medusa-geth.

The implications are:

  • Currently open PRs may just need some touch ups/fixes on import paths if they added any new files.
  • Supporting future forks of go-ethereum will now have two changes to their process: (1) a refactor commit doing a replace-all of any instances of github.com/ethereum/go-ethereum to github.com/crytic/medusa-geth should be done after our patch set is applied and all is finalized, (2) the patch set we carry forward should not include the final refactoring commit (from step 1), as the imported files will likely change all the time.

Outstanding TODOs on my end before I ask for a PR review:

  • Test the medusa-geth patch applying cycle with the new process
  • Update the CONTRIBUTING.md in medusa-geth to reflect this.
  • Verify no wiki/documentation should be updated elsewhere.

Currently, you can test this with go install -v github.com/crytic/medusa@refactormod. Once it is merged, go install -v github.com/crytic/medusa@latest should work

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.

One-line installation for medusa
1 participant