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

trace_call not working with Nethermind #2594

Open
JuusoAsd opened this issue Sep 12, 2023 · 0 comments
Open

trace_call not working with Nethermind #2594

JuusoAsd opened this issue Sep 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@JuusoAsd
Copy link

JuusoAsd commented Sep 12, 2023

Version
2.0.10
Platform
MACOS

Description
Middleware.trace_call does not work with Nethermind at least on pending transactions.

let provider = Provider::<Ws>::connect(address).await.unwrap();
let mut tx_hash_stream = provider.subscribe_full_pending_txs().await.unwrap();
let tx = tx_hash_stream.next().await.unwrap();
loop {
    match provider
        .trace_call(&tx, vec![TraceType::StateDiff], Some(BlockNumber::Latest))
        .await
    {
        Ok(traces) => {
            println!("Ok: {:?}", traces.state_diff);
        }
        Err(e) => {
            println!("Error tracing the transaction: {}", e);
        }
    }
}

The code results in: Error tracing the transaction: invalid type: null, expected a string at line 1 column 14

When interacting with the node directly with curl, an example response looks like this:

{"jsonrpc":"2.0","result":{"output":null,"stateDiff":{"0xdac17f958d2ee523a2206206994597c13d831ec7":{"balance":"=","code":"=","nonce":"=","storage":{"0x02ed89f7e64402c46ce0e6975e59967cbe9ee50ad233e3d28d5ee84d620b4c5b":{"*":{"from":"0x00000000000000000000000000000000000000000000000000000005f667e340","to":"0x00000000000000000000000000000000000000000000000000000008d698da80"}},"0x86900fad2cf71703c8ee91de06d5eb287d58b1d3247df86ebdf446794a40ee6c":{"*":{"from":"0x000000000000000000000000000000000000000000000000000009ac8de27890","to":"0x000000000000000000000000000000000000000000000000000009a9adb18150"}}}},"0xe795d3de925c970cbef7c691f9c39505202afaca":{"balance":"=","code":"=","nonce":{"*":{"from":"0xaec","to":"0xaed"}},"storage":{}}},"trace":[],"vmTrace":null},"id":1} 

The output field of result is null, however BlockTrace returned by trace_call requires output field to be Bytes. After changing it to Option<Bytes>, this works as expected.

BlockTrace:
https://github.com/gakonst/ethers-rs/blob/90b87bd85be98caa8bb592b67f3f9acbc8a409cf/ethers-core/src/types/trace/mod.rs#L29C1-L45C2

Nethermind version:

Version: 1.20.2+62f034ed
Commit: 62f034ed4de657c09b9b9a0a660b66b4f4c7e353
Build Date: 2023-08-30 06:45:03Z
OS: Linux x64
Runtime: .NET 7.0.10
@JuusoAsd JuusoAsd added the bug Something isn't working label Sep 12, 2023
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

1 participant