Hi there!
I’ve tried to replicate using the following code and toolchain
contract;
use std::{
storage::storage_map::StorageMap,
constants::ZERO_B256,
hash::Hash
};
storage {
owners: StorageMap<Identity, ()> = StorageMap {}
}
abi MyContract {
#[storage(read, write)]
fn my_fn();
}
impl MyContract for Contract {
#[storage(read, write)]
fn my_fn() {
let owner = Identity::Address(Address::from(ZERO_B256));
let res = storage.owners.try_insert(owner , ());
require(res.is_ok(), "DuplicatedOwner");
}
}
///
latest-x86_64-unknown-linux-gnu (default)
forc : 0.49.3
- forc-client
- forc-deploy : 0.49.3
- forc-run : 0.49.3
- forc-crypto : 0.49.3
- forc-doc : 0.49.3
- forc-explore : 0.28.1
- forc-fmt : 0.49.3
- forc-lsp : 0.49.3
- forc-tx : 0.49.3
- forc-wallet : 0.4.3
fuel-core : 0.22.4
fuel-core-keygen : 0.22.4
fuels versions
--------------
forc : 0.54.0
forc-wallet : 0.54.0
And I’m having the same error
match val {
| ^^^ Internal compiler error: Failed to get variant type from enum in `unsigned downcast`.
Please file an issue on the repository and include the code that triggered this error.
189 | Option::Some(v) => {
190 | Result::Err(StorageMapError::OccupiedError(v))
|
____
error: Internal compiler error: Unable to resolve variable 'res'.
Please file an issue on the repository and include the code that triggered this error.
____
Aborting due to 2 errors.
Error: Failed to compile contract
Please note that if you comment out the require function, the Unable to resolve variable ‘res’ dissapears.
// require(res.is_ok(), "DuplicatedOwner");
It seems like this is a compiler bug.