mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 11:07:56 +00:00
Dynamic Benchmarking DB Whitelist (#6815)
* Add `get_whitelist` api * add whitelisted caller * Whitelist caller * remove caller 0 * initial piping of origin (not actual value yet) * remove attempt to pass origin around * Add whitelist for `DidUpdate` storage on `pallet_timestamp` * fix traits * only add to whitelist if !contains * PassBy not implemented error * Whitelist read/writes explicitly per key * update docs * reduce trait constraint * copy pasta * Apply suggestions from code review Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * rename functions @apopiak * missed some renaming * enable doc tests * Update docs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -25,6 +25,7 @@ use sp_debug_derive::RuntimeDebug;
|
||||
|
||||
use sp_std::{vec::Vec, ops::{Deref, DerefMut}};
|
||||
use ref_cast::RefCast;
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
/// Storage key.
|
||||
#[derive(PartialEq, Eq, RuntimeDebug)]
|
||||
@@ -34,6 +35,26 @@ pub struct StorageKey(
|
||||
pub Vec<u8>,
|
||||
);
|
||||
|
||||
/// Storage key with read/write tracking information.
|
||||
#[derive(PartialEq, Eq, RuntimeDebug, Clone, Encode, Decode)]
|
||||
#[cfg_attr(feature = "std", derive(Hash, PartialOrd, Ord))]
|
||||
pub struct TrackedStorageKey {
|
||||
pub key: Vec<u8>,
|
||||
pub has_been_read: bool,
|
||||
pub has_been_written: bool,
|
||||
}
|
||||
|
||||
// Easily convert a key to a `TrackedStorageKey` that has been read and written to.
|
||||
impl From<Vec<u8>> for TrackedStorageKey {
|
||||
fn from(key: Vec<u8>) -> Self {
|
||||
Self {
|
||||
key: key,
|
||||
has_been_read: true,
|
||||
has_been_written: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Storage key of a child trie, it contains the prefix to the key.
|
||||
#[derive(PartialEq, Eq, RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, PartialOrd, Ord, Clone))]
|
||||
|
||||
Reference in New Issue
Block a user