mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 20:57:59 +00:00
Contracts: expose charge_storage to chain_extension (#14712)
* Contracts: expose charge_storage to chain_extension * fix typo * export Diff
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
use crate::unsafe_debug::ExecutionObserver;
|
||||
use crate::{
|
||||
gas::GasMeter,
|
||||
storage::{self, DepositAccount, WriteOutcome},
|
||||
storage::{self, meter::Diff, DepositAccount, WriteOutcome},
|
||||
BalanceOf, CodeHash, CodeInfo, CodeInfoOf, Config, ContractInfo, ContractInfoOf,
|
||||
DebugBufferVec, Determinism, Error, Event, Nonce, Origin, Pallet as Contracts, Schedule,
|
||||
System, WasmBlob, LOG_TARGET,
|
||||
@@ -274,6 +274,9 @@ pub trait Ext: sealing::Sealed {
|
||||
/// Get a mutable reference to the nested gas meter.
|
||||
fn gas_meter_mut(&mut self) -> &mut GasMeter<Self::T>;
|
||||
|
||||
/// Charges `diff` from the meter.
|
||||
fn charge_storage(&mut self, diff: &Diff);
|
||||
|
||||
/// Append a string to the debug buffer.
|
||||
///
|
||||
/// It is added as-is without any additional new line.
|
||||
@@ -1451,6 +1454,10 @@ where
|
||||
&mut self.top_frame_mut().nested_gas
|
||||
}
|
||||
|
||||
fn charge_storage(&mut self, diff: &Diff) {
|
||||
self.top_frame_mut().nested_storage.charge(diff)
|
||||
}
|
||||
|
||||
fn append_debug_buffer(&mut self, msg: &str) -> bool {
|
||||
if let Some(buffer) = &mut self.debug_message {
|
||||
buffer
|
||||
|
||||
Reference in New Issue
Block a user