Skip to content

Commit

Permalink
DEBUG: log the original validation error & one more place for Undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Jan 30, 2025
1 parent bb47ba7 commit 950862c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frame/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"]
ethereum = { workspace = true, features = ["with-codec"] }
ethereum-types = { workspace = true }
evm = { workspace = true, features = ["with-codec"] }
log = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-info = { workspace = true }
# Substrate
Expand Down Expand Up @@ -47,6 +48,7 @@ std = [
"ethereum/std",
"evm/std",
"ethereum-types/std",
"log/std",
"rlp/std",
"scale-codec/std",
"scale-info/std",
Expand Down
3 changes: 2 additions & 1 deletion frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ impl<T: Config> Pallet<T> {
};

Pending::<T>::append((transaction, status, receipt));

log::info!("**** FRONTIER, apply_validated_transaction: before ethereum.Executed event");
Self::deposit_event(Event::Executed {
from: source,
to: dest.unwrap_or_default(),
Expand Down Expand Up @@ -985,6 +985,7 @@ pub struct InvalidTransactionWrapper(InvalidTransaction);

impl From<TransactionValidationError> for InvalidTransactionWrapper {
fn from(validation_error: TransactionValidationError) -> Self {
log::info!("*** FRONTIER, ethereum, validation_error={:?}", validation_error);
match validation_error {
TransactionValidationError::GasLimitTooLow => InvalidTransactionWrapper(
InvalidTransaction::Custom(TransactionValidationError::GasLimitTooLow as u8),
Expand Down
7 changes: 7 additions & 0 deletions frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,11 @@ pub mod pallet {

match info.exit_reason {
ExitReason::Succeed(_) => {
log::info!("***** FRONTIER evm, before evm.Executed event");
Pallet::<T>::deposit_event(Event::<T>::Executed { address: target });
}
_ => {
log::info!("***** FRONTIER evm, before evm.ExecutedFailed event");
Pallet::<T>::deposit_event(Event::<T>::ExecutedFailed { address: target });
}
};
Expand Down Expand Up @@ -334,6 +336,7 @@ pub mod pallet {
value: create_address,
..
} => {
log::info!("***** FRONTIER evm, before evm.Created event");
Pallet::<T>::deposit_event(Event::<T>::Created {
address: create_address,
});
Expand All @@ -343,6 +346,7 @@ pub mod pallet {
value: create_address,
..
} => {
log::info!("***** FRONTIER evm, before evm.CreatedFailed event");
Pallet::<T>::deposit_event(Event::<T>::CreatedFailed {
address: create_address,
});
Expand Down Expand Up @@ -422,6 +426,7 @@ pub mod pallet {
value: create_address,
..
} => {
log::info!("***** FRONTIER evm, before evm.Created 2 event");
Pallet::<T>::deposit_event(Event::<T>::Created {
address: create_address,
});
Expand All @@ -431,6 +436,7 @@ pub mod pallet {
value: create_address,
..
} => {
log::info!("***** FRONTIER evm, before evm.CreatedFailed 2 event");
Pallet::<T>::deposit_event(Event::<T>::CreatedFailed {
address: create_address,
});
Expand Down Expand Up @@ -498,6 +504,7 @@ pub mod pallet {

impl<T> From<TransactionValidationError> for Error<T> {
fn from(validation_error: TransactionValidationError) -> Self {
log::info!("**** FRONTIER, frame/evm/src/lib.rs validation_error={:?}", validation_error);
match validation_error {
TransactionValidationError::GasLimitTooLow => Error::<T>::GasLimitTooLow,
TransactionValidationError::GasLimitTooHigh => Error::<T>::GasLimitTooHigh,
Expand Down
14 changes: 11 additions & 3 deletions frame/evm/src/runner/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,19 @@ where
) -> (ExitReason, R),
R: Default,
{
log::info!("****** FRONTIER: running execute_inner: weight_limit={:?}, proof_size_base_cost={:?}", weight_limit, proof_size_base_cost);
log::info!("****** FRONTIER: running execute_inner: weight_limit.proof_size={:?}", weight_limit.unwrap().proof_size());

// Used to record the external costs in the evm through the StackState implementation
let maybe_weight_info =
WeightInfo::new_from_weight_limit(weight_limit, proof_size_base_cost).map_err(
|_| RunnerError {
error: Error::<T>::Undefined,
weight,
|err| {
log::info!("**** FRONTIER, execute_inner. ERROR={:?}", err);

RunnerError {
error: Error::<T>::Undefined,
weight,
}
},
)?;
// The precompile check is only used for transactional invocations. However, here we always
Expand Down Expand Up @@ -330,6 +337,7 @@ where
log.data.len(),
log.data
);
log::info!("**** FRONTIER, evm, before evm.Log event");
Pallet::<T>::deposit_event(Event::<T>::Log {
log: Log {
address: log.address,
Expand Down

0 comments on commit 950862c

Please sign in to comment.