Restrict "prev" test to just the voting path, to allow catchup. #4198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This slightly weakens the conditions on which we judge a soroban-era upgrade invalid. It is motivated by bug #4193 in which a ledger that was voted-on in the past as a valid protocol-upgrade ledger, by a node with soroban
prev
compiled-in, becomes no longer replayable during catchup by a node without sorobanprev
compiled-in.This only applies to soroban-era stuff, so without loss of generality we can talk about his only applying to the v20->v21 upgrade (it also applies to v21->v22 and so forth but that's even less relevant currently).
Before this change, a node lacking a
prev
build will judge a v20->v21 upgrade invalid for voting or applying during catchup.With this change, a node lacking a
prev
build will judge a v20->v21 upgrade invalid for voting-on only.This is accomplished by moving a conditional from
Upgrades::isValidForApply
(which is called by bothUpgrades::isValid
as well asLedgerManagerImpl::closeLedger
) to its voting-phase callerUpgrades::isValid
.While this does technically "change the protocol" in terms of the semantics of a given ledger -- some previously-invalid ledgers are now valid -- it does so in a very limited way that I believe does not pose any risk in the real world. Specifically: no builds currently in the field claim to support v21 yet at all, so all currently-deployed core builds will already judge all such upgrades invalid on the basis of their protocol number, regardless of
prev
-presence. So long as this change is made before we release anything claiming to speak v21, there should be no observable change to behaviour.(I also added a bit more commentary to the code exploring what will happen to nodes that fail to satisfy the conditional, but get forced to accept the upgrade by a majority, which I think are actually not in a particularly bad position.)
I'd appreciate folks who know about this subsystem and set of conditions reasoning through the logic I'm presenting here for themselves and confirming that it makes sense!
Resolves #4193