Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump starknet foundry to 0.30.0 #1137

Merged
merged 20 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ dependencies = [
"snforge_std",
]

[[package]]
name = "snforge_scarb_plugin"
version = "0.1.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.30.0#196f06b251926697c3d66800f2a93ae595e76496"

[[package]]
name = "snforge_std"
version = "0.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"
version = "0.30.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.30.0#196f06b251926697c3d66800f2a93ae595e76496"
dependencies = [
"snforge_scarb_plugin",
]
6 changes: 4 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ version.workspace = true
version = "0.16.0"
edition = "2023_11"
cairo-version = "2.8.0"
scarb-version = "2.8.0"
scarb-version = "2.8.1"
authors = ["OpenZeppelin Community <[email protected]>"]
description = "OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup"
documentation = "https://docs.openzeppelin.com/contracts-cairo"
Expand All @@ -39,8 +39,9 @@ keywords = [
]

[workspace.dependencies]
assert_macros = "2.8.0"
starknet = "2.8.0"
ggonzalez94 marked this conversation as resolved.
Show resolved Hide resolved
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.30.0" }
andrew-fleming marked this conversation as resolved.
Show resolved Hide resolved

[dependencies]
starknet.workspace = true
Expand All @@ -56,6 +57,7 @@ openzeppelin_upgrades = { path = "packages/upgrades" }
openzeppelin_utils = { path = "packages/utils" }

[dev-dependencies]
assert_macros.workspace = true
snforge_std.workspace = true
openzeppelin_test_common = { path = "packages/test_common" }
openzeppelin_testing = { path = "packages/testing" }
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/api/testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ following the Starknet Foundry emitted error format.
[[testing-common-IntoBase16StringTrait]]
==== `[.contract-item-name]#++IntoBase16StringTrait++#` [.item-kind]#trait#

A helper trait that enables a value to be represented as a `base16` string padded to 66 characters
(including the `0x` prefix). The type of the value must implement `Into<T, felt252>` to be
A helper trait that enables a value to be represented as a `base16`(hexadecimal) string padded to 66 characters
(including the `0x` prefix). There's also a version with no padding for compatibility with Starknet Foundry `0.28.0` and above, where addresses and selectors are not padded properly. The type of the value must implement `Into<T, felt252>` to be
ggonzalez94 marked this conversation as resolved.
Show resolved Hide resolved
convertible to `felt252`.

Usage example:
Expand Down
1 change: 1 addition & 0 deletions packages/access/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ openzeppelin_introspection = { path = "../introspection" }
openzeppelin_utils = { path = "../utils" }

[dev-dependencies]
assert_macros.workspace = true
snforge_std.workspace = true
openzeppelin_testing = { path = "../testing" }
openzeppelin_test_common = { path = "../test_common" }
Expand Down
22 changes: 11 additions & 11 deletions packages/access/src/tests/test_dual_accesscontrol.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn test_dual_no_supports_interface() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
ggonzalez94 marked this conversation as resolved.
Show resolved Hide resolved
fn test_dual_supports_interface_exists_and_panics() {
let (snake_dispatcher, _) = setup_accesscontrol_panic();
snake_dispatcher.supports_interface(IACCESSCONTROL_ID);
Expand All @@ -90,7 +90,7 @@ fn test_dual_no_has_role() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_has_role_exists_and_panics() {
let (dispatcher, _) = setup_accesscontrol_panic();
dispatcher.has_role(DEFAULT_ADMIN_ROLE, ADMIN());
Expand All @@ -112,7 +112,7 @@ fn test_dual_no_get_role_admin() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_get_role_admin_exists_and_panics() {
let (snake_dispatcher, _) = setup_accesscontrol_panic();
snake_dispatcher.get_role_admin(ROLE);
Expand All @@ -137,7 +137,7 @@ fn test_dual_no_grant_role() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_grant_role_exists_and_panics() {
let (snake_dispatcher, _) = setup_accesscontrol_panic();
snake_dispatcher.grant_role(ROLE, AUTHORIZED());
Expand All @@ -162,7 +162,7 @@ fn test_dual_no_revoke_role() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_revoke_role_exists_and_panics() {
let (snake_dispatcher, _) = setup_accesscontrol_panic();
snake_dispatcher.revoke_role(ROLE, AUTHORIZED());
Expand All @@ -187,7 +187,7 @@ fn test_dual_no_renounce_role() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_renounce_role_exists_and_panics() {
let (snake_dispatcher, _) = setup_accesscontrol_panic();
snake_dispatcher.renounce_role(DEFAULT_ADMIN_ROLE, ADMIN());
Expand All @@ -208,7 +208,7 @@ fn test_dual_hasRole() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_hasRole_exists_and_panics() {
let (_, camel_dispatcher) = setup_accesscontrol_panic();
camel_dispatcher.has_role(DEFAULT_ADMIN_ROLE, ADMIN());
Expand All @@ -225,7 +225,7 @@ fn test_dual_getRoleAdmin() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_getRoleAdmin_exists_and_panics() {
let (_, camel_dispatcher) = setup_accesscontrol_panic();
camel_dispatcher.get_role_admin(ROLE);
Expand All @@ -244,7 +244,7 @@ fn test_dual_grantRole() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_grantRole_exists_and_panics() {
let (_, camel_dispatcher) = setup_accesscontrol_panic();
camel_dispatcher.grant_role(ROLE, AUTHORIZED());
Expand All @@ -264,7 +264,7 @@ fn test_dual_revokeRole() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_revokeRole_exists_and_panics() {
let (_, camel_dispatcher) = setup_accesscontrol_panic();
camel_dispatcher.revoke_role(ROLE, AUTHORIZED());
Expand All @@ -283,7 +283,7 @@ fn test_dual_renounceRole() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_renounceRole_exists_and_panics() {
let (_, camel_dispatcher) = setup_accesscontrol_panic();
camel_dispatcher.renounce_role(DEFAULT_ADMIN_ROLE, ADMIN());
Expand Down
10 changes: 5 additions & 5 deletions packages/access/src/tests/test_dual_ownable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn test_dual_no_owner() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_owner_exists_and_panics() {
let (dispatcher, _) = setup_ownable_panic();
dispatcher.owner();
Expand Down Expand Up @@ -98,7 +98,7 @@ fn test_dual_no_transfer_ownership() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_transfer_ownership_exists_and_panics() {
let (dispatcher, _) = setup_ownable_panic();
dispatcher.transfer_ownership(NEW_OWNER());
Expand All @@ -123,7 +123,7 @@ fn test_dual_no_renounce_ownership() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_renounce_ownership_exists_and_panics() {
let (dispatcher, _) = setup_ownable_panic();
dispatcher.renounce_ownership();
Expand All @@ -146,7 +146,7 @@ fn test_dual_transferOwnership() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_transferOwnership_exists_and_panics() {
let (_, camel_dispatcher) = setup_ownable_panic();
camel_dispatcher.transfer_ownership(NEW_OWNER());
Expand All @@ -165,7 +165,7 @@ fn test_dual_renounceOwnership() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_renounceOwnership_exists_and_panics() {
let (_, camel_dispatcher) = setup_ownable_panic();
camel_dispatcher.renounce_ownership();
Expand Down
1 change: 1 addition & 0 deletions packages/account/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ openzeppelin_introspection = { path = "../introspection" }
openzeppelin_utils = { path = "../utils" }

[dev-dependencies]
assert_macros.workspace = true
snforge_std.workspace = true
openzeppelin_testing = { path = "../testing" }
openzeppelin_test_common = { path = "../test_common" }
Expand Down
6 changes: 3 additions & 3 deletions packages/account/src/tests/test_account.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use core::num::traits::Zero;
use core::starknet::SyscallResultTrait;
use crate::AccountComponent::{InternalTrait, SRC6CamelOnlyImpl};
use crate::AccountComponent::{PublicKeyCamelImpl, PublicKeyImpl};
use crate::AccountComponent;
Expand All @@ -20,7 +19,7 @@ use snforge_std::{
start_cheat_signature_global, start_cheat_transaction_version_global,
start_cheat_transaction_hash_global
};
use snforge_std::{spy_events, declare, test_address, start_cheat_caller_address};
use snforge_std::{spy_events, test_address, start_cheat_caller_address};
use starknet::account::Call;

//
Expand All @@ -46,7 +45,8 @@ fn setup(key_pair: StarkKeyPair) -> ComponentState {
fn setup_dispatcher(
key_pair: StarkKeyPair, data: SignedTransactionData
) -> (AccountABIDispatcher, felt252) {
let contract_class = declare("DualCaseAccountMock").unwrap_syscall();
let contract_class = utils::declare_class("DualCaseAccountMock");

let calldata = array![key_pair.public_key];
let address = utils::deploy(contract_class, calldata);
let dispatcher = AccountABIDispatcher { contract_address: address };
Expand Down
14 changes: 7 additions & 7 deletions packages/account/src/tests/test_dual_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn test_dual_no_set_public_key() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_set_public_key_exists_and_panics() {
let (snake_dispatcher, _) = setup_account_panic();
let new_public_key = KEY_PAIR_2().public_key;
Expand All @@ -93,7 +93,7 @@ fn test_dual_no_get_public_key() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_get_public_key_exists_and_panics() {
let (snake_dispatcher, _) = setup_account_panic();
snake_dispatcher.get_public_key();
Expand Down Expand Up @@ -121,7 +121,7 @@ fn test_dual_no_is_valid_signature() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_is_valid_signature_exists_and_panics() {
let signature = array![];
let (snake_dispatcher, _) = setup_account_panic();
Expand All @@ -145,7 +145,7 @@ fn test_dual_no_supports_interface() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_supports_interface_exists_and_panics() {
let (snake_dispatcher, _) = setup_account_panic();
snake_dispatcher.supports_interface(ISRC5_ID);
Expand Down Expand Up @@ -173,7 +173,7 @@ fn test_dual_setPublicKey() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_setPublicKey_exists_and_panics() {
let (_, camel_dispatcher) = setup_account_panic();
let new_public_key = KEY_PAIR_2().public_key;
Expand All @@ -191,7 +191,7 @@ fn test_dual_getPublicKey() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_getPublicKey_exists_and_panics() {
let (_, camel_dispatcher) = setup_account_panic();
camel_dispatcher.get_public_key();
Expand All @@ -211,7 +211,7 @@ fn test_dual_isValidSignature() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_isValidSignature_exists_and_panics() {
let signature = array![];

Expand Down
14 changes: 7 additions & 7 deletions packages/account/src/tests/test_dual_eth_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn test_dual_no_set_public_key() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_set_public_key_exists_and_panics() {
let (dispatcher, _) = setup_account_panic();
dispatcher.set_public_key(KEY_PAIR().public_key, array![].span());
Expand All @@ -97,7 +97,7 @@ fn test_dual_no_get_public_key() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_get_public_key_exists_and_panics() {
let (dispatcher, _) = setup_account_panic();
dispatcher.get_public_key();
Expand All @@ -124,7 +124,7 @@ fn test_dual_no_is_valid_signature() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_is_valid_signature_exists_and_panics() {
let signature = array![];

Expand All @@ -147,7 +147,7 @@ fn test_dual_no_supports_interface() {
}

#[test]
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_supports_interface_exists_and_panics() {
let (dispatcher, _) = setup_account_panic();
dispatcher.supports_interface(ISRC5_ID);
Expand Down Expand Up @@ -176,7 +176,7 @@ fn test_dual_setPublicKey() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_setPublicKey_exists_and_panics() {
let (_, dispatcher) = setup_account_panic();
dispatcher.set_public_key(KEY_PAIR_2().public_key, array![].span());
Expand All @@ -192,7 +192,7 @@ fn test_dual_getPublicKey() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_getPublicKey_exists_and_panics() {
let (_, dispatcher) = setup_account_panic();
dispatcher.get_public_key();
Expand All @@ -211,7 +211,7 @@ fn test_dual_isValidSignature() {

#[test]
#[ignore] // REASON: foundry entrypoint_not_found error message inconsistent with mainnet.
#[should_panic(expected: ("Some error",))]
#[should_panic(expected: "Some error")]
fn test_dual_isValidSignature_exists_and_panics() {
let signature = array![];

Expand Down
1 change: 1 addition & 0 deletions packages/governance/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ openzeppelin_access = { path = "../access" }
openzeppelin_introspection = { path = "../introspection" }

[dev-dependencies]
assert_macros.workspace = true
snforge_std.workspace = true
openzeppelin_testing = { path = "../testing" }

Expand Down
1 change: 1 addition & 0 deletions packages/introspection/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fmt.workspace = true
starknet.workspace = true

[dev-dependencies]
assert_macros.workspace = true
snforge_std.workspace = true

[lib]
Expand Down
1 change: 1 addition & 0 deletions packages/merkle_tree/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ keywords.workspace = true
fmt.workspace = true

[dev-dependencies]
assert_macros.workspace = true
starknet.workspace = true
snforge_std.workspace = true
Loading