starknet-foundry icon indicating copy to clipboard operation
starknet-foundry copied to clipboard

Backtrace shows irrelevant information

Open ddoktorski opened this issue 7 months ago • 2 comments

Current State

In some scenarios SNFORGE_BACKTRACE can show a backtrace for a different error that caused the test to panic. A simple example is as follows:

// Contract:
fn this_fails() {
    // something that fails, but is catchable in the test e.g. `call_contract_syscall` but with nonexistent selector
}

// Test:
fn test() {
    match dispatcher.this_fails() {
        Ok(_) => {},
        Err(err) => { // handled here, execution continues }
    }
    // some other code that fails
}

In such case the backtrace for the function this_fails will be displayed even though it was handled in the test code.

Objective

Make sure that backtrace displays only relevant data

Additional Context

Potentially, this can be fixed by enabling backtraces only for non catchable errors. With the current implementation it's a bit tricky to distinguish such errors, but perhaps it would be easier if we decide to remove CallToBlockifierRuntime.

ddoktorski avatar Apr 15 '25 07:04 ddoktorski

unicode json方式有个不好的地方就是,修改完之后再保存回去,存的是编码后的内容。 默认的json格式化是经过逻辑优化,不会经过解析成对象再美化,所以速度上更快。


关于自动识别格式的优先级个性化设定确实有在我待办列表,最近都在忙着重写版本,新功能也都塞到重新的Pro版本中了

tiny-craft avatar Nov 04 '24 02:11 tiny-craft