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

Improve mocks #1146

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8277877
feat: add features
ericnordelo Sep 13, 2024
14b4b96
feat: remove access dual dispatchers (#1154)
ericnordelo Sep 25, 2024
485512f
feat: bump scarb
ericnordelo Sep 26, 2024
e9cd67d
feat: update CHANGELOG
ericnordelo Sep 26, 2024
762d9c9
Merge branch 'feat/bump-scarb-to-2.8.3' into feat/remove-mocks-from-r…
ericnordelo Sep 26, 2024
21b31d9
feat: add features
ericnordelo Sep 30, 2024
3ad8c7f
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into r…
ericnordelo Oct 2, 2024
b8a3ed5
feat: remove account dual dispatchers (#1168)
ericnordelo Oct 2, 2024
a4d5d77
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 2, 2024
d44754c
feat: move mocks to test_common
ericnordelo Oct 3, 2024
094081c
Remove token dual dispatchers (#1175)
ericnordelo Oct 3, 2024
e738107
feat: update docs
ericnordelo Oct 4, 2024
75974fd
feat: update CHANGELOG
ericnordelo Oct 4, 2024
586357a
fix: typo
ericnordelo Oct 4, 2024
b2ba912
fix: mod
ericnordelo Oct 4, 2024
fe6d846
feat: remove unused imports
ericnordelo Oct 4, 2024
de11d9b
fix: README
ericnordelo Oct 4, 2024
57c9003
Merge branch 'docs/remove-dual-dispatchers' into feat/remove-mocks-fr…
ericnordelo Oct 4, 2024
55225bc
feat: move mocks into test_common
ericnordelo Oct 4, 2024
72451fa
feat: remove mocks from release target
ericnordelo Oct 4, 2024
fda9095
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 6, 2024
f575ba8
fix: mock
ericnordelo Oct 6, 2024
86508c6
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 7, 2024
1c5c522
fix: imports
ericnordelo Oct 7, 2024
420d364
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 7, 2024
f14f635
feat: bumo scarb and remove assert_macros from manifest
ericnordelo Oct 7, 2024
8a763e0
feat: re-add assert_macros
ericnordelo Oct 7, 2024
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Bump scarb to v2.8.3 (#1166)
- Bump scarb to v2.8.4 (#1146)

### Changed (Breaking)

- Bump snforge to 0.31.0
- Remove openzeppelin_utils::selectors (#1163)
- Remove `DualCase dispatchers` (#1163)
- Remove `try_selector_with_fallback` from `openzeppelin_utils`
Expand Down
14 changes: 10 additions & 4 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ version = "0.17.0"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
"openzeppelin_test_common",
"openzeppelin_testing",
"openzeppelin_utils",
"snforge_std",
Expand All @@ -69,6 +70,7 @@ dependencies = [
name = "openzeppelin_introspection"
version = "0.17.0"
dependencies = [
"openzeppelin_test_common",
"snforge_std",
]

Expand Down Expand Up @@ -99,6 +101,7 @@ dependencies = [
name = "openzeppelin_security"
version = "0.17.0"
dependencies = [
"openzeppelin_test_common",
"openzeppelin_testing",
"snforge_std",
]
Expand All @@ -110,6 +113,8 @@ dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_security",
"openzeppelin_testing",
"openzeppelin_token",
"openzeppelin_upgrades",
Expand Down Expand Up @@ -150,21 +155,22 @@ dependencies = [
name = "openzeppelin_utils"
version = "0.17.0"
dependencies = [
"openzeppelin_test_common",
"openzeppelin_testing",
"snforge_std",
]

[[package]]
name = "snforge_scarb_plugin"
version = "0.2.0"
version = "0.31.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:2e4ce3ebe3f49548bd26908391b5d78537a765d827df0d96c32aeb88941d0d67"
checksum = "sha256:1fce075fcbf7fce1b0935f6f9a034549704837fb221da212d3b6e9134cebfdaa"

[[package]]
name = "snforge_std"
version = "0.30.0"
version = "0.31.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:2f3c4846881813ac0f5d1460981249c9f5e2a6831e752beedf9b70975495b4ec"
checksum = "sha256:60ac980b297281f9a59a5f1668cb56bdea1b28fd2f8008008270f9a3c91ad3ba"
dependencies = [
"snforge_scarb_plugin",
]
11 changes: 5 additions & 6 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ keywords.workspace = true
[workspace.package]
version = "0.17.0"
edition = "2024_07"
cairo-version = "2.8.2"
scarb-version = "2.8.3"
cairo-version = "2.8.4"
scarb-version = "2.8.4"
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 @@ -40,9 +40,9 @@ keywords = [
]

[workspace.dependencies]
assert_macros = "2.8.2"
starknet = "2.8.2"
snforge_std = "0.30.0"
assert_macros = "2.8.4"
starknet = "2.8.4"
snforge_std = "0.31.0"

[dependencies]
starknet.workspace = true
Expand All @@ -59,7 +59,6 @@ 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
3 changes: 2 additions & 1 deletion packages/access/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod accesscontrol;
pub mod ownable;

pub mod tests;
#[cfg(test)]
mod tests;
5 changes: 0 additions & 5 deletions packages/access/src/tests.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
pub(crate) mod mocks;

#[cfg(test)]
mod test_accesscontrol;
#[cfg(test)]
mod test_ownable;
#[cfg(test)]
mod test_ownable_twostep;
2 changes: 0 additions & 2 deletions packages/access/src/tests/mocks.cairo

This file was deleted.

39 changes: 0 additions & 39 deletions packages/access/src/tests/mocks/accesscontrol_mocks.cairo

This file was deleted.

60 changes: 0 additions & 60 deletions packages/access/src/tests/mocks/ownable_mocks.cairo

This file was deleted.

2 changes: 1 addition & 1 deletion packages/access/src/tests/test_accesscontrol.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::accesscontrol::AccessControlComponent::{
};
use crate::accesscontrol::interface::{IAccessControl, IAccessControlCamel, IACCESSCONTROL_ID};
use crate::accesscontrol::{AccessControlComponent, DEFAULT_ADMIN_ROLE};
use crate::tests::mocks::accesscontrol_mocks::DualCaseAccessControlMock;
use openzeppelin_introspection::interface::ISRC5;
use openzeppelin_test_common::mocks::access::DualCaseAccessControlMock;
use openzeppelin_testing::constants::{
ADMIN, AUTHORIZED, OTHER, OTHER_ADMIN, ROLE, OTHER_ROLE, ZERO
};
Expand Down
3 changes: 1 addition & 2 deletions packages/access/src/tests/test_ownable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use core::num::traits::Zero;
use crate::ownable::OwnableComponent::InternalTrait;
use crate::ownable::OwnableComponent;
use crate::ownable::interface::{IOwnable, IOwnableCamelOnly};
use crate::tests::mocks::ownable_mocks::DualCaseOwnableMock;

use openzeppelin_test_common::mocks::access::DualCaseOwnableMock;
use openzeppelin_test_common::ownable::OwnableSpyHelpers;
use openzeppelin_testing::constants::{ZERO, OTHER, OWNER, RECIPIENT};
use snforge_std::{spy_events, test_address, start_cheat_caller_address};
Expand Down
2 changes: 1 addition & 1 deletion packages/access/src/tests/test_ownable_twostep.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::num::traits::Zero;
use crate::ownable::OwnableComponent::{InternalTrait, OwnershipTransferStarted};
use crate::ownable::OwnableComponent;
use crate::ownable::interface::{IOwnableTwoStep, IOwnableTwoStepCamelOnly};
use crate::tests::mocks::ownable_mocks::DualCaseTwoStepOwnableMock;
use openzeppelin_test_common::mocks::access::DualCaseTwoStepOwnableMock;
use openzeppelin_test_common::ownable::OwnableSpyHelpers;
use openzeppelin_testing::constants::{ZERO, OWNER, OTHER, NEW_OWNER};
use openzeppelin_testing::events::EventSpyExt;
Expand Down
8 changes: 8 additions & 0 deletions packages/account/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ openzeppelin_test_common = { path = "../test_common" }
allowed-libfuncs-list.name = "experimental"
sierra = true
casm = false

[[test]]
build-external-contracts = [
"openzeppelin_test_common::mocks::account::DualCaseAccountMock",
"openzeppelin_test_common::mocks::account::DualCaseEthAccountMock",
"openzeppelin_test_common::mocks::src9::SRC9AccountMock",
"openzeppelin_test_common::mocks::simple::SimpleMock",
]
3 changes: 2 additions & 1 deletion packages/account/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ pub mod eth_account;
pub mod extensions;
pub mod interface;

pub mod tests;
#[cfg(test)]
mod tests;
pub mod utils;

pub use account::AccountComponent;
Expand Down
5 changes: 0 additions & 5 deletions packages/account/src/tests.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
mod extensions;
pub(crate) mod mocks;

#[cfg(test)]
mod test_account;
#[cfg(test)]
mod test_eth_account;
#[cfg(test)]
mod test_secp256k1;
#[cfg(test)]
mod test_signature;
2 changes: 0 additions & 2 deletions packages/account/src/tests/extensions.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#[cfg(test)]
mod test_snip12_utils;
#[cfg(test)]
mod test_src9;
2 changes: 1 addition & 1 deletion packages/account/src/tests/extensions/test_src9.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::extensions::SRC9Component;
use crate::extensions::src9::interface::{ISRC9_V2Dispatcher, ISRC9_V2DispatcherTrait};
use crate::extensions::src9::interface::{OutsideExecution, ISRC9_V2_ID};
use crate::extensions::src9::snip12_utils::OutsideExecutionStructHash;
use crate::tests::mocks::src9_mocks::SRC9AccountMock;
use openzeppelin_introspection::interface::{ISRC5, ISRC5_ID};
use openzeppelin_test_common::mocks::src9::SRC9AccountMock;
use openzeppelin_testing as utils;
use openzeppelin_testing::constants::{RECIPIENT, OWNER, OTHER, FELT_VALUE};
use openzeppelin_utils::cryptography::snip12::OffchainMessageHash;
Expand Down
4 changes: 0 additions & 4 deletions packages/account/src/tests/mocks.cairo

This file was deleted.

45 changes: 0 additions & 45 deletions packages/account/src/tests/mocks/account_mocks.cairo

This file was deleted.

43 changes: 0 additions & 43 deletions packages/account/src/tests/mocks/eth_account_mocks.cairo

This file was deleted.

Loading