#Can't build release: `not all trait items implemented, missing: 'escalate_error_to_panic'`

13 messages · Page 1 of 1 (latest)

alpine trout
#

Hey, I copied token contract (https://github.com/stellar/soroban-examples/tree/v0.8.4/token) from the examples to the empty rust workspace and I can't compile wasm binary out of it.
cargo check and cargo test works without any issues.
But:

$ cargo build --target wasm32-unknown-unknown --release
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /home/xxx/contracts/token/Cargo.toml
workspace: /home/xxx/Cargo.toml
warning: /home/xxx/Cargo.toml: unused manifest key: workspace.dev_dependencies
   Compiling soroban-env-guest v0.0.16
error[E0046]: not all trait items implemented, missing: `escalate_error_to_panic`
   --> /home/XXX/.cargo/registry/src/index.crates.io-6f17d22bba15001f/soroban-env-guest-0.0.16/src/guest.rs:168:1
    |
168 | impl EnvBase for Guest {
    | ^^^^^^^^^^^^^^^^^^^^^^ missing `escalate_error_to_panic` in implementation
    |
    = help: implement the missing item: `fn escalate_error_to_panic(&self, _: <Self as soroban_env_common::EnvBase>::Error) -> ! { todo!() }`

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

What surprises me the most, is that in soroban-example repository I can compile binary out of the same contract without any issues...

GitHub

Example Soroban Contracts. Contribute to stellar/soroban-examples development by creating an account on GitHub.

gloomy vault
#

what happens if you move the profile.release from /home/xxx/contracts/token/Cargo.toml to /home/xxx/Cargo.toml ?

alpine trout
#

Good catch. I do have profile.release in main workspace Cargo.toml, but I didn't remove the one from token/Cargo.toml.
I removed it now and removed all cargo cache - nontheless, same error still persists.

alpine trout
#

Bumping this question.
I'm unable to build release version because of buggy SDK...

#
$ cargo build --target wasm32-unknown-unknown --release
warning: /home/...../Cargo.toml: unused manifest key: workspace.dev_dependencies
  Downloaded wasm-bindgen-macro v0.2.87
  Downloaded wasm-bindgen-macro-support v0.2.87
  Downloaded wasm-bindgen-backend v0.2.87
  Downloaded soroban-sdk v0.8.7
  Downloaded wasm-bindgen-shared v0.2.87
  Downloaded soroban-token-sdk v0.8.7
  Downloaded wasm-bindgen v0.2.87
  Downloaded js-sys v0.3.64
  Downloaded 8 crates (381.6 KB) in 0.78s
   Compiling proc-macro2 v1.0.60
   Compiling quote v1.0.28
   Compiling unicode-ident v1.0.9
...
   Compiling soroban-spec v0.8.7
   Compiling soroban-env-macros v0.0.16
   Compiling soroban-env-guest v0.0.16
error[E0046]: not all trait items implemented, missing: `escalate_error_to_panic`
   --> /home/u/.cargo/registry/src/index.crates.io-6f17d22bba15001f/soroban-env-guest-0.0.16/src/guest.rs:168:1
    |
168 | impl EnvBase for Guest {
    | ^^^^^^^^^^^^^^^^^^^^^^ missing `escalate_error_to_panic` in implementation
    |
    = help: implement the missing item: `fn escalate_error_to_panic(&self, _: <Self as soroban_env_common::EnvBase>::Error) -> ! { todo!() }`

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

Can't build release: not all trait items implemented, missing: 'escalate_error_to_panic'

alpine trout
#

Alright, I managed to pinpoint the issue.
I created a Rust workspace (https://doc.rust-lang.org/cargo/reference/workspaces.html) for my contracts and for some reason it seems to be causing this issue.
When I isolated a contract into monorepo (or I just removed the workspace features altogether) it compiled successfully.

Problem absolutely is not solved - why would particular compilation fail because of environment arrangement?

plush creek
# alpine trout Alright, I managed to pinpoint the issue. I created a Rust workspace (https://do...

Hey @alpine trout I ran into the same problem and found a solution in soroswap (https://github.com/esteblock/soroswap) and xycloans (https://github.com/xycloo/xycloans) repos. The solution is write dependencies in root Cargo.toml and give a link in the contract Cargo.toml like this soroban-sdk = { workspace = true }

GitHub

Contribute to esteblock/soroswap development by creating an account on GitHub.

GitHub

Flash loans and risk-free liquidity protocol on Soroban. - GitHub - xycloo/xycloans: Flash loans and risk-free liquidity protocol on Soroban.

alpine trout
#

I've been using that since the start

#

Only complete removal of those new workspace features (with deps as you stated) fixed the issue

#

Which means it's most likely is not a full solution

open warren
alpine trout
#

Good point. I didn't have resolver set before.
I'll bring back my changes and let you know if it worked