mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-08 05:27:27 +00:00
Adds debug logs to EVM frame (#6887)
This commit is contained in:
@@ -6,7 +6,7 @@ use codec::{Encode, Decode};
|
||||
use sp_core::{U256, H256, H160};
|
||||
use sp_runtime::traits::UniqueSaturatedInto;
|
||||
use frame_support::traits::Get;
|
||||
use frame_support::storage::{StorageMap, StorageDoubleMap};
|
||||
use frame_support::{debug, storage::{StorageMap, StorageDoubleMap}};
|
||||
use sha3::{Keccak256, Digest};
|
||||
use evm::backend::{Backend as BackendT, ApplyBackend, Apply};
|
||||
use crate::{Trait, AccountStorages, AccountCodes, Module, Event};
|
||||
@@ -147,6 +147,12 @@ impl<'vicinity, T: Trait> ApplyBackend for Backend<'vicinity, T> {
|
||||
});
|
||||
|
||||
if let Some(code) = code {
|
||||
debug::debug!(
|
||||
target: "evm",
|
||||
"Inserting code ({} bytes) at {:?}",
|
||||
code.len(),
|
||||
address
|
||||
);
|
||||
AccountCodes::insert(address, code);
|
||||
}
|
||||
|
||||
@@ -156,8 +162,21 @@ impl<'vicinity, T: Trait> ApplyBackend for Backend<'vicinity, T> {
|
||||
|
||||
for (index, value) in storage {
|
||||
if value == H256::default() {
|
||||
debug::debug!(
|
||||
target: "evm",
|
||||
"Removing storage for {:?} [index: {:?}]",
|
||||
address,
|
||||
index
|
||||
);
|
||||
AccountStorages::remove(address, index);
|
||||
} else {
|
||||
debug::debug!(
|
||||
target: "evm",
|
||||
"Updating storage for {:?} [index: {:?}, value: {:?}]",
|
||||
address,
|
||||
index,
|
||||
value
|
||||
);
|
||||
AccountStorages::insert(address, index, value);
|
||||
}
|
||||
}
|
||||
@@ -167,12 +186,26 @@ impl<'vicinity, T: Trait> ApplyBackend for Backend<'vicinity, T> {
|
||||
}
|
||||
},
|
||||
Apply::Delete { address } => {
|
||||
debug::debug!(
|
||||
target: "evm",
|
||||
"Deleting account at {:?}",
|
||||
address
|
||||
);
|
||||
Module::<T>::remove_account(&address)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
for log in logs {
|
||||
debug::trace!(
|
||||
target: "evm",
|
||||
"Inserting log for {:?}, topics ({}) {:?}, data ({}): {:?}]",
|
||||
log.address,
|
||||
log.topics.len(),
|
||||
log.topics,
|
||||
log.data.len(),
|
||||
log.data
|
||||
);
|
||||
Module::<T>::deposit_event(Event::<T>::Log(Log {
|
||||
address: log.address,
|
||||
topics: log.topics,
|
||||
|
||||
Reference in New Issue
Block a user