mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 11:27:58 +00:00
Contracts: Update Config::Debug (#14789)
* Update Debug trait * Rename * tweak * fmt * Better namings * rm unsafe-debug * rework doc * nit * fix comment * clippy * update naming * Rename file * fmt fixes * rename * Move tracing behind umbrella Debugging trait * fix * fix comment * reorder imports * comment * update doc * add missing doc * add missing doc * Update Debugging -> Debugger * Update bin/node/runtime/Cargo.toml
This commit is contained in:
+23
-16
@@ -1,7 +1,5 @@
|
||||
#![cfg(feature = "unsafe-debug")]
|
||||
|
||||
use super::*;
|
||||
use crate::unsafe_debug::{ExecutionObserver, ExportedFunction};
|
||||
use crate::debug::{CallSpan, ExportedFunction, Tracing};
|
||||
use frame_support::traits::Currency;
|
||||
use pallet_contracts_primitives::ExecReturnValue;
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -19,31 +17,40 @@ thread_local! {
|
||||
static DEBUG_EXECUTION_TRACE: RefCell<Vec<DebugFrame>> = RefCell::new(Vec::new());
|
||||
}
|
||||
|
||||
pub struct TestDebugger;
|
||||
pub struct TestDebug;
|
||||
pub struct TestCallSpan {
|
||||
code_hash: CodeHash<Test>,
|
||||
call: ExportedFunction,
|
||||
input: Vec<u8>,
|
||||
}
|
||||
|
||||
impl ExecutionObserver<CodeHash<Test>> for TestDebugger {
|
||||
fn before_call(code_hash: &CodeHash<Test>, entry_point: ExportedFunction, input_data: &[u8]) {
|
||||
impl Tracing<Test> for TestDebug {
|
||||
type CallSpan = TestCallSpan;
|
||||
|
||||
fn new_call_span(
|
||||
code_hash: &CodeHash<Test>,
|
||||
entry_point: ExportedFunction,
|
||||
input_data: &[u8],
|
||||
) -> TestCallSpan {
|
||||
DEBUG_EXECUTION_TRACE.with(|d| {
|
||||
d.borrow_mut().push(DebugFrame {
|
||||
code_hash: code_hash.clone(),
|
||||
code_hash: *code_hash,
|
||||
call: entry_point,
|
||||
input: input_data.to_vec(),
|
||||
result: None,
|
||||
})
|
||||
});
|
||||
TestCallSpan { code_hash: *code_hash, call: entry_point, input: input_data.to_vec() }
|
||||
}
|
||||
}
|
||||
|
||||
fn after_call(
|
||||
code_hash: &CodeHash<Test>,
|
||||
entry_point: ExportedFunction,
|
||||
input_data: Vec<u8>,
|
||||
output: &ExecReturnValue,
|
||||
) {
|
||||
impl CallSpan for TestCallSpan {
|
||||
fn after_call(self, output: &ExecReturnValue) {
|
||||
DEBUG_EXECUTION_TRACE.with(|d| {
|
||||
d.borrow_mut().push(DebugFrame {
|
||||
code_hash: code_hash.clone(),
|
||||
call: entry_point,
|
||||
input: input_data,
|
||||
code_hash: self.code_hash,
|
||||
call: self.call,
|
||||
input: self.input,
|
||||
result: Some(output.data.clone()),
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user