Executing task: cargo test --package predicates-test --test integration_tests -- just_test --exact --nocapture
Compiling predicates-test v0.1.0 (/Users/alexey/projects/fuel/predicates-test)
error[E0061]: this method takes 0 arguments but 1 argument was supplied
--> tests/harness.rs:62:45
|
62 | let predicate_data: Vec<u8> = predicate.encode_data(42_u64);
| ^^^^^^^^^^^ ------ argument of type `u64` unexpected
|
note: associated function defined here
--> tests/harness.rs:7:1
|
7 | / abigen!(Predicate(
8 | | name = "Predicate",
9 | | abi = "out/debug/predicates-test-abi.json"
10 | | ));
| |__^
= note: this error originates in the macro `abigen` (in Nightly builds, run with -Z macro-backtrace for more info)
help: remove the extra argument
|
62 | let predicate_data: Vec<u8> = predicate.encode_data();
| ~~
error[E0308]: mismatched types
--> tests/harness.rs:62:35
|
62 | let predicate_data: Vec<u8> = predicate.encode_data(42_u64);
| ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Vec<u8>`, found `Predicate`
| |
| expected due to this
|
= note: expected struct `Vec<u8>`
found struct `Predicate`
error[E0308]: mismatched types
--> tests/harness.rs:73:13
|
67 | .spend_predicate(
| --------------- arguments to this method are incorrect
...
73 | Some(predicate_data),
| ^^^^^^^^^^^^^^^^^^^^ expected `UnresolvedBytes`, found `Option<Vec<u8>>`
|
= note: expected struct `UnresolvedBytes`
found enum `Option<Vec<u8>>`
note: associated function defined here
--> /Users/alexey/.cargo/registry/src/github.com-1ecc6299db9ec823/fuels-signers-0.37.1/src/wallet.rs:552:18
|
552 | pub async fn spend_predicate(
| ^^^^^^^^^^^^^^^
Some errors have detailed explanations: E0061, E0308.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `predicates-test` due to 3 previous errors
* The terminal process "cargo 'test', '--package', 'predicates-test', '--test', 'integration_tests', '--', 'just_test', '--exact', '--nocapture'" terminated with exit code: 101.
* Terminal will be reused by tasks, press any key to close it.
Thanks
Also in the example, we have a lot of signs like “?” but my compiler doesn’t like that too much. How to allow to use of “?” characters?
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:33:75
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
33 | let predicate = Predicate::load_from( "out/debug/predicates-test.bin")?;
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::types::errors::Error>>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:46:15
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
46 | .await?;
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::types::errors::Error>>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:50:24
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
50 | .get_provider()?
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::signers::wallet::WalletError>>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:52:15
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
52 | .await?;
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::signers::provider::ProviderError>>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:59:64
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
59 | let predicate_data: Vec<u8> = predicate.encode_data(42_u64)?;
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<_>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:73:15
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
73 | .await?;
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::types::errors::Error>>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:77:24
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
77 | .get_provider()?
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::signers::wallet::WalletError>>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:79:15
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
79 | .await?;
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::signers::provider::ProviderError>>` is not implemented for `()`
error[E0277]: the `?` operator can only be used in an async block that returns `Result` or `Option` (or another type that implements `FromResidual`)
--> tests/harness.rs:84:77
|
11 | #[tokio::test]
| -------------- this function should return `Result` or `Option` to accept `?`
...
84 | let balance = second_wallet.get_asset_balance(&AssetId::default()).await?;
| ^ cannot use the `?` operator in an async block that returns `()`
|
= help: the trait `FromResidual<Result<Infallible, fuels::types::errors::Error>>` is not implemented for `()`
Some errors have detailed explanations: E0061, E0277, E0308.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `predicates-test` due to 12 previous errors
The ? operator in Rust can only be used in a function which returns a Result type.
You can either change your test function signature to return a result, or replace usage of ? with .unwrap();
After this fixed code became valid, there is no warnings or errors but when I’m running the code I have this error
running 1 test
thread 'just_test' panicked at 'called `Result::unwrap()` on an `Err` value: ProviderError("Response errors; Invalid transaction: The transaction contains a predicate which failed to validate: TransactionId(0xbb4b81fe6e74a6823fbd0d0a239a0890f99ff177a8baacb3a69c68dac986e277)")', tests/harness.rs:55:10
I have tried to change encode_data(4096, 4096) to encode_data(4096_u32, 4096_u64) but result is the same
^^/p/f/predicates-test >>> cargo test (master+4) 16:07:49
Finished test [unoptimized + debuginfo] target(s) in 0.35s
Running tests/harness.rs (target/debug/deps/integration_tests-235965a24c31f178)
running 1 test
test just_test ... FAILED
failures:
---- just_test stdout ----
thread 'just_test' panicked at 'called `Result::unwrap()` on an `Err` value: ProviderError("Response errors; Invalid transaction: The transaction contains a predicate which failed to validate: TransactionId(0xe078c783fed0be84cdc178493e707051d1134a07919613e0a61a3e16057f32d0)")', tests/harness.rs:55:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
just_test
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.21s
error: test failed, to rerun pass `--test integration_tests`