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

Upgrade smoldot dependencies #1722

Closed

Conversation

paulormart
Copy link
Contributor

Hi there,

This is just a small PR to upgrade subxt to the latest smoldot and smoldot-light versions and adjust respective dependencies.

@paulormart paulormart requested a review from a team as a code owner August 24, 2024 01:50
@niklasad1
Copy link
Member

niklasad1 commented Aug 24, 2024

Hey, this smoldot version contains a few regressions unless I missed something.
That's why we haven't updated it.

//cc @lexnv knows that better than I do

@paulormart
Copy link
Contributor Author

Thank you @niklasad1. Let me close this PR, just saw the issue you might referring to here smol-dot/smoldot#1896

@paulormart paulormart closed this Aug 25, 2024
@paulormart
Copy link
Contributor Author

Hi @niklasad1 @lexnv, did further testing and fetching storage data through an iterator doesn't end with the current version smoldot v0.16.0 / smoldot-light v0.14.0 it keeps repeating the same storage items forever.

The same behaviour is not happening with the latest smoldot v0.18.0 / smoldot-light v0.16.2, but there are still some repeated storage entries (not sure yet if this is a subxt issue or smoldot), this is not the case if the same storage iterator is queried directly from an RPC.

Below is just an example I used to test this out:

#![allow(missing_docs)]
use subxt::{client::OnlineClient, lightclient::LightClient, PolkadotConfig};
use std::collections::BTreeMap;

// Generate an interface that we can use from the node's metadata.
#[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata_full.scale")]
pub mod polkadot {}

const POLKADOT_SPEC: &str = include_str!("../../artifacts/demo_chain_specs/polkadot.json");

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // The lightclient logs are informative:
    tracing_subscriber::fmt::init();

    let (_, polkadot_rpc) = LightClient::relay_chain(POLKADOT_SPEC)?;
    
    // Create Subxt clients from these Smoldot backed RPC clients.
    let api = OnlineClient::<PolkadotConfig>::from_rpc_client(polkadot_rpc).await?;

    let address = polkadot::storage()
        .bounties()
        .bounties_iter();

    let mut iter = api.storage().at_latest().await?.iter(address).await?;

    let mut data = BTreeMap::new();
    while let Some(Ok(storage)) = iter.next().await {
        data.entry(storage.key_bytes).and_modify(|n| *n += 1).or_insert(1);
    }
    
    println!("{:?}", data);

    Ok(())
}

Let me know if it's worth to reopen this PR,
Thanks

@niklasad1
Copy link
Member

I thought the duplicate storage issue was fixed see #1453 for further info.

Ok, I think it is worth to open an issue for this if it still happening.

@paulormart
Copy link
Contributor Author

Just to leave it here, running the integration tests below for this PR returns the following:

cargo test --release --package integration-tests --features unstable-light-client -- --nocapture
...
running 2 tests
thread 'utils::test_subxt_macro' panicked at testing/integration-tests/src/utils/mod.rs:18:1:
Test timedout: Elapsed(())
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test utils::test_subxt_macro - should panic ... ok
test light_client::light_client_testing has been running for over 60 seconds
test light_client::light_client_testing ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 202.55s

   Doc-tests integration_tests

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

The test finalized_headers_subscription(&api).await?; is the one hanging more than expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants