mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
Emit log on Runtime Code change. (#9580)
* Emit digest item on Runtime Code changes. * Add tests. * cargo +nightly fmt --all * Rename. * Add comment. * Move generic parameter to the trait. * cargo +nightly fmt --all * Elaborate in doc. * Revert to RuntimeUpdated name * cargo +nightly fmt --all * Rename to RuntimeEnvironmentUpdated
This commit is contained in:
@@ -118,6 +118,14 @@ pub enum DigestItem<Hash> {
|
||||
|
||||
/// Some other thing. Unsupported and experimental.
|
||||
Other(Vec<u8>),
|
||||
|
||||
/// An indication for the light clients that the runtime execution
|
||||
/// environment is updated.
|
||||
///
|
||||
/// Currently this is triggered when:
|
||||
/// 1. Runtime code blob is changed or
|
||||
/// 2. `heap_pages` value is changed.
|
||||
RuntimeEnvironmentUpdated,
|
||||
}
|
||||
|
||||
/// Available changes trie signals.
|
||||
@@ -184,6 +192,8 @@ pub enum DigestItemRef<'a, Hash: 'a> {
|
||||
ChangesTrieSignal(&'a ChangesTrieSignal),
|
||||
/// Any 'non-system' digest item, opaque to the native code.
|
||||
Other(&'a Vec<u8>),
|
||||
/// Runtime code or heap pages updated.
|
||||
RuntimeEnvironmentUpdated,
|
||||
}
|
||||
|
||||
/// Type of the digest item. Used to gain explicit control over `DigestItem` encoding
|
||||
@@ -199,6 +209,7 @@ pub enum DigestItemType {
|
||||
Seal = 5,
|
||||
PreRuntime = 6,
|
||||
ChangesTrieSignal = 7,
|
||||
RuntimeEnvironmentUpdated = 8,
|
||||
}
|
||||
|
||||
/// Type of a digest item that contains raw data; this also names the consensus engine ID where
|
||||
@@ -225,6 +236,7 @@ impl<Hash> DigestItem<Hash> {
|
||||
Self::Seal(ref v, ref s) => DigestItemRef::Seal(v, s),
|
||||
Self::ChangesTrieSignal(ref s) => DigestItemRef::ChangesTrieSignal(s),
|
||||
Self::Other(ref v) => DigestItemRef::Other(v),
|
||||
Self::RuntimeEnvironmentUpdated => DigestItemRef::RuntimeEnvironmentUpdated,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,6 +334,7 @@ impl<Hash: Decode> Decode for DigestItem<Hash> {
|
||||
DigestItemType::ChangesTrieSignal =>
|
||||
Ok(Self::ChangesTrieSignal(Decode::decode(input)?)),
|
||||
DigestItemType::Other => Ok(Self::Other(Decode::decode(input)?)),
|
||||
DigestItemType::RuntimeEnvironmentUpdated => Ok(Self::RuntimeEnvironmentUpdated),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,6 +470,9 @@ impl<'a, Hash: Encode> Encode for DigestItemRef<'a, Hash> {
|
||||
DigestItemType::Other.encode_to(&mut v);
|
||||
val.encode_to(&mut v);
|
||||
},
|
||||
Self::RuntimeEnvironmentUpdated => {
|
||||
DigestItemType::RuntimeEnvironmentUpdated.encode_to(&mut v);
|
||||
},
|
||||
}
|
||||
|
||||
v
|
||||
|
||||
Reference in New Issue
Block a user