mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
runtime-api subsystem lru cache (#2309)
* Add memory-lru cache to runtime-api * Add cache.rs * Adds MallocSizeOf * Review nits * Add a cached requests metric * More review nits * Some more review nits
This commit is contained in:
@@ -10,6 +10,7 @@ edition = "2018"
|
||||
# this crate for WASM. This is critical to avoid forcing all parachain WASM into implementing
|
||||
# various unnecessary Substrate-specific endpoints.
|
||||
parity-scale-codec = { version = "1.3.6", default-features = false, features = [ "derive" ] }
|
||||
parity-util-mem = { version = "0.8.0", optional = true }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
@@ -44,6 +45,7 @@ std = [
|
||||
"sp-core/std",
|
||||
"parking_lot",
|
||||
"log",
|
||||
"parity-util-mem",
|
||||
"sp-externalities",
|
||||
"sc-executor",
|
||||
"sp-io",
|
||||
|
||||
@@ -28,6 +28,9 @@ use serde::{Serialize, Deserialize};
|
||||
#[cfg(feature = "std")]
|
||||
use sp_core::bytes;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use parity_util_mem::MallocSizeOf;
|
||||
|
||||
use polkadot_core_primitives::{Hash, OutboundHrmpMessage};
|
||||
|
||||
/// Block number type used by the relay chain.
|
||||
@@ -35,7 +38,7 @@ pub use polkadot_core_primitives::BlockNumber as RelayChainBlockNumber;
|
||||
|
||||
/// Parachain head data included in the chain.
|
||||
#[derive(PartialEq, Eq, Clone, PartialOrd, Ord, Encode, Decode, RuntimeDebug, derive_more::From)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Default, Hash))]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Default, Hash, MallocSizeOf))]
|
||||
pub struct HeadData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
@@ -49,14 +52,14 @@ impl HeadData {
|
||||
|
||||
/// Parachain validation code.
|
||||
#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, derive_more::From)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash))]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, MallocSizeOf))]
|
||||
pub struct ValidationCode(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
|
||||
|
||||
/// Parachain block data.
|
||||
///
|
||||
/// Contains everything required to validate para-block, may contain block and witness data.
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, derive_more::From)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug, MallocSizeOf))]
|
||||
pub struct BlockData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
|
||||
|
||||
/// Unique identifier of a parachain.
|
||||
@@ -64,7 +67,9 @@ pub struct BlockData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u
|
||||
Clone, CompactAs, Copy, Decode, Default, Encode, Eq,
|
||||
Hash, Ord, PartialEq, PartialOrd, RuntimeDebug,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize, derive_more::Display))]
|
||||
#[cfg_attr(feature = "std", derive(
|
||||
serde::Serialize, serde::Deserialize, derive_more::Display, MallocSizeOf)
|
||||
)]
|
||||
pub struct Id(u32);
|
||||
|
||||
impl TypeId for Id {
|
||||
|
||||
Reference in New Issue
Block a user