mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 03:31:10 +00:00
Storage chain: Runtime module (#8624)
* Transaction storage runtime module * WIP: Tests * Tests, benchmarks and docs * Made check_proof mandatory * Typo * Renamed a crate * Apply suggestions from code review Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Added weight for on_finalize * Fixed counter mutations * Reorganized tests * Fixed build * Update for the new inherent API * Reworked for the new inherents API * Apply suggestions from code review Co-authored-by: cheme <emericchevalier.pro@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Store transactions in a Vec * Added FeeDestination * Get rid of constants * Fixed node runtime build * Fixed benches * Update frame/transaction-storage/src/lib.rs Co-authored-by: cheme <emericchevalier.pro@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: cheme <emericchevalier.pro@gmail.com> Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -629,33 +629,34 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn storage_index_transaction(&mut self, index: u32, offset: u32) {
|
||||
fn storage_index_transaction(&mut self, index: u32, hash: &[u8], size: u32) {
|
||||
trace!(
|
||||
target: "state",
|
||||
"{:04x}: IndexTransaction ({}): [{}..]",
|
||||
"{:04x}: IndexTransaction ({}): {}, {} bytes",
|
||||
self.id,
|
||||
index,
|
||||
offset,
|
||||
HexDisplay::from(&hash),
|
||||
size,
|
||||
);
|
||||
self.overlay.add_transaction_index(IndexOperation::Insert {
|
||||
extrinsic: index,
|
||||
offset,
|
||||
hash: hash.to_vec(),
|
||||
size,
|
||||
});
|
||||
}
|
||||
|
||||
/// Renew existing piece of data storage.
|
||||
fn storage_renew_transaction_index(&mut self, index: u32, hash: &[u8], size: u32) {
|
||||
fn storage_renew_transaction_index(&mut self, index: u32, hash: &[u8]) {
|
||||
trace!(
|
||||
target: "state",
|
||||
"{:04x}: RenewTransactionIndex ({}) {} bytes",
|
||||
"{:04x}: RenewTransactionIndex ({}): {}",
|
||||
self.id,
|
||||
index,
|
||||
HexDisplay::from(&hash),
|
||||
size,
|
||||
);
|
||||
self.overlay.add_transaction_index(IndexOperation::Renew {
|
||||
extrinsic: index,
|
||||
hash: hash.to_vec(),
|
||||
size
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -118,8 +118,10 @@ pub enum IndexOperation {
|
||||
Insert {
|
||||
/// Extrinsic index in the current block.
|
||||
extrinsic: u32,
|
||||
/// Data offset in the extrinsic.
|
||||
offset: u32,
|
||||
/// Data content hash.
|
||||
hash: Vec<u8>,
|
||||
/// Indexed data size.
|
||||
size: u32,
|
||||
},
|
||||
/// Renew existing transaction storage.
|
||||
Renew {
|
||||
@@ -127,8 +129,6 @@ pub enum IndexOperation {
|
||||
extrinsic: u32,
|
||||
/// Referenced index hash.
|
||||
hash: Vec<u8>,
|
||||
/// Expected data size.
|
||||
size: u32,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,6 +520,11 @@ impl OverlayedChanges {
|
||||
self.children.get(key).map(|(overlay, info)| (overlay.changes(), info))
|
||||
}
|
||||
|
||||
/// Get an list of all index operations.
|
||||
pub fn transaction_index_ops(&self) -> &[IndexOperation] {
|
||||
&self.transaction_index_ops
|
||||
}
|
||||
|
||||
/// Convert this instance with all changes into a [`StorageChanges`] instance.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn into_storage_changes<
|
||||
|
||||
Reference in New Issue
Block a user