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 "chain configuration not found" error #1786

Merged
merged 13 commits into from
Nov 4, 2024

Conversation

cmichi
Copy link
Collaborator

@cmichi cmichi commented Nov 4, 2024

Summary

Supersedes #1743.

  • [n] Does it introduce breaking changes?
  • [n] Is it dependent on the specific version of ink or pallet-contracts?

Description

If cargo-contract is installed with newer Rust versions this error will appear when using commands that interact with a chain (instantiate, upload, call, etc.).

User @dhilst reported this and took this screenshot:

image

The root of the error is that stringify! on paths like crate::foo can yield either crate :: foo (with spaces, in newer Rust versions) or crate::foo (without spaces, in older Rust versions). See rust-lang/rust#128992 for more details.

The merge of this behavior into Rust master occurred in rust-lang/rust#125174 on June 12. Nightlies after that are affected and from what I can tell stable from 1.81 on (though I haven't explicitly bisected the version).

This PR makes cargo-contract work with either behavior.

As a follow-up I'll do a backported 4.x patch release.

@cmichi cmichi removed the request for review from smiasojed November 4, 2024 10:30
@cmichi cmichi merged commit 7fddfd9 into master Nov 4, 2024
18 checks passed
@cmichi cmichi deleted the cmichi-handle-both-stringify-cases branch November 4, 2024 17:32
cmichi added a commit that referenced this pull request Nov 5, 2024
* Account for spaced and non-spaced behavior of `stringify!`

* For user output: remove spaces from object path

* Output the chain configuration that was searched

* Apply `cargo fmt`

* Add changelog entry

* Switch spaces clean-up

* Fix string handling

* Apply `cargo fmt`

* Improve comment

* Improve formatting

* Improve assert error message

* Shorten code
@cmichi cmichi mentioned this pull request Nov 5, 2024
cmichi added a commit that referenced this pull request Nov 6, 2024
* Fix "chain configuration not found" error (#1786)

* Account for spaced and non-spaced behavior of `stringify!`

* For user output: remove spaces from object path

* Output the chain configuration that was searched

* Apply `cargo fmt`

* Add changelog entry

* Switch spaces clean-up

* Fix string handling

* Apply `cargo fmt`

* Improve comment

* Improve formatting

* Improve assert error message

* Shorten code

* Update changelog

* Bump version number

* Update `Cargo.lock`
@AlexD10S AlexD10S self-requested a review November 6, 2024 21:15
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.

1 participant