-
Notifications
You must be signed in to change notification settings - Fork 258
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
LightClient storage iterator returns duplicates #1453
Comments
Thanks for the issue, we'll have a look at it soon. @lexnv I guess you may have some hunch about this one :) |
I was able to reproduce this locally. My first hunch is that smoldot is providing us duplicate answers. The duplication is checked by account ID at the provided branch, which is a subset of the provided ID. However, I was also able to reproduce this with the ID unaltered. |
We have two different backends. The legacy backend, which makes calls to the legacy RPC methods (ie When we construct a light-client instance in subxt, the default backend is the legacy one. I've encountered a similar issue with the legacy RPCs in combination with smoldot at: smol-dot/smoldot#1638. Next steps here:
Meanwhile, I've got a patch to unblock you Oliver: https://github.com/paritytech/subxt/compare/lexnv/oty-light-client-iter-duplicate-unstable?expand=1 (uses the unstable backend for light-clients), let me know if this helps 🙏 Thanks again for raising this! |
Thanks! I was able to use LightClient now instead of RPC for this project https://github.com/ggwpez/fellowship-compliance, and actually it is faster than RPC 🤯 |
Rather than doing that right now (remember, doing so would requite that users take the |
Just FYI, I merged a PR recently to revamp the light client interface which should help work around this: https://github.com/paritytech/subxt/blob/master/subxt/examples/light_client_basic.rs The idea now is that you construct an #[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// The lightclient logs are informative:
tracing_subscriber::fmt::init();
// Instantiate a light client with the Polkadot relay chain,
// and connect it to Asset Hub, too.
let (lightclient, polkadot_rpc) = LightClient::relay_chain(POLKADOT_SPEC)?;
let asset_hub_rpc = lightclient.parachain(ASSET_HUB_SPEC)?;
let (unstable_backend, driver) = subxt::backend::UnstableBackend::builder().build(asset_hub_rpc);
// Unstable backend needs manually driving at the moment (this way, people
// can choose which async runtime to use):
tokio::spawn!(async move {
while let Some(val) = driver.next().await {
if let Err(e) = val {
// Something went wrong driving unstable backend.
break;
}
}
})
// Create Subxt clients from this unstable backend (ie using new RPCs).
let polkadot_api = OnlineClient::<PolkadotConfig>::from_backend(unstable_backend).await?;
} |
The issue here was the Smoldot state_getKeysPaged API being different from the Substrate one (ie returning the |
I am using the light client feature to try and iterate over all members of the Fellowship.
Code looks like this:
But somehow it returns duplicate values. The full code is on this branch: master...oty-light-client-iter-duplicate
Note that it does work when using an RPC node.
The text was updated successfully, but these errors were encountered: