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] Debug trace call: FlatCallTracer set as default even if GethDebugTracerType::JsTracer is set #1728

Closed
loocapro opened this issue Dec 2, 2024 · 1 comment · Fixed by #1739
Labels
bug Something isn't working

Comments

@loocapro
Copy link
Contributor

loocapro commented Dec 2, 2024

Component

provider, rpc

What version of Alloy are you on?

v.0.7.0

Operating System

macOS (Apple Silicon)

Describe the bug

    fn js_tracer_config() -> GethDebugTracingCallOptions {
        let js_tracer = r#"
    {
        data: [],
        fault: function (log) {},
        step: function (log) {},
        result: function () {
            return this.data;
        }
    }"#
        .to_string();

        GethDebugTracingCallOptions {
            tracing_options: GethDebugTracingOptions {
                tracer: Some(GethDebugTracerType::JsTracer(js_tracer)),
                ..Default::default()
            },
            ..Default::default()
        }
    }
    
    #[tokio::test]
    async fn js_debug_trace_call() {
        let url = std::env::var("ETH_MAINNET_HTTP").expect("$ETH_MAINNET_HTTP must be set.");
        let provider = ProviderBuilder::new().on_http(url.parse().unwrap());
        let tx = TransactionRequest::default().with_input("0xdeadbeef");

        let trace = provider
            .debug_trace_call(tx.into(), BlockId::latest(), js_tracer_config())
            .await
            .unwrap();

        println!("{:?}", trace); // FlatCallTracer([])

        match trace {
            GethTrace::JS(trace) => println!("{:?}", trace),
            _ => panic!(), // panic
        }
    }

This test should return an empty GethTrace::JS but returns a GethTrace::FlatCallTracer.

@mattsse @DaniPopes any idea?

@loocapro loocapro added the bug Something isn't working label Dec 2, 2024
@mattsse
Copy link
Member

mattsse commented Dec 2, 2024

I see,

this matches the untagged deserialized because this returns an empty vec

https://github.com/alloy-rs/alloy/blob/main/crates/rpc-types-trace/src/geth/mod.rs#L117-L118

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

Successfully merging a pull request may close this issue.

2 participants