mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 18:11:10 +00:00
b24b66c991
* Provide basic breakpoints * Rename to Observer * Rename feature. Single trait. Borrow-checker * : frame_system::Config * Confused type name * Minor bugs * pub trait * No unnecessary cloning * Make node compile with all features * Move everything debug-related to a single module * Add docs and implementation for () * fmt * Make it feature-gated or for tests * Prepare testing kit * Testcase * Fmt * Use feature in dev-deps * ? * feature propagation * AAAA * lol, that doesn't make much sense to me * Turn on * clippy * Remove self dep * fmt, feature-gating test * Noop to trigger CI * idk * add feature to pipeline * Corrupt test to see if it is actually being run * Revert change * Doc for conf type * Review * Imports * ... * Remove debug for kitchen-sink * Move test * Fix imports * I must have already tried this one...
48 lines
1.8 KiB
Rust
48 lines
1.8 KiB
Rust
#![cfg(feature = "unsafe-debug")]
|
|
|
|
pub use crate::exec::ExportedFunction;
|
|
use crate::{CodeHash, Vec};
|
|
use pallet_contracts_primitives::ExecReturnValue;
|
|
|
|
/// Umbrella trait for all interfaces that serves for debugging, but are not suitable for any
|
|
/// production or benchmarking use.
|
|
pub trait UnsafeDebug<T: frame_system::Config>: ExecutionObserver<CodeHash<T>> {}
|
|
|
|
impl<T: frame_system::Config, D> UnsafeDebug<T> for D where D: ExecutionObserver<CodeHash<T>> {}
|
|
|
|
/// Defines the interface between pallet contracts and the outside observer.
|
|
///
|
|
/// The intended use is the environment, where the observer holds directly the whole runtime
|
|
/// (externalities) and thus can react to the execution breakpoints synchronously.
|
|
///
|
|
/// This definitely *should not* be used in any production or benchmarking setting, since handling
|
|
/// callbacks might be arbitrarily expensive and thus significantly influence performance.
|
|
pub trait ExecutionObserver<CodeHash> {
|
|
/// Called just before the execution of a contract.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `code_hash` - The code hash of the contract being called.
|
|
/// * `entry_point` - Describes whether the call is the constructor or a regular call.
|
|
/// * `input_data` - The raw input data of the call.
|
|
fn before_call(_code_hash: &CodeHash, _entry_point: ExportedFunction, _input_data: &[u8]) {}
|
|
|
|
/// Called just after the execution of a contract.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `code_hash` - The code hash of the contract being called.
|
|
/// * `entry_point` - Describes whether the call was the constructor or a regular call.
|
|
/// * `input_data` - The raw input data of the call.
|
|
/// * `output` - The raw output of the call.
|
|
fn after_call(
|
|
_code_hash: &CodeHash,
|
|
_entry_point: ExportedFunction,
|
|
_input_data: Vec<u8>,
|
|
_output: &ExecReturnValue,
|
|
) {
|
|
}
|
|
}
|
|
|
|
impl<CodeHash> ExecutionObserver<CodeHash> for () {}
|