Skip to content

Commit 77ebcae

Browse files
bkchrordian
andauthored
sp-version: Improve the docs (paritytech#2027)
Co-authored-by: ordian <[email protected]>
1 parent f328ff7 commit 77ebcae

1 file changed

Lines changed: 32 additions & 15 deletions

File tree

  • substrate/primitives/version/src

substrate/primitives/version/src/lib.rs

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,24 @@ pub struct RuntimeVersion {
175175
/// will not attempt to author blocks unless this is equal to its native runtime.
176176
pub authoring_version: u32,
177177

178-
/// Version of the runtime specification. A full-node will not attempt to use its native
179-
/// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
180-
/// `spec_version` and `authoring_version` are the same between Wasm and native.
178+
/// Version of the runtime specification.
179+
///
180+
/// A full-node will not attempt to use its native runtime in substitute for the on-chain
181+
/// Wasm runtime unless all of `spec_name`, `spec_version` and `authoring_version` are the same
182+
/// between Wasm and native.
183+
///
184+
/// This number should never decrease.
181185
pub spec_version: u32,
182186

183-
/// Version of the implementation of the specification. Nodes are free to ignore this; it
184-
/// serves only as an indication that the code is different; as long as the other two versions
185-
/// are the same then while the actual code may be different, it is nonetheless required to
186-
/// do the same thing.
187-
/// Non-consensus-breaking optimizations are about the only changes that could be made which
188-
/// would result in only the `impl_version` changing.
187+
/// Version of the implementation of the specification.
188+
///
189+
/// Nodes are free to ignore this; it serves only as an indication that the code is different;
190+
/// as long as the other two versions are the same then while the actual code may be different,
191+
/// it is nonetheless required to do the same thing. Non-consensus-breaking optimizations are
192+
/// about the only changes that could be made which would result in only the `impl_version`
193+
/// changing.
194+
///
195+
/// This number can be reverted to `0` after a [`spec_version`](Self::spec_version) bump.
189196
pub impl_version: u32,
190197

191198
/// List of supported API "features" along with their versions.
@@ -198,15 +205,25 @@ pub struct RuntimeVersion {
198205
)]
199206
pub apis: ApisVec,
200207

201-
/// All existing dispatches are fully compatible when this number doesn't change. If this
202-
/// number changes, then `spec_version` must change, also.
208+
/// All existing calls (dispatchables) are fully compatible when this number doesn't change. If
209+
/// this number changes, then [`spec_version`](Self::spec_version) must change, also.
203210
///
204-
/// This number must change when an existing dispatchable (module ID, dispatch ID) is changed,
211+
/// This number must change when an existing call (pallet index, call index) is changed,
205212
/// either through an alteration in its user-level semantics, a parameter
206-
/// added/removed/changed, a dispatchable being removed, a module being removed, or a
207-
/// dispatchable/module changing its index.
213+
/// added/removed, a parameter type changed, or a call/pallet changing its index. An alteration
214+
/// of the user level semantics is for example when the call was before `transfer` and now is
215+
/// `transfer_all`, the semantics of the call changed completely.
216+
///
217+
/// Removing a pallet or a call doesn't require a *bump* as long as no pallet or call is put at
218+
/// the same index. Removing doesn't require a bump as the chain will reject a transaction
219+
/// referencing this removed call/pallet while decoding and thus, the user isn't at risk to
220+
/// execute any unknown call. FRAME runtime devs have control over the index of a call/pallet
221+
/// to prevent that an index gets reused.
222+
///
223+
/// Adding a new pallet or call also doesn't require a *bump* as long as they also don't reuse
224+
/// any previously used index.
208225
///
209-
/// It need *not* change when a new module is added or when a dispatchable is added.
226+
/// This number should never decrease.
210227
pub transaction_version: u32,
211228

212229
/// Version of the state implementation used by this runtime.

0 commit comments

Comments
 (0)