0

I'm making changes in repo1 that has two dependencies in which I need to make a code change:

 [workspace.dependencies]
    solana-signature = { version = "2.2.1", default-features = false }
    solana-vote-interface = "2.2.3"

My question is how to handle the fact that both dependencies come from the same repo (repo2 according to crates.io) but different tags within that repo. Solana-signature is built from tag 2.2.1 and solana-vote-interface is built from tag 2.2.3.

I approached this by:

  1. Forking repo2

  2. Adding repo2 as a submodule to repo1:

    [submodule "solana_sdk"]

    path = solana_sdk

    url = github.com/my_git_user_name/solana_sdk.git

  3. Make updates to repo2 (corresponding to the files in the "signature" and "vote-interface" folders, which exist in the solana-signature and solana-vote-interface crates I mentioned above).

  4. Update patch.crates since other dependencies (not shown above) that I have not changed depend on the ones I changed (like solana-signature):

    [patch.crates-io]

    solana-signature = { path = "solana_sdk/signature" }

This builds correctly with no errors.

My questions are:

  1. Since crates solana-signature and solana-vote-interface are built from repo2 but different tags, how do I make sure that I get the right versions into repo1?
  2. In patch-crates-io, you can see I didn't include a version number. Do I need one here?
6
  • "Which version of repo2 do I check out?" - I thought you made it a submodule of the other repo? What do you mean which version? Commented Jun 6 at 0:14
  • Perhaps I'm using terms I don't understand, sorry for any confusion. I added repo2 to my gitmodules file like this: [submodule "solana_sdk"] path = solana_sdk url = github.com/my_git_user_name/solana_sdk.git Commented Jun 6 at 1:34
  • Repositories are not the same as crates. Multiple crates can happen to be maintained from one repository, but that doesn’t necessarily mean anything. What issue do you run into if you specify the exact version you need for each crate, as published on crates.io? Commented Jun 6 at 5:16
  • If I do that, I get this error: error: failed to select a version for the requirement solana-vote-interface = "^2.2.3". I think this is because there are separate tags for each of the dependencies in repo2: Tag "[email protected]" contains the following: 1. A Cargo.toml in the "signature" folder with "version = "2.2.1" 2. A Cargo.toml in the "vote-interface" folder with "version = "2.2.1" #2 doesn't match the vote-interface requirement for 2.2.3. Commented Jun 6 at 12:38
  • There's another tag "[email protected]" that contains: 1. A Cargo.toml in the "signature" folder with "version = "2.2.1" 2. A Cargo.toml in the "vote-interface" folder with "version = "2.2.3" This works fine for now. However, there's no guarantee any single tag in repo2 will meet both version requirements in the future. How do I handle that? Should make 2 forks of the repo, one that meets each of the requirements? Commented Jun 6 at 12:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.