Beta-5 upgrading error

When building the smart contracts for 2 of 11 contracts I am receiving this error:

Both contracts are SRC20 implementations hmm

error: Internal compiler error: Verification failed: Struct field type mismatch.
Please file an issue on the repository and include the code that triggered this error.

Also the compiler does is not yelling at me

fuelup show:
beta-5-aarch64-apple-darwin (override) (default)
forc : 0.49.1
- forc-client
- forc-deploy : 0.49.1
- forc-run : 0.49.1
- forc-crypto : 0.49.1
- forc-doc : 0.49.1
- forc-explore : 0.28.1
- forc-fmt : 0.49.1
- forc-lsp : 0.49.1
- forc-tx : 0.49.1
- forc-wallet : 0.4.2
fuel-core : 0.22.0
fuel-core-keygen : 0.22.0

fuels versions

forc : 0.54.0
forc-wallet : 0.54.0

2 Likes

Hey @diyahir, it’s great to hear from you again! Do you have a working branch or a codebase that I can use to replicate the issue on my own machine?

The code is not public yet

I understand @diyahir no problem! Let me inquire with the team and see if they’re aware of this. :+1:

The standard just outlines the ABI; therefore, without access to your specific implementation, we’re left in the dark about the details. Could you kindly create a private repository and invite me to it?

Here is my GitHub handle: calldelegation (Call Delegation) · GitHub

I truly appreciate you reporting this. Thank you! :slight_smile:

I identified the issue:

    #[storage(read)]
    fn decimals(asset: AssetId) -> Option<u8> {
        // if asset == storage.default_asset.read() {
        //     return Some(9);
        // }
        return None;
    }

If I uncomment this, it fails to compile looks like the 9 to u8 type cast is malfunctioning here

I’ve tried to reproduce this with the following contract, but it works fine.

contract;

storage {
    default_asset: AssetId = AssetId { value: b256::min() },
}

abi MyAbi {
#[storage(read)]
    fn decimals(asset: AssetId) -> Option<u8>;
}

impl MyAbi for Contract {
    #[storage(read)]
    fn decimals(asset: AssetId) -> Option<u8> {
        if asset == storage.default_asset.read() {
            return Some(9);
        }
        return None;
    }
}

Are you sure this is coming from the cast, if you replace 9 with 9u8 does it behave differently?
Could you provide your storage definition?

default_asset: AssetId = AssetId::from(ZERO_B256),

I can confirm that:

return Some(9u8);

compiles fine

1 Like