AssetId generation mismatch?

Continuing the discussion from Trait "Hash" is not implemented for type "AssetId" error:

I have

pub fn get_default_asset_id(contract_id: ContractId) -> AssetId {
    sha256((contract_id, ZERO_B256))

Yet, gives me the error that I am not sending the right token in regression tests

fn require_valid_asset() {
    require(msg_asset_id() == get_default_asset_id(, "Invalid asset being transfered");

Despite using

mint_to(address, ZERO_B256, amount);

when minting

I should also mention the tokens are infact being minted properly which i checked using:

let asset_id = asset

Should I just pass the AssetId as well as the ContractId to the contract when initializing it, or is there something going wrong here?

At a first glance, I don’t see anything wrong. Could you provide the full code or a minimal reproduction to debug?

David’s right! The full code will be very helpful!
Remember to add the output of “fuelup show” so we can have more information on your environment.


Interesting, I was not able to recreate it in a new project, must be passing in some variable improperly somewhere, very strange.

1 Like

I am seeing the hash:


which if you look it up this is the 0 length hash, so something much stranger is happening on the sha function on my working repo vs the dummy one I made trying to recreate the issue

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