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

Fix build after SCALE v3.1 update #1180

Merged
merged 2 commits into from
Mar 15, 2022
Merged

Conversation

HCastano
Copy link
Contributor

Looks like parity-scale-codec-(derive) v3.1 introduced a breaking change with
paritytech/parity-scale-codec#325.

This PR specifies the path we use when pulling in the crate and fixes our failing
master build.

@paritytech-cicd-pr
Copy link

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the examples/* contracts from this branch with cargo-contract 0.17.0-2d43c18 and comparing them to ink! master:

Δ Optimized Size Δ Used Gas Total Optimized Size Total Used Gas
accumulator 1.03 K
adder 2.17 K
contract-introspection 2.37 K
contract-terminate 0.94 K 214_418
contract-transfer 8.15 K 14_418
delegator 6.37 K 46_295
dns 8.84 K 43_254
erc1155 17.23 K 86_508
erc20 8.49 K 43_254
erc721 11.81 K 115_344
flipper 1.31 K 14_418
incrementer 1.21 K 14_418
multisig 25.20 K 93_527
proxy 2.90 K 29_536
rand-extension 3.92 K 14_418
subber 2.19 K
trait-erc20 8.76 K 43_254
trait-flipper 1.00 K 14_418
trait-incrementer 1.19 K 28_836
upgradeable-contract 3.00 K

Link to the run | Last update: Tue Mar 15 02:16:16 CET 2022

@cmichi
Copy link
Collaborator

cmichi commented Mar 15, 2022

I wonder why we didn't get a dependabot PR. Maybe because we specify version = "3" ?

@cmichi cmichi merged commit c974cde into master Mar 15, 2022
@cmichi cmichi deleted the hc-fix-build-after-scale-update branch March 15, 2022 02:52
@bkchr
Copy link

bkchr commented Mar 15, 2022

How did that break your build? What was the error?

@HCastano
Copy link
Contributor Author

@bkchr My bad, I should linked the failed run in the PR description. See it here.

Relevant error:

test tests/ui/contract/pass/no-implicit-prelude.rs [should pass] ... error
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0433]: failed to resolve: use of undeclared crate or module `scale`
 --> tests/ui/contract/pass/no-implicit-prelude.rs:6:5
  |
6 |     pub struct Contract {}
  |     ^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `scale`
  |
  = note: this error originates in the derive macro `::scale::Encode` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `scale`
 --> tests/ui/contract/pass/no-implicit-prelude.rs:6:5
  |
6 |     pub struct Contract {}
  |     ^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `scale`
  |
  = note: this error originates in the derive macro `::scale::Decode` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: use of undeclared crate or module `scale`
 --> tests/ui/contract/pass/no-implicit-prelude.rs:6:5
  |
6 |     pub struct Contract {}
  |     ^^^^^^^^^^^^^^^^^^^^^^ not found in `scale`
  |
help: consider importing this trait
  |
6 |     use scale::Encode;
  |
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈

The UI test in question:

#![no_implicit_prelude]

#[::ink_lang::contract]
mod contract {
    #[ink(storage)]
    pub struct Contract {}

    impl Contract {
        #[ink(constructor)]
        pub fn constructor() -> Self {
            Self {}
        }

        #[ink(message)]
        pub fn message(&self) {}
    }
}

fn main() {}

We import parity-scale-codec as follows:

scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] }

Let me know if you need/want more info

@bkchr
Copy link

bkchr commented Mar 17, 2022

Here is the "correct" fix: paritytech/parity-scale-codec#328

Sorry for the bug

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.

4 participants