Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: confusing error logs for non-top VM frames #533

Open
itegulov opened this issue Jan 14, 2025 · 1 comment
Open

bug: confusing error logs for non-top VM frames #533

itegulov opened this issue Jan 14, 2025 · 1 comment
Labels
bug 🐛 Something isn't working

Comments

@itegulov
Copy link
Contributor

CallErrorTracer prints errors for all VM frames even if they do not make the transaction fail.

Example:

08:04:46  INFO Validating 0xc2d617ef17ed5ebb0fd59255891bf9a638decf27b37811c2e8a15cd360f3b14a
08:04:46  INFO Executing 0xc2d617ef17ed5ebb0fd59255891bf9a638decf27b37811c2e8a15cd360f3b14a
08:04:46 ERROR !! Got error flags: 
08:04:46 ERROR WRITE IN STATIC
08:04:46  INFO 
08:04:46  INFO ✅  [SUCCESS] Hash: 0xc2d617ef17ed5ebb0fd59255891bf9a638decf27b37811c2e8a15cd360f3b14a

Where WRITE IN STATIC happens inside a simulated static call somewhere deep inside the VM (non-top frame)

@dutterbutter
Copy link
Collaborator

dutterbutter commented Jan 14, 2025

Related to: #436

I'd like to refactor CallErrorTracer to return result with accumulated errors something like below. We only care about the returned flag to use to provide a more informative error message. For example, if ERROR NOT ENOUGH ERGS flag is returned we know the user ran out of gas during execution and can more explicitly inform them of what action to take.

pub struct CallErrorTracer {
    result: Arc<OnceCell<ErrorFlags>>,
}

impl CallErrorTracer {
    pub fn new(result: Arc<OnceCell<ErrorFlags>>) -> Self {
        Self { result }
    }
}

impl<S, H: HistoryMode> DynTracer<S, SimpleMemory<H>> for CallErrorTracer {
    fn after_decoding(
        &mut self,
        _state: VmLocalStateData<'_>,
        data: AfterDecodingData,
        _memory: &SimpleMemory<H>,
    ) {
        if !data.error_flags_accumulated.is_empty() {
            let _ = self.result.set(data.error_flags_accumulated);
        }
    }
}

impl<S: WriteStorage, H: HistoryMode> VmTracer<S, H> for CallErrorTracer {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants