From 60d1169d8afc7cdad84f509d1ce4c03eac09558a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CTeddyNotBear=E2=80=9D?= Date: Mon, 11 Mar 2024 17:21:56 +0100 Subject: [PATCH 1/3] chore: upgrade contracts to cairo v2.6.0, snfoundry 0.19.0 --- .tool-versions | 4 ++-- Scarb.lock | 4 ++-- Scarb.toml | 4 ++-- tests/test_account.cairo | 16 ++++++++-------- tests/test_registry.cairo | 10 +++++----- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.tool-versions b/.tool-versions index 90faff4..b5cb918 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -scarb 2.5.4 -starknet-foundry 0.18.0 \ No newline at end of file +scarb 2.6.0 +starknet-foundry 0.19.0 \ No newline at end of file diff --git a/Scarb.lock b/Scarb.lock index 7e0ba75..09d8c2d 100644 --- a/Scarb.lock +++ b/Scarb.lock @@ -3,8 +3,8 @@ version = 1 [[package]] name = "snforge_std" -version = "0.18.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.18.0#48f909a56b08cbdc5ca6a21a836b0fbc6c36d55b" +version = "0.19.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.19.0#a3391dce5bdda51c63237032e6cfc64fb7a346d4" [[package]] name = "token_bound_accounts" diff --git a/Scarb.toml b/Scarb.toml index cc74406..9967a65 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -9,8 +9,8 @@ sierra = true casm = true [dependencies] -starknet = "2.5.4" -snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.18.0" } +starknet = "2.6.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.19.0" } [tool.snforge] # exit_first = true \ No newline at end of file diff --git a/tests/test_account.cairo b/tests/test_account.cairo index 5fbd73e..ca28603 100644 --- a/tests/test_account.cairo +++ b/tests/test_account.cairo @@ -56,7 +56,7 @@ fn SIGNED_TX_DATA() -> SignedTransactionData { fn __setup__() -> (ContractAddress, ContractAddress) { // deploy erc721 helper contract - let erc721_contract = declare('ERC721'); + let erc721_contract = declare("ERC721"); let mut erc721_constructor_calldata = array!['tokenbound', 'TBA']; let erc721_contract_address = erc721_contract.deploy(@erc721_constructor_calldata).unwrap(); @@ -66,7 +66,7 @@ fn __setup__() -> (ContractAddress, ContractAddress) { dispatcher.mint(recipient, u256_from_felt252(1)); // deploy account contract - let account_contract = declare('Account'); + let account_contract = declare("Account"); let mut acct_constructor_calldata = array![ contract_address_to_felt252(erc721_contract_address), 1, 0 ]; @@ -114,7 +114,7 @@ fn test_execute() { let dispatcher = IAccountDispatcher { contract_address }; // deploy `HelloStarknet` contract for testing - let test_contract = declare('HelloStarknet'); + let test_contract = declare("HelloStarknet"); let test_address = test_contract.deploy(@array![]).unwrap(); // craft calldata for call array @@ -150,7 +150,7 @@ fn test_execute_multicall() { let dispatcher = IAccountDispatcher { contract_address }; // deploy `HelloStarknet` contract for testing - let test_contract = declare('HelloStarknet'); + let test_contract = declare("HelloStarknet"); let test_address = test_contract.deploy(@array![]).unwrap(); // craft calldata and create call array @@ -211,7 +211,7 @@ fn test_owner() { fn test_upgrade() { let (contract_address, erc721_contract_address) = __setup__(); - let new_class_hash = declare('UpgradedAccount').class_hash; + let new_class_hash = declare("UpgradedAccount").class_hash; // get token owner let token_dispatcher = IERC721Dispatcher { contract_address: erc721_contract_address }; @@ -234,7 +234,7 @@ fn test_upgrade() { fn test_upgrade_with_unauthorized() { let (contract_address, _) = __setup__(); - let new_class_hash = declare('UpgradedAccount').class_hash; + let new_class_hash = declare("UpgradedAccount").class_hash; // call upgrade function with an unauthorized address start_prank(CheatTarget::One(contract_address), ACCOUNT2.try_into().unwrap()); @@ -286,7 +286,7 @@ fn test_should_not_execute_when_locked() { stop_warp(CheatTarget::One(contract_address)); // deploy `HelloStarknet` contract for testing purposes - let test_contract = declare('HelloStarknet'); + let test_contract = declare("HelloStarknet"); let test_address = test_contract.deploy(@array![]).unwrap(); // confirm call to execute fails @@ -326,7 +326,7 @@ fn test_should_not_upgrade_when_locked() { dispatcher.lock(lock_duration); stop_warp(CheatTarget::One(contract_address)); - let new_class_hash = declare('UpgradedAccount').class_hash; + let new_class_hash = declare("UpgradedAccount").class_hash; // call the upgrade function let dispatcher_upgradable = IUpgradeableDispatcher { contract_address }; diff --git a/tests/test_registry.cairo b/tests/test_registry.cairo index 5be4e3c..17c579f 100644 --- a/tests/test_registry.cairo +++ b/tests/test_registry.cairo @@ -25,7 +25,7 @@ const ACCOUNT: felt252 = 1234; fn __setup__() -> (ContractAddress, ContractAddress) { // deploy erc721 helper contract - let erc721_contract = declare('ERC721'); + let erc721_contract = declare("ERC721"); let mut erc721_constructor_calldata = array!['tokenbound', 'TBA']; let erc721_contract_address = erc721_contract.deploy(@erc721_constructor_calldata).unwrap(); @@ -35,7 +35,7 @@ fn __setup__() -> (ContractAddress, ContractAddress) { dispatcher.mint(recipient, u256_from_felt252(1)); // deploy registry contract - let registry_contract = declare('Registry'); + let registry_contract = declare("Registry"); let registry_contract_address = registry_contract.deploy(@array![]).unwrap(); (registry_contract_address, erc721_contract_address) @@ -52,7 +52,7 @@ fn test_create_account() { start_prank(CheatTarget::One(registry_contract_address), token_owner); // create account - let acct_class_hash = declare('Account').class_hash; + let acct_class_hash = declare("Account").class_hash; let account_address = registry_dispatcher .create_account( class_hash_to_felt252(acct_class_hash), @@ -82,7 +82,7 @@ fn test_getting_total_deployed_accounts() { let token_owner = token_dispatcher.ownerOf(u256_from_felt252(1)); start_prank(CheatTarget::One(registry_contract_address), token_owner); - let acct_class_hash = declare('Account').class_hash; + let acct_class_hash = declare("Account").class_hash; // create multiple accounts for same NFT registry_dispatcher .create_account( @@ -123,7 +123,7 @@ fn test_get_account() { start_prank(CheatTarget::One(registry_contract_address), token_owner); // deploy account - let acct_class_hash = declare('Account').class_hash; + let acct_class_hash = declare("Account").class_hash; let account_address = registry_dispatcher .create_account( class_hash_to_felt252(acct_class_hash), From e8cd4af0fcfdaf0d236232e73018002156b5b93d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CTeddyNotBear=E2=80=9D?= Date: Mon, 11 Mar 2024 22:57:39 +0100 Subject: [PATCH 2/3] chore: update starknet foundry in github action --- .github/workflows/test_contracts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_contracts.yml b/.github/workflows/test_contracts.yml index 3ea7b99..a8f7d60 100644 --- a/.github/workflows/test_contracts.yml +++ b/.github/workflows/test_contracts.yml @@ -11,6 +11,6 @@ jobs: - uses: software-mansion/setup-scarb@v1 - uses: foundry-rs/setup-snfoundry@v2 with: - starknet-foundry-version: 0.14.0 + starknet-foundry-version: 0.19.0 - name: Run cairo tests run: snforge test \ No newline at end of file From 07f158208b0e7190de7c6a801c1fd47d480830e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CTeddyNotBear=E2=80=9D?= Date: Mon, 11 Mar 2024 23:00:57 +0100 Subject: [PATCH 3/3] chore: upgrade foundry-rs version --- .github/workflows/test_contracts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_contracts.yml b/.github/workflows/test_contracts.yml index a8f7d60..7559459 100644 --- a/.github/workflows/test_contracts.yml +++ b/.github/workflows/test_contracts.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: software-mansion/setup-scarb@v1 - - uses: foundry-rs/setup-snfoundry@v2 + - uses: foundry-rs/setup-snfoundry@v3 with: starknet-foundry-version: 0.19.0 - name: Run cairo tests