Skip to content

medusa-geth module path refactor #584

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

Merged
merged 6 commits into from
Mar 26, 2025
Merged

medusa-geth module path refactor #584

merged 6 commits into from
Mar 26, 2025

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

@Xenomega Xenomega changed the title [WIP] medusa-geth module path refactor medusa-geth module path refactor Mar 14, 2025
@Xenomega
Copy link
Member Author

This PR is now ready for review. It should be merged alongside crytic/medusa-geth#2 (updated CONTRIBUTING.md in medusa-geth to reflect this new flow).

Keep in mind, this PR will be a bit painful in that it will change all module import paths, so existing PRs will probably have to replace any new/changed import paths to point at the new module path.

Copy link
Collaborator

@anishnaik anishnaik left a comment

Choose a reason for hiding this comment

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

bing bong

@anishnaik anishnaik merged commit fbf21b4 into master Mar 26, 2025
12 checks passed
@anishnaik anishnaik deleted the refactormod branch March 26, 2025 18:11
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
2 participants