"failed transfer to address." during std::token::mint_to_address call

Hi there, I’m implementing a token standard but have a problem with mint_to_address

something strange is happening, while I was trying to run spark on beta-3, I installed the latest toolchain and now the mint token in the test that worked before does not work for me. The same error in my last token standard which has not changed since December. I just made an example of an issue with a new token standard to make it easier to perceive

I have admin’s mint function in my standard:

And have a simple test:

But when I run this test I have this error

running 1 test
thread 'main_test' panicked at 'called `Result::unwrap()` on an `Err` value: RevertTransactionError { reason: "failed transfer to address.", revert_id: 18446744073709486081, receipts: [Call { id: 0000000000000000000000000000000000000000000000000000000000000000, to: 01ea616f10ecb5cb7c8b3a7fa5ae8190b2fd9d0f412f4eb5af2343d7e1051c32, amount: 0, asset_id: 0000000000000000000000000000000000000000000000000000000000000000, gas: 1000000, param1: 1075379907, param2: 10472, pc: 11672, is: 11672 }, Revert { id: 01ea616f10ecb5cb7c8b3a7fa5ae8190b2fd9d0f412f4eb5af2343d7e1051c32, ra: 18446744073709486081, pc: 13768, is: 11672 }, ScriptResult { result: Revert, gas_used: 1053 }] }', tests/harness.rs:38:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
   1: core::panicking::panic_fmt
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
   2: core::result::unwrap_failed
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1687:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1089:23
   4: tests::main_test::{{closure}}
             at ./tests/harness.rs:33:5
   5: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9
   6: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9
   7: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:541:57
   8: tokio::runtime::coop::with_budget
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/coop.rs:107:5
   9: tokio::runtime::coop::budget
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/coop.rs:73:5
  10: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:541:25
  11: tokio::runtime::scheduler::current_thread::Context::enter
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:350:19
  12: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:540:36
  13: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:615:57
  14: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/macros/scoped_tls.rs:61:9
  15: tokio::runtime::scheduler::current_thread::CoreGuard::enter
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:615:27
  16: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:530:19
  17: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/scheduler/current_thread.rs:154:24
  18: tokio::runtime::runtime::Runtime::block_on
             at /Users/alexey/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.28.2/src/runtime/runtime.rs:302:47
  19: tests::main_test
             at ./tests/harness.rs:33:5
  20: tests::main_test::{{closure}}
             at ./tests/harness.rs:11:22
  21: core::ops::function::FnOnce::call_once
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5
  22: core::ops::function::FnOnce::call_once
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test main_test ... FAILED

failures:

failures:
    main_test

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.53s

error: test failed, to rerun pass `-p tests --test tests`

 *  The terminal process "cargo 'test', '--package', 'tests', '--test', 'tests', '--', 'main_test', '--exact', '--nocapture'" terminated with exit code: 101. 
 *  Terminal will be reused by tasks, press any key to close it. 

My toolchain:

>>> fuelup show                                   (*master+1) 17:09:35 
Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
--------------------
beta-3-aarch64-apple-darwin
latest-aarch64-apple-darwin (default)
forc-0.39-toolchain
my-custom-toolchain

active toolchain
-----------------
latest-aarch64-apple-darwin (default)
  forc : 0.40.1
    - forc-client
      - forc-deploy : 0.40.1
      - forc-run : 0.40.1
    - forc-doc : 0.40.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.40.1
    - forc-index : 0.16.2
    - forc-lsp : 0.40.1
    - forc-tx : 0.40.1
    - forc-wallet : 0.2.2
  fuel-core : 0.18.3
  fuel-indexer : 0.16.2

fuels versions
---------------
forc : 0.42

P.S.
I have removed “out” and “target” dirs and rebuilt them, Result is the same

P.P.S.
The same stuff with the beta-3 toolchain

Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
--------------------
beta-2-aarch64-apple-darwin
beta-3-aarch64-apple-darwin (default)
latest-aarch64-apple-darwin
forc-0.39-toolchain
my-custom-toolchain

active toolchain
-----------------
beta-3-aarch64-apple-darwin (default)
  forc : 0.37.3
    - forc-client
      - forc-deploy : 0.37.3
      - forc-run : 0.37.3
    - forc-doc : 0.37.3
    - forc-explore : 0.28.1
    - forc-fmt : 0.37.3
    - forc-index : 0.15.0
    - forc-lsp : 0.37.3
    - forc-tx : 0.37.3
    - forc-wallet : 0.2.2
  fuel-core : 0.17.11
  fuel-indexer : 0.15.0

fuels versions
---------------
forc : 0.39

and with beta-2

Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
--------------------
beta-2-aarch64-apple-darwin (default)
beta-3-aarch64-apple-darwin
latest-aarch64-apple-darwin
forc-0.39-toolchain
my-custom-toolchain

active toolchain
-----------------
beta-2-aarch64-apple-darwin (default)
  forc : 0.31.1
    - forc-client
      - forc-deploy : 0.31.1
      - forc-run : 0.31.1
    - forc-doc : 0.31.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.31.1
    - forc-index : 0.1.13
    - forc-lsp : 0.31.1
    - forc-tx - not found
    - forc-wallet : 0.1.2
  fuel-core : 0.15.3
  fuel-indexer : 0.1.13

fuels versions
---------------
forc : 0.31
forc-wallet : 0.24.0

P.P.P.S.
Just installed all the toolchains and rust on a virgin laptop of my friend, the result is the same -_-

1 Like

Hey, I was able to get the tests to pass by adding append_variable_outputs(1) to the contract call.

    contract_instance
        .methods()
        ._mint(100, alice.address().into())
        .append_variable_outputs(1)
        .call()
        .await
        .unwrap();

Let me know if that solves the problem!

1 Like

Exactly, that’s how it works… Sorry guys, that was super dumb of me.

No worries, I’ve run into the same thing before

IMO we need a better error message to hint at this

agree, thanks a lot for your help :heart:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.