-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Change protocol versioning to allow independent upstream and zcash changes. #114
Comments
I think that a pair of version numbers with lexicographic ordering is not significantly more complex than a single version number. |
We can even potentially encode that ordering into a single version number (e.g. UPSTREAM_VERSION*10 + ZEROCASH_MINOR_VERSION) if that makes things simpler. |
Note: figure out what upstream's "version bits" plan is (there is at least one BIP and people actively working on implementation right now), as it's probably directly relevant. |
The Calgary design uses the |
We're reconsidering this. |
Here are my thoughts. No matter what syntax we decide on for versioning, there are always going to be a finite number N of valid versions. What I mean by a version, here, is the entire contents of all transaction version fields. The number N is, in effect, the number of cases transaction-handling code has to deal with. Therefore, we want N to be small. I personally prefer a scheme where each of the N combinations are written down explicitly, and each of those cases have separate code paths. Adding bit fields to the version number violates that, since N grows exponentially in the number of fields you add. The exception to my desire not to allow exponential N-growth is if it's upstream that makes the bad decision to allow it. For example, if upstream adds bit fields. If they do, it's better to re-use upstream's code with as few changes as possible than it is to try to re-implement their changes in a way that constrains N. I guess my preference is for version numbers to be opaque symbols (as opaque as a random 128-bit number, say), with no internal meaning, and not even an ordering between them. Anything else should be implemented explicitly as flags/fields which have a meaning within the opaque version they're a part of. |
The Bitcoin Version bits BIP proposes multiple soft forks going on at the same time, which I think would be awfully complicated to reason about. This just makes me more confident we should have our own separate version field, so that we can allow upstream to do whatever it wants with its field. |
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
We need to change the We should treat I think this is somewhere we can afford, for simplicity purposes, to diverge with upstream on. |
Okay, I'm sold by @ebfull 's arguments here. Let's do the simplest thing and stick with a single |
The "needs prioritization" is just to remind us to look at this ticket (and close it if we have consensus) at the next engineering meeting. |
Tracking upstream while also having flexibility to extend or customize the protocol is going to be tricky, and one indicator of the complexity is deciding how to do protocol versioning.
For example, consider if we have a policy for the block
CURRENT_VERSION
that says "whenever upstream increments the version, we also increment it. Whenever we alter the protocol, we also increment the version."Now we need to remember a mapping from each ZC block-scoped protocol version to each upstream block-scoped protocol version. This also means we must alter every code site which does versioning checks appropriately.
Another option might be to have separate ZC and upstream version number fields in blocks. The advantage here is that the mapping from the upstream version is direct, and code which reacts to it doesn't need to be modified by ZC. The disadvantage is that the (block-scoped) protocol version is now a 2-dimensional tuple rather than a fully ordered int, so if we need to introduce a total ordering, there will be some weird complex logic.
The text was updated successfully, but these errors were encountered: