cairo-contracts icon indicating copy to clipboard operation
cairo-contracts copied to clipboard

snforge command error with release 0.7.0-rc.0

Open GustaveCharles opened this issue 2 years ago • 1 comments

On a new project initiated with the scarb new my_project command. When added the following dependencies: [dependencies] openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.7.0-rc.0" } snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.4.0" }

We get the following error:

` --> upgradeable.cairo:25:61 starknet::replace_class_syscall(new_class_hash).unwrap(); ^****^

error: Identifier not found. --> test_ownable.cairo:5:53 use openzeppelin::access::ownable::Ownable::_owner::InternalContractMemberStateTrait; ^******************************^

error: Method read not found on type "openzeppelin::access::ownable::ownable::Ownable::_owner::ContractState". Did you import the correct trait and impl? --> test_ownable.cairo:38:25 assert(state._owner.read().is_zero(), 'Should be zero'); ^**^

error: Method read not found on type "openzeppelin::access::ownable::ownable::Ownable::_owner::ContractState". Did you import the correct trait and impl? --> test_ownable.cairo:43:25 assert(state._owner.read() == OWNER(), 'Owner should be set'); ^**^

error: Method read not found on type "openzeppelin::access::ownable::ownable::Ownable::_owner::ContractState". Did you import the correct trait and impl? --> test_ownable.cairo:87:25 assert(state._owner.read() == OTHER(), 'Owner should be OTHER'); ^**^

error: Identifier not found. --> test_reentrancyguard.cairo:2:72 use openzeppelin::security::reentrancyguard::ReentrancyGuard::entered::InternalContractMemberStateTrait; ^******************************^

error: Method read not found on type "openzeppelin::security::reentrancyguard::ReentrancyGuard::entered::ContractState". Did you import the correct trait and impl? --> test_reentrancyguard.cairo:29:27 assert(!state.entered.read(), 'Should not be entered'); ^**^

error: Method read not found on type "openzeppelin::security::reentrancyguard::ReentrancyGuard::entered::ContractState". Did you import the correct trait and impl? --> test_reentrancyguard.cairo:31:26 assert(state.entered.read(), 'Should be entered'); ^**^

error: Method read not found on type "openzeppelin::security::reentrancyguard::ReentrancyGuard::entered::ContractState". Did you import the correct trait and impl? --> test_reentrancyguard.cairo:50:26 assert(state.entered.read(), 'Should be entered'); ^**^

error: Method read not found on type "openzeppelin::security::reentrancyguard::ReentrancyGuard::entered::ContractState". Did you import the correct trait and impl? --> test_reentrancyguard.cairo:52:27 assert(!state.entered.read(), 'Should no longer be entered'); ^**^

error: Identifier not found. --> test_erc721.cairo:1:22 use ERC721::_owners::InternalContractMemberStateTrait as OwnersTrait; ^******************************^

error: Identifier not found. --> test_erc721.cairo:2:31 use ERC721::_token_approvals::InternalContractMemberStateTrait as TokenApprovalsTrait; ^******************************^

error: Method read not found on type "openzeppelin::token::erc721::erc721::ERC721::_owners::ContractState". Did you import the correct trait and impl? --> test_erc721.cairo:194:26 assert(state._owners.read(token_id) == zero, 'Invalid owner'); ^**^

error: Method read not found on type "openzeppelin::token::erc721::erc721::ERC721::_owners::ContractState". Did you import the correct trait and impl? --> test_erc721.cairo:199:26 assert(state._owners.read(token_id) == RECIPIENT(), 'Invalid owner'); ^**^

error: Method read not found on type "openzeppelin::token::erc721::erc721::ERC721::_owners::ContractState". Did you import the correct trait and impl? --> test_erc721.cairo:204:26 assert(state._owners.read(token_id) == zero, 'Invalid owner'); ^**^

error: Method read not found on type "openzeppelin::token::erc721::erc721::ERC721::_owners::ContractState". Did you import the correct trait and impl? --> test_erc721.cairo:1332:26 assert(state._owners.read(TOKEN_ID) == ZERO(), 'Ownership after'); ^**^

error: Method read not found on type "openzeppelin::token::erc721::erc721::ERC721::_token_approvals::ContractState". Did you import the correct trait and impl? --> test_erc721.cairo:1334:35 assert(state._token_approvals.read(TOKEN_ID) == ZERO(), 'Approval after');`

GustaveCharles avatar Aug 26 '23 19:08 GustaveCharles

Sorry for the late response. I think I've seen this before and it was an snforge issue. Could you work around it? It should work fine with newer versions.

martriay avatar Dec 10 '23 18:12 martriay