A0-1323: Extend Runtime API to handle AlephBFT version#608
A0-1323: Extend Runtime API to handle AlephBFT version#608maciejzelaszczyk merged 48 commits intomainfrom
Conversation
|
Based on a fruitful conversation with @fixxxedpoint and @kostekIV, I am converting this back to draft, as we have converged on an alternative and potentially more robust scheme to handle version updates. Will re-request review once a working version is ready. |
DamianStraszak
left a comment
There was a problem hiding this comment.
My last doubt is regarding naming in this pallet. We want to use versioning not only for alephBFT but also for signature aggregation, and who knows what else in the future. I think its safe to use a more generic name here like schedule_finality_version_change or schedule_consensus_version_change instead of schedule_aleph_bft_version_change.
We ideally want to avoid changing the names ever, because it is in the runtime.
Sounds good, either name is fine to me. |
|
The names you propose sound good, although it's a bit strange that these two things (abft & justifications) get conflated – to be clear I don't have a better solution and this one seems alright, just the versioning will correspond to "official" versions in a strange way. At the same time I'm worried about the arguments you use – changing names of functions in the runtime (or other changes there for that matter) shouldn't be that disastrous and we should probably spend some time figuring out how to do this better. I think I already mentioned this a long time ago, but it got forgotten... I'll add a task. |
…ardinal-Cryptography/aleph-node into A0-1323-aleph-bft-version-coordination
|
Changing the names of runtime calls (=extrinsics) is fine (if these are sudo calls, because only we need to adapt), but changing the names in the runtime API is imho VERY non-trivial, because you need to add some compatibility layer in the host, otherwise a runtime update with new API would crash the node. We should probably add this compatibility layer when writing the host part of update logic. That being said -- let's avoid changing names anyway, and use |
|
DamianStraszak
left a comment
There was a problem hiding this comment.
Ehh. I approved but now I see that spec_version has not been bumped. Why is that?
First time working on anything in the runtime. Have corrected this just now. |
|
You must also bump |
This should be OK now. |
|
@DamianStraszak I have performed some final tests and there is one case that bothers me. Not a bug per se, but worth considering nonetheless. Whenever you use |
|
Actually, this bothered me too much, so I went and implemented the change. |
# Conflicts: # bin/runtime/src/lib.rs
df0c193 to
95a7fdd
Compare
Description
This extends the
AlephSessionApiRuntime API, to handle the AlephBFT version. Storage items, getters, a setter and the declaration and implementation of appropriate methods are provided.The solution is based on a
u32version. The scheduled version change is persisted as aStorageValue->FinalityScheduledVersionChange. This value stores the information about a scheduled AlephBFT version change, whereversion_incomingis the version to be set andsessionis the session on which the new version will be set. Apallet_session::Session_Manageris implemented to check whether a scheduled version change has moved into the past and, if so, to record it as the current versionStorageValue->FinalityVersion. When a version change is recorded as the current version,FinalityScheduledVersionChangeis cleared.Importantly, we can always reschedule a version change, and an already set version change may move into the past as time goes by. The value of the
current_sessionis needed to check whether the version change needs to be recorded as the current version.In order to cancel a scheduled version change, we need to use the version change setter (scheduler) and schedule a version change which will actually not change the current version.
Type of change
Please delete options that are not relevant.
Checklist:
spec_versionandtransaction_version