Getting `to many arguments` error while compiling contract

  • Fuel up show outuput
Default host: aarch64-apple-darwin
fuelup home: /Users/divy/.fuelup

Installed toolchains
--------------------
latest-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin (override)
testnet-aarch64-apple-darwin

active toolchain
----------------
nightly-aarch64-apple-darwin (override), path: /Users/divy/Developer/lync/Fuel-Contracts/nft_marketplace/fuel-toolchain.toml
  forc : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-client
      - forc-deploy : 0.63.6+nightly.20240923.1d50da1a4b
      - forc-run : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-crypto : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-debug : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-doc : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-fmt : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-lsp : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-tx : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-wallet : 0.9.0+nightly.20240923.5c30466f2b
  fuel-core : 0.36.0+nightly.20240923.ca6a705bc2
  fuel-core-keygen : 0.35.0+nightly.20240909.a952ff44e0

  • the read function which returns the Vector of Buyer struct is giving error
pub struct Buyer {
    pub buyer: Identity,
    pub quantity_bought: u64,
    pub buy_price_per_item: u64,
}

buyers: StorageMap<u64, StorageVec<Buyer>> = StorageMap {},
#[storage(read)]
    fn get_buyers(listing_id: u64) -> Vec<Buyer> {
        let mut buyers = Vec::new();

        if let storage_vec_key = storage.buyers.get(listing_id) {
            let len = storage_vec_key.len();
            let mut i = 0;
            while i < len {
                if let Some(storage_key) = storage_vec_key.get(i) {
                    buyers.push(storage_key.read());
                }
                i += 1;
            }
        }

        buyers
    }
  • The Error I am getting
thread 'main' panicked at sway-core/src/asm_generation/fuel/functions.rs:121:30:
Too many arguments, cannot handle.: Immediate12TooLarge { val: 4467, span: Span { src (ptr): 0x11e009b90, source_id: None, start: 0, end: 0, as_str(): "" } }

Could you please provide an estimated timeline for when this issue will be resolved?

Hey @DevilAsap, can you please update the toolchain to the latest and see if the issue still persists? please make sure the forc version is 0.64.0 and fuel-core 0.36.0

  • fuelup show output
Default host: aarch64-apple-darwin
fuelup home: /Users/divy/.fuelup

Installed toolchains
--------------------
latest-aarch64-apple-darwin
nightly-aarch64-apple-darwin (default) (override)
testnet-aarch64-apple-darwin

active toolchain
----------------
nightly-aarch64-apple-darwin (override) (default), path: /Users/divy/Developer/lync/Fuel-Contracts/nft_marketplace/fuel-toolchain.toml
  forc : 0.64.0+nightly.20240930.6ba98da794
    - forc-client
      - forc-deploy : 0.64.0+nightly.20240930.6ba98da794
      - forc-run : 0.64.0+nightly.20240930.6ba98da794
    - forc-crypto : 0.64.0+nightly.20240930.6ba98da794
    - forc-debug : 0.64.0+nightly.20240930.6ba98da794
    - forc-doc : 0.64.0+nightly.20240930.6ba98da794
    - forc-fmt : 0.64.0+nightly.20240930.6ba98da794
    - forc-lsp : 0.64.0+nightly.20240930.6ba98da794
    - forc-tx : 0.64.0+nightly.20240930.6ba98da794
    - forc-wallet : 0.9.1+nightly.20240930.c49415c671
  fuel-core : 0.36.0+nightly.20240930.4a55b7de69
  fuel-core-keygen : 0.35.0+nightly.20240909.a952ff44e0

  • This issue is still there
thread 'main' panicked at sway-core/src/asm_generation/fuel/functions.rs:121:30:
Too many arguments, cannot handle.: Immediate12TooLarge { val: 4920, span: Span { src (ptr): 0x158613c40, source_id: None, start: 0, end: 0, as_str(): "" } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Hey @DevilAsap Thanks for confirming. will make sure the team looks into it. Also, just for reference can you have a look at here and try the solution mentioned in there

Also, can you please provide me a GitHub repo or gist for the entire codebase?

@DevilAsap can you please provide codebase to reproduce the error?
@xpluscal would be great to have a look at your codebase in the meanwhile

@Nazeeh21

mine is fixed , i changed listing id to u256 for the whole contract , and it fixed that error

2 Likes

Interesting.

Our issue I think stems from the following contract change. We’re basically just trying to be able to return a Configurable Constant as we could not find any definition if that is possible or not. @Nazeeh21 could you enlighten me?

Basically this is the change:

#[storage(read)]
    fn max_supply() -> Option<u64> {
        Some(MAX_SUPPLY)
    }

Max supply itself is defined like so:

MAX_SUPPLY: u64 = 3,