-
Notifications
You must be signed in to change notification settings - Fork 59
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
A0-1323: Extend Runtime API to handle AlephBFT version #608
A0-1323: Extend Runtime API to handle AlephBFT version #608
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
AlephSessionApi
Runtime 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
u32
version. The scheduled version change is persisted as aStorageValue
->FinalityScheduledVersionChange
. This value stores the information about a scheduled AlephBFT version change, whereversion_incoming
is the version to be set andsession
is the session on which the new version will be set. Apallet_session::Session_Manager
is 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,FinalityScheduledVersionChange
is 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_session
is 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_version
andtransaction_version