Skip to content

Error originates in the attribute macro subxt::subxt for asset-hub-westend #2006

Closed
@paulormart

Description

@paulormart

Hi @jsdw, I'm currently migrating some staking tooling for AH, but subxt is currently not compiling asset-hub-westend, please see below:

#![allow(missing_docs)]
use subxt::{OnlineClient, SubstrateConfig};

// subxt metadata --url wss://westend-asset-hub-rpc.polkadot.io -f bytes > artifacts/asset_hub_westend_metadata.scale
#[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")]
pub mod polkadot {}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a client to use:
    let api = OnlineClient::<SubstrateConfig>::from_url("wss://westend-asset-hub-rpc.polkadot.io")
        .await?;

    // A query to obtain some contant:
    let constant_query = polkadot::constants().system().block_length();

    // Obtain the value:
    let value = api.constants().at(&constant_query)?;

    println!("Block length: {value:?}");
    Ok(())
}

error[E0277]: the trait bound `PagedExposureMetadata<_1>: subxt::ext::parity_scale_codec::Decode` is not satisfied
 --> subxt/examples/constants_static.rs:9:1
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `subxt::ext::parity_scale_codec::Decode` is not implemented for `PagedExposureMetadata<_1>`
  |
  = note: this error originates in the attribute macro `subxt::subxt` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")], PagedExposureMetadata<_1>: subxt::ext::parity_scale_codec::Decode
  |                                                                                         +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `ExposurePage<_0, _1>: subxt::ext::parity_scale_codec::Decode` is not satisfied
 --> subxt/examples/constants_static.rs:9:1
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `subxt::ext::parity_scale_codec::Decode` is not implemented for `ExposurePage<_0, _1>`
  |
  = note: this error originates in the attribute macro `subxt::subxt` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")], ExposurePage<_0, _1>: subxt::ext::parity_scale_codec::Decode
  |                                                                                         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `PagedExposureMetadata<_1>: subxt::ext::parity_scale_codec::Encode` is not satisfied
 --> subxt/examples/constants_static.rs:9:1
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `subxt::ext::parity_scale_codec::Encode` is not implemented for `PagedExposureMetadata<_1>`
  |
  = note: this error originates in the attribute macro `subxt::subxt` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")], PagedExposureMetadata<_1>: subxt::ext::parity_scale_codec::Encode
  |                                                                                         +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

error[E0277]: the trait bound `ExposurePage<_0, _1>: subxt::ext::parity_scale_codec::Encode` is not satisfied
 --> subxt/examples/constants_static.rs:9:1
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `subxt::ext::parity_scale_codec::Encode` is not implemented for `ExposurePage<_0, _1>`
  |
  = note: this error originates in the attribute macro `subxt::subxt` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider extending the `where` clause, but there might be an alternative better way to express this requirement
  |
9 | #[subxt::subxt(runtime_metadata_path = "../artifacts/asset_hub_westend_metadata.scale")], ExposurePage<_0, _1>: subxt::ext::parity_scale_codec::Encode
  |                                                                                         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

For more information about this error, try `rustc --explain E0277`.
error: could not compile `subxt` (example "constants_static") due to 6 previous errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions