mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 21:51:06 +00:00
Cleanup of the state-machine crate (#3524)
* Start refactoring state-machine crate * More improvement to state-machine * Fix tests compilation on master and remove warnings * Fix compilation * Apply suggestions from code review Co-Authored-By: Sergei Pepyakin <sergei@parity.io> * Update core/state-machine/src/basic.rs Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * Line width * Update core/primitives/src/storage.rs Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com> * Update core/state-machine/src/error.rs Co-Authored-By: Benjamin Kampmann <ben.kampmann@googlemail.com> * Review feedback
This commit is contained in:
@@ -663,6 +663,112 @@ impl<T: Externalities> Externalities for LimitedExternalities<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// An implementation of offchain extensions that should never be triggered.
|
||||
pub enum NeverOffchainExt {}
|
||||
|
||||
impl NeverOffchainExt {
|
||||
/// Create new offchain extensions.
|
||||
pub fn new<'a>() -> Option<&'a mut Self> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl Externalities for NeverOffchainExt {
|
||||
fn is_validator(&self) -> bool {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn submit_transaction(&mut self, _extrinsic: Vec<u8>) -> Result<(), ()> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn network_state(
|
||||
&self,
|
||||
) -> Result<OpaqueNetworkState, ()> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn timestamp(&mut self) -> Timestamp {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn sleep_until(&mut self, _deadline: Timestamp) {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn random_seed(&mut self) -> [u8; 32] {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn local_storage_set(&mut self, _kind: StorageKind, _key: &[u8], _value: &[u8]) {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn local_storage_compare_and_set(
|
||||
&mut self,
|
||||
_kind: StorageKind,
|
||||
_key: &[u8],
|
||||
_old_value: Option<&[u8]>,
|
||||
_new_value: &[u8],
|
||||
) -> bool {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn local_storage_get(&mut self, _kind: StorageKind, _key: &[u8]) -> Option<Vec<u8>> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn http_request_start(
|
||||
&mut self,
|
||||
_method: &str,
|
||||
_uri: &str,
|
||||
_meta: &[u8]
|
||||
) -> Result<HttpRequestId, ()> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn http_request_add_header(
|
||||
&mut self,
|
||||
_request_id: HttpRequestId,
|
||||
_name: &str,
|
||||
_value: &str
|
||||
) -> Result<(), ()> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn http_request_write_body(
|
||||
&mut self,
|
||||
_request_id: HttpRequestId,
|
||||
_chunk: &[u8],
|
||||
_deadline: Option<Timestamp>
|
||||
) -> Result<(), HttpError> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn http_response_wait(
|
||||
&mut self,
|
||||
_ids: &[HttpRequestId],
|
||||
_deadline: Option<Timestamp>
|
||||
) -> Vec<HttpRequestStatus> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn http_response_headers(
|
||||
&mut self,
|
||||
_request_id: HttpRequestId
|
||||
) -> Vec<(Vec<u8>, Vec<u8>)> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn http_response_read_body(
|
||||
&mut self,
|
||||
_request_id: HttpRequestId,
|
||||
_buffer: &mut [u8],
|
||||
_deadline: Option<Timestamp>
|
||||
) -> Result<usize, HttpError> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
Reference in New Issue
Block a user