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

Fix Changelog and versions for release #1307

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 16 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ jobs:
with:
starknet-foundry-version: ${{ env.FOUNDRY_VERSION }}

- name: Install cairo-coverage
run: curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh
# Issue with cairo-coverage. Re-add to CI once issues are fixed.
#
# - name: Install cairo-coverage
# run: curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh

- name: Markdown lint
uses: DavidAnson/markdownlint-cli2-action@eb5ca3ab411449c66620fe7f1b3c9e10547144b0 # v16
Expand All @@ -47,11 +49,16 @@ jobs:
- name: Cairo lint
run: scarb fmt --check --workspace

- name: Run tests and generate coverage report
run: snforge test --workspace --coverage
- name: Run tests
run: snforge test --workspace

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.lcov
token: ${{ secrets.CODECOV_TOKEN }}
# Issue with cairo-coverage. Re-add to CI once issues are fixed.
#
# - name: Run tests and generate coverage report
# run: snforge test --workspace --coverage
#
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# file: ./coverage.lcov
# token: ${{ secrets.CODECOV_TOKEN }}
33 changes: 31 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- ERC721Component `initializer_no_metadata` (#1278)
- ERC1155Component `initializer_no_metadata` (#1287)
- Unsigned trait restriction to the `average` function (#1310)

### Changed (Breaking)

- Bump scarb to v2.9.2 (#1239)

### Fixed (Breaking)

- SNIP12 TimelockComponent `hash_operation` to use `hash_operation_batch` for single-call operations (#1313)
- Permit and Message SNIP12 type hashes (#1283)

### Fixed

- Multisig component issue arising when removing signers with unchanged quorum (#1315)
- Governor timelock extension salt generation panicking on overflow (#1306)
- SignersInfoStorePacking issue with bit operations (#1316)
- Message type hash in SNIP12 doc (#1274)

## 0.20.0 (2024-12-06)

### Added

- SRC9 (Outside Execution) integration to account presets (#1201)
- `SNIP12HashSpanImpl` to `openzeppelin_utils::cryptography::snip12` (#1180)
- GovernorComponent with the following extensions: (#1180)
Expand All @@ -32,15 +54,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed (Breaking)

- TimelockComponent `hash_operation` to use `hash_operation_batch` for single-call operations (#1313)
- Fix SNIP12 Permit signature (#1285)
- Bump snforge_std to v0.34.0 (#1239)
- Bump scarb to v2.9.1 (#1239)
- The initializer in `OwnableComponent` now checks that `owner` is not the zero address (#1221)
- Add `verifying_contract` member to the `Delegation` struct used in Votes `delegate_by_sig` (#1214)
use crate::votes::VotesComponent::VotingUnitsTrait;
- VotingUnitsTrait moved from `openzeppelin_governance::votes::votes` to `openzeppelin_governance::votes::VotesComponent` (#1214)
- VestingComponent `release` function won't emit an event or attempt to transfer when the amount is zero (#1209)
- Bump snforge_std to v0.33.0 (#1203)

### Fixed

- Scarb manifest dependencies (#1249):
- Move `openzeppelin_utils` from dev dep to dep in governance manifest
- Remove `openzeppelin_utils` as dep in access package
- Change `openzeppelin_account` to `crate` in `src9.cairo`

## 0.19.0 (2024-11-08)

### Added
Expand Down
9 changes: 5 additions & 4 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies = [
"openzeppelin_test_common",
"openzeppelin_testing",
"openzeppelin_token",
"openzeppelin_utils",
"snforge_std",
]

Expand Down Expand Up @@ -165,15 +166,15 @@ dependencies = [

[[package]]
name = "snforge_scarb_plugin"
version = "0.33.0"
version = "0.34.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:b4dd6088372decd367652827091e0589bbf6bc550dfc3957baa3e9c61d6eb449"
checksum = "sha256:56f2b06ff2f0d8bbdfb7fb6c211fba7e4da6e5334ea70ba849af329a739faf11"

[[package]]
name = "snforge_std"
version = "0.33.0"
version = "0.34.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:f7dc3349f8a6ef4915c93df447a00bd5a53a31129fd0990a00afa0ad31d91b06"
checksum = "sha256:bd20964bde07e6fd0f7adb50d41216f05d66abd422ed82241030369333385876"
dependencies = [
"snforge_scarb_plugin",
]
11 changes: 6 additions & 5 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ name = "openzeppelin"
readme = "README.md"
version.workspace = true
keywords.workspace = true
edition.workspace = true

[workspace.package]
version = "1.0.0"
edition = "2024_07"
cairo-version = "2.8.5"
scarb-version = "2.8.5"
cairo-version = "2.9.2"
scarb-version = "2.9.2"
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 +41,9 @@ keywords = [
]

[workspace.dependencies]
assert_macros = "2.8.5"
starknet = "2.8.5"
snforge_std = "0.33.0"
assert_macros = "2.9.2"
starknet = "2.9.2"
snforge_std = "0.34.0"

[dependencies]
starknet.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ before proceeding, and run the following command to check that the installation
----
$ scarb --version

scarb 2.8.4 (2aa4e193e 2024-10-07)
cairo: 2.8.4 (https://crates.io/crates/cairo-lang-compiler/2.8.4)
scarb 2.9.2 (5070ff374 2024-12-11)
cairo: 2.9.2 (https://crates.io/crates/cairo-lang-compiler/2.9.2)
sierra: 1.6.0
----

Expand Down
56 changes: 28 additions & 28 deletions packages/access/src/accesscontrol/accesscontrol.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#[starknet::component]
pub mod AccessControlComponent {
use crate::accesscontrol::interface;
use openzeppelin_introspection::src5::SRC5Component;
use openzeppelin_introspection::src5::SRC5Component::InternalImpl as SRC5InternalImpl;
use openzeppelin_introspection::src5::SRC5Component::SRC5Impl;
use openzeppelin_introspection::src5::SRC5Component;
use starknet::ContractAddress;
use starknet::get_caller_address;
use starknet::storage::{Map, StorageMapReadAccess, StorageMapWriteAccess};
Expand All @@ -48,7 +48,7 @@ pub mod AccessControlComponent {
pub struct RoleGranted {
pub role: felt252,
pub account: ContractAddress,
pub sender: ContractAddress
pub sender: ContractAddress,
}

/// Emitted when `role` is revoked for `account`.
Expand All @@ -60,7 +60,7 @@ pub mod AccessControlComponent {
pub struct RoleRevoked {
pub role: felt252,
pub account: ContractAddress,
pub sender: ContractAddress
pub sender: ContractAddress,
}

/// Emitted when `new_admin_role` is set as `role`'s admin role, replacing `previous_admin_role`
Expand All @@ -71,7 +71,7 @@ pub mod AccessControlComponent {
pub struct RoleAdminChanged {
pub role: felt252,
pub previous_admin_role: felt252,
pub new_admin_role: felt252
pub new_admin_role: felt252,
}

pub mod Errors {
Expand All @@ -84,11 +84,11 @@ pub mod AccessControlComponent {
TContractState,
+HasComponent<TContractState>,
+SRC5Component::HasComponent<TContractState>,
+Drop<TContractState>
+Drop<TContractState>,
> of interface::IAccessControl<ComponentState<TContractState>> {
/// Returns whether `account` has been granted `role`.
fn has_role(
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress,
) -> bool {
self.AccessControl_role_member.read((role, account))
}
Expand All @@ -106,7 +106,7 @@ pub mod AccessControlComponent {
///
/// - The caller must have `role`'s admin role.
fn grant_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
let admin = Self::get_role_admin(@self, role);
self.assert_only_role(admin);
Expand All @@ -121,7 +121,7 @@ pub mod AccessControlComponent {
///
/// - The caller must have `role`'s admin role.
fn revoke_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
let admin = Self::get_role_admin(@self, role);
self.assert_only_role(admin);
Expand All @@ -141,7 +141,7 @@ pub mod AccessControlComponent {
///
/// - The caller must be `account`.
fn renounce_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
let caller = get_caller_address();
assert(caller == account, Errors::INVALID_CALLER);
Expand All @@ -155,10 +155,10 @@ pub mod AccessControlComponent {
TContractState,
+HasComponent<TContractState>,
+SRC5Component::HasComponent<TContractState>,
+Drop<TContractState>
+Drop<TContractState>,
> of interface::IAccessControlCamel<ComponentState<TContractState>> {
fn hasRole(
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress,
) -> bool {
AccessControl::has_role(self, role, account)
}
Expand All @@ -168,19 +168,19 @@ pub mod AccessControlComponent {
}

fn grantRole(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControl::grant_role(ref self, role, account);
}

fn revokeRole(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControl::revoke_role(ref self, role, account);
}

fn renounceRole(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControl::renounce_role(ref self, role, account);
}
Expand All @@ -191,7 +191,7 @@ pub mod AccessControlComponent {
TContractState,
+HasComponent<TContractState>,
impl SRC5: SRC5Component::HasComponent<TContractState>,
+Drop<TContractState>
+Drop<TContractState>,
> of InternalTrait<TContractState> {
/// Initializes the contract by registering the IAccessControl interface ID.
fn initializer(ref self: ComponentState<TContractState>) {
Expand All @@ -212,7 +212,7 @@ pub mod AccessControlComponent {
///
/// Emits a `RoleAdminChanged` event.
fn set_role_admin(
ref self: ComponentState<TContractState>, role: felt252, admin_role: felt252
ref self: ComponentState<TContractState>, role: felt252, admin_role: felt252,
) {
let previous_admin_role: felt252 = AccessControl::get_role_admin(@self, role);
self.AccessControl_role_admin.write(role, admin_role);
Expand All @@ -225,7 +225,7 @@ pub mod AccessControlComponent {
///
/// May emit a `RoleGranted` event.
fn _grant_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
if !AccessControl::has_role(@self, role, account) {
let caller: ContractAddress = get_caller_address();
Expand All @@ -240,7 +240,7 @@ pub mod AccessControlComponent {
///
/// May emit a `RoleRevoked` event.
fn _revoke_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
if AccessControl::has_role(@self, role, account) {
let caller: ContractAddress = get_caller_address();
Expand All @@ -255,11 +255,11 @@ pub mod AccessControlComponent {
TContractState,
+HasComponent<TContractState>,
impl SRC5: SRC5Component::HasComponent<TContractState>,
+Drop<TContractState>
+Drop<TContractState>,
> of interface::AccessControlABI<ComponentState<TContractState>> {
// IAccessControl
fn has_role(
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress,
) -> bool {
AccessControl::has_role(self, role, account)
}
Expand All @@ -269,26 +269,26 @@ pub mod AccessControlComponent {
}

fn grant_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControl::grant_role(ref self, role, account);
}

fn revoke_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControl::revoke_role(ref self, role, account);
}

fn renounce_role(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControl::renounce_role(ref self, role, account);
}

// IAccessControlCamel
fn hasRole(
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress,
) -> bool {
AccessControlCamel::hasRole(self, role, account)
}
Expand All @@ -298,26 +298,26 @@ pub mod AccessControlComponent {
}

fn grantRole(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControlCamel::grantRole(ref self, role, account);
}

fn revokeRole(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControlCamel::revokeRole(ref self, role, account);
}

fn renounceRole(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress,
) {
AccessControlCamel::renounceRole(ref self, role, account);
}

// ISRC5
fn supports_interface(
self: @ComponentState<TContractState>, interface_id: felt252
self: @ComponentState<TContractState>, interface_id: felt252,
) -> bool {
let src5 = get_dep_component!(self, SRC5);
src5.supports_interface(interface_id)
Expand Down
Loading
Loading