paritytech / parity-scale-codec

Lightweight, efficient, binary serialization and deserialization codec
Apache License 2.0
243 stars 95 forks source link

Compilation Error with `parity-scale-codec v3.6.9` After Updating Substrate Chain to `polkadot-v1.9.0` #575

Open Ali-Usama opened 5 months ago

Ali-Usama commented 5 months ago

After updating my Substrate blockchain project to target polkadot-v1.9, I updated the parity-scale-codec dependency from version 3.6.5 to 3.6.9. This update introduced a compilation error related to a missing full_encode method which wasn't previously required or mentioned.

Error Details

The compiler emits the following error during the build process:

error[E0046]: not all trait items implemented, missing: `full_encode`
   --> /Users/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/parity-scale-codec-3.6.9/src/codec.rs:345:1
    |
343 |     fn full_encode(&self, _into: &mut Vec<u8>);
    |     ------------------------------------------- `full_encode` from trait
344 | }
345 | impl<S: Encode + EncodeLike> FullEncode for S {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `full_encode` in implementation

For more information about this error, try `rustc --explain E0046`.

This error suggests that a full_encode method is now expected but not implemented. This method was not part of the required API in parity-scale-codec 3.6.5 and does not appear to be documented in the current version.

Steps to Reproduce

Expected Behavior

I expected the project to compile without errors related to parity-scale-codec, as it did with version 3.6.5.

Questions

Additional Context

Rust toolchain version: nightly-2024-01-22 Substrate version targeted: polkadot-v1.9.0 Dependency change: parity-scale-codec 3.6.5 -> 3.6.9

Any guidance or insights into resolving this compilation error would be greatly appreciated.

bkchr commented 5 months ago

Hmm, this function full_encode doesn't exist. Please try to delete your cargo cache:

rm -rf ~/.cargo/registry