-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Solana Releases Should Follow Strict Semantic Versioning #32503
Comments
Personal opinion, not necessarily reflective of the rest of the Solana Labs team. The breakage at hand is indeed unpleasant. So let's pretend we did bump the whole SDK to I think, such a version change, it would have just created a different set of issues. Issues that talk about "not implemented I am personally still trying to figure out how this should have been done, if at all possible, in a completely transparent way. [1] To be fair, I put a little blame on |
i did complain many times about this issue in the last months, given there's a big hackathon about to start (august/september), this should be solved urgently. people who try to build for the first time rn will simply get stuck with cargo compile errors. many developers that try solana often have limited rust experience and spending 8+ hours to fix dependencies to get a tutorial to work, doesn't really inspire confidence to start a larger project or even deploy to mainnet. it's the equivalent to a bug in the checkout feature, simply the worst kind of friction. |
It's a fair point that Semantic Versioning, nor any solution, will cover all cases, but that's not the goal. The goal is to improve the current situation to the point where we are not driving away new developers due to high costs sorting out dependency issues. I have been turned away from doing side projects because of these issues, and I do this for a living, so I have a lot better chance of resolving the issues than someone brand new would. Semantic Versioning should significantly improve the situation from what it is now. However, if you have a better system to suggest, that's fine too. Consistency and communication are probably what are most important. What seems to happen though, is people don't like Semantic Versioning so then they don't follow any system and that leads to the kinds of issues we're seeing today.
I don't follow this example. Cargo won't automatically include a major version if you use the default caret Now what Solana could do, is it could define its own system, say, x.0.0 releases are for runtime changes, 0.x.0 releases are breaking changes to the libs and 0.0.x for everything else. If you use that system consistently it would probably work and help fix some of the issues, but all it's doing is shifting SemVer schema to the right while following the same idea and now we all have to fight against the Cargo versioning defaults and against developer expectations since most of us are used to SemVer. |
Totally agree with this, any system is better than no system. As a minimum, it sets the expectations and rules when breaking changes can occur. It does not need to be perfect, just consistent. |
Absolutely. I think we are all trying to make the situation better.
Note, that Solana "Backward Compatibility Policy" says that Solana is supposed to follow Semantic Versioning. I do think there is a different approach that could work better.
It seems you assume that should we have increased the SDK version to It looks to me, that our understanding of how Note that I do think that we did fail the "minor version should be backward compatible" assumption.
We are going to release a new version one way or another. As you are saying, the default dependency constraints are "it is OK to bump minor, but major must match". What we need to understand is what would We can look at If two incompatible versions of a dependency are present in the dependency list,
The same page says, that this approach may lead to errors, if types are used as part of the crate public API. So, it only works for crates used in the implementation part of the code. This is exactly the problem people observed with
Also, going through a major version bump for a fundamental dependency can be a very labor intense process. We had the following options then:
I do not know the exact reasoning for not going with option 1. We considered option 2 and realized it was non-trivial. We decided option 3 is good enough, as
I do not think it is an option, as both
I think, in practice, Solana SDK will have to stay at version 1 forever. Footnotes
|
It sounds as if we currently do not have any system in place. We underestimated the scale of the breakage. We already run tests for a few downstream projects as part of our CI. As well as a simple example application. We still have not decided the priority and the ownership, but it is something we are discussing internally. |
Dependency issues should be the last thing people need to think about but it has been the biggest problem recently. SemVer
The main idea of the post you've linked is that SemVer is good for machines but not for humans, summarized by the author:
The author then goes to suggest a list of subjective reasons of why some version bumps are more imported than others due to some arbitrary reasons such as the % of users who are affected by the change(as if that can be known accurately). A breaking change in a public API is a breaking change in a public API. While I agree that SemVer is not perfect, I think there is a fundamental misundertanding of when and why to use SemVer. SemVer is not about how the authors feel about the change, it's for consumers of the library to know which version to use without breaking their existing code. SDK
On the day of the Given this approach broke the builds of the entire ecosystem and therefore caused everyone in the ecosystem some kind of compilation issue, I'm curious about the how the other approach would cause "way more issues".
I'll compare
|
Software for a MINOR version release will be compatible across all software on the same MAJOR version. You're not even following your own system linked as proven by 1.14 --> 1.16. That's the crux of the nature of the complaint. Your system is effectively SemVer but you consistently don't follow it. |
I am not trying to justify the breakage that happened with the We are working to fix
Maybe I should not have included the link. What I had in mind is that there are certain complexities that do happen in practice, that semantic versioning may not able to address. XKCD has a comic about the same problem: https://xkcd.com/1172/
Yes, as I have written above, we do want
There is some confusing here. An upgrade to
When you are saying, "It is not even guaranteed that this would cause any problems" - this contradicts the example I've provided. You are right that As a side note, I do not think that asking people to provide explicit version numbers is a very good approach.
Not sure if I follow. Could you unpack this? The idea is that everyone will use default version constraints, by default. We do want crates that depend on the SDK to be able to use newer versions of the SDK. I also do not understand what do you mean by "which brings us to exactly where we've started". |
I would like to disagree here. It does not mean that we can not improve our testing process. |
TL;DRDoing the same thing and expecting different results. This is a long post, I've tried to reply to your comments as best as I could and this is probably going to be my last comment on the issue because it doesn't look like it will get anywhere.
I definitely agree with you that SemVer may not be able to address everything, but I also have no doubt in my mind that if
What you are saying is hard to disagree with, but it's not the point. The point is following SemVer is an objective process that doesn't require certain people to guess what percentage of the users will get affected by this breaking change. If you are confident in your ability to estimate such numbers, I can only applaud your skills but history shows that hasn't been the case for Solana.
Again, SemVer is not perfect and I'm trying to understand your viewpoint but I'm having a hard time seeing a logical argument.
This is the point about guessing numbers, there is no need to anticipate or guess.
"this approach" is what Solana has been doing for a long time, which is to include breaking changes randomly in a SemVer compatible version(not only with minor releases but even with patch releases). It is proven by years of data to be unreliable yet it is still being defended.
No it would NOT have broken every new setup, e.g.
As I agreed in my post that it could cause some issues, I repeat, it's not guaranteed that it would cause problems. Just because there are different versions of a crate as a transitive dependency, does not mean you are automatically going to have issues. And again, this would be a problem if the user follows your exact steps. For example, if they did the same thing in reverse order i.e. added the old dependency first and then
Where do you get the new setups will be 100% broken? Since you've shown interest in estimating the percentage of people this change would affect, this 100% breaking rate would assume the only way people to new installations is the exact steps you've provided(in order), which is provably incorrect. Instead, most people initialize new projects by running
You are right, upgrade to
Though this conversation has only been about
There is no other option as long as you Solana keeps telling
Specifying a maximum version for Solana has been a common solution for Solana's inability to follow SemVer for many of the ecosystem crates in the past, and from the looks of it, they will have to continue to do so. Strict
|
I know that Solana is working hard to remedy the v1.16 breakage and I really appreciate the efforts so I definitely want to acknowledge that. I also see that Solana is updating the Backwards Compatibility Policy to more accurately reflect the way releases are actually made, which is good, even though I would prefer proper SemVer as I think it reduces the need for extra communications to developers. I feel like our conversation here may be starting to move into territory where it's unproductive but I would like to explain that I didn't open this issue only because of v1.16. Solana breaking things has been a persistent issue in my time in the ecosystem and judging from community reactions I'm not the only one who feels that way. I haven't posted specific examples in this thread because 1) it felt unnecessary and 2) I don't want specific developers to think I'm targeting their code when it's more of a systemic issue. Finally, it's worth noting that I have been responsible for some breaking changes in minor versions in my tenure at Metaplex so I have definitely been part of the problem. This is part of why I'm making efforts to be part of the solution as well. However, if you don't think there have been a significant number of breakages I recommend you do some or all of the following:
I think that will give you a pretty fair understanding of the depth of frustration the community has experienced on this issue. Again, I have been part of the wider ecosystem problem. This is not meant to be accusatory in nature, just an explanation for where the frustration comes from and that this isn't solely about v1.16. |
Would be great to understand why you need to keep the major version fixed "forever". Can you please explain? I'm sure you have a good reason, but it also means that 3rd party developers will treat your minor version as majors in that case and use <= or ~ to pin them, then other developers will need to fork their packages to update dependencies. This is the problem we have been trying to solve for the last months. And everyone agrees, it should be solved. Let's get to the bottom of it. |
The main substantive issue I understand with releasing a 2.x is having both 1.x and 2.x in the dependency graph and thus different types with with the same name. This issue is described in the cargo reference here, and was discussed in the now-closed docs PR with an example here. Could @ilya-bobyr , @joncinque , or someone else explain why the Semver trick cannot be used to re-export types in the event of a 2.x release? My initial assumption is that there would be too many types to deal with. |
We'd have to do that for sure, but before we can do that, we need people to trust our minor versions and allow all of them in their toml files. The semver trick helps, but it isn't a perfect solution, since you cause immediate breakage between 1.X and 1.X+1. You're counting on everyone using the default cargo dependency declaration so that they can pick up the newer minor version right away. More likely, we'll develop a whole new SDK for program-runtime v2 and never need to break anything again. |
If you build a bot that communicates with dapps that were built using different anchor versions you end up with duplicate types for solana-sdk. Status quo, this issue is already prevalent (outside of trivial examples of course). Everyone building backend services for defi has seen it. Not wanting to use major upgrades to avoid versioned symbols on a major upgrade, leads to versioned symbols on a minor upgrade, I hope that makes somewhat intuitively sense. Given that everyone is experiencing the issue you are trying to protect from, I think it's adequate to reconsider that protection policy. Any other reasons to keep the major version fixed "forever"? |
Are there any Cargo workarounds? I am getting frustrated as it becomes almost impossible for me to update apps that rely on many third party Solana programs / libs. |
You can do things like upgrade specific versions of packages within the lock file with: |
Just coming here, feeling forced to add a +1 Like who does this ?! Almost breaking changes on all minors, and not even checked fixes in detail (we agree this would be the funniest or the saddest depending on how you take it)... Pretty much the worse dev ecosystem so far... Would love to come with a magic solution, but pretty much all examples are messed up / broken, nothing gets updated, funniest one is "Solana Cookbook", not sure you can cook anything with that.. So at some point are you willing to open the gates to adoption and attract new talents or not... |
Mike from Solana Foundation here - our training material currently must include content with a manual workaround to this issue (see slide 95) when we show new Solana developers onchain development. This isn't the only problem that exists out of the box, however post the next release of Anchor (thanks to the great work in 0.30 and some future PRs we've made to 0.31), it will be the only one remaining. My understanding is that Semver would ensure cargo installs a compatible version of the |
Problem
Solana frequently ships versions of libraries used by developers that are not compatible with with Semantic Versioning which leads to numerous dependency issues in downstream libraries. One of the main causes of the dependency issues is the Rust package manager, Cargo, expects Semantic Versioning to be followed and defaults to pulling in new versions based on this dependency scheme. This leads to downstream packages breaking or being unable to upgrade if Solana does not follow the scheme.
Solana v1.16, in particular, has caused significant issues because it upgrades to a breaking version of borsh (0.9.3 --> 0.10.3). I assume there is some kind of social component in not wanting to upgrade major versions of Solana (v2.0, v3.0, etc.) but I would argue the lost developer adoption and development pain outweigh this nicety.
A few examples of issues:
coral-xyz/anchor#2511
https://solana.stackexchange.com/questions/6991/how-to-fix-error-the-trait-borshserialize-is-not-implemented-for-pubkey
A few examples of Twitter threads discussing dependency issues:
https://twitter.com/redacted_noah/status/1679907169523597325?s=20
https://twitter.com/HeyAndyS/status/1678069298516901893?s=20
https://twitter.com/blockiosaurus/status/1675289236818350082?s=20
https://twitter.com/ngundotra/status/1679928743593140230?s=20
https://twitter.com/redacted_noah/status/1675889143040147457?s=20
Proposed Solution
Implement a process to strictly follow semantic versioning in the solana monorepo and program library releases. If Solana and other major significant ecosystem players, such as Metaplex and Anchor, all adhere to semantic versioning, this should greatly reduce the dependency issues the space is rife with.
In addition, it may make sense for Solana developers to work in concert with e.g. Anchor maintainers and Metaplex protocol team to coordinate upgrades when new versions hit mainnet so the ecosystem stays in sync. There's a number of nested and cyclic dependencies that make it difficult for a single team to upgrade (packages relying on Token Metadata which in turn relies on spl-token etc.).
The text was updated successfully, but these errors were encountered: