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 scarb, merge changes from main in snforge migration #1076

Merged
Merged
11 changes: 0 additions & 11 deletions .codecov.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/actionlint-matcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"problemMatcher": [
{
"owner": "actionlint",
"pattern": [
{
"regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$",
"file": 1,
"line": 2,
"column": 3,
"message": 4,
"code": 5
}
]
}
]
}
15 changes: 15 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Lint workflows

on:
pull_request:
paths:
- '.github/**/*.ya?ml'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add problem matchers
run: echo "::add-matcher::.github/actionlint-matcher.json"
- uses: docker://rhysd/actionlint:latest
16 changes: 10 additions & 6 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Extract current versions
run: |
CURRENT_VERSION=$(grep '^version = ' Scarb.toml | sed 's/version = "\(.*\)"/\1/')
SCARB_VERSION=$(grep 'scarb-version = ' Scarb.toml | sed 's/scarb-version = "\(.*\)"/\1/')
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
echo "SCARB_VERSION=$SCARB_VERSION" >> $GITHUB_ENV
CAIRO_VERSION=$(grep 'cairo-version = ' Scarb.toml | sed 's/cairo-version = "\(.*\)"/\1/')
{
echo "CURRENT_VERSION=$CURRENT_VERSION"
echo "SCARB_VERSION=$SCARB_VERSION"
echo "CAIRO_VERSION=$CAIRO_VERSION"
} >> "$GITHUB_ENV"

- name: Extract new version number
run: echo "NEW_VERSION=${GITHUB_REF#refs/heads/release-v}" >> $GITHUB_ENV
run: echo "NEW_VERSION=${GITHUB_REF#refs/heads/release-v}" >> "$GITHUB_ENV"

- name: Replace version in files
run: |
echo "Current version: $CURRENT_VERSION"
echo "New version: $NEW_VERSION"
ESCAPED_CURRENT_VERSION=$(echo $CURRENT_VERSION | sed 's/\./\\./g')
ESCAPED_CURRENT_VERSION="${CURRENT_VERSION//\./\\.}"
find . -type f -not -path '*/\.*' -not -path './CHANGELOG.md' -not -path './docs/package-lock.json' \
-not -path './RELEASING.md' -exec sed -i "s/$ESCAPED_CURRENT_VERSION/$NEW_VERSION/g" {} +

Expand All @@ -43,7 +47,7 @@ jobs:

- name: Update presets page
run: |
class_hash get --json | sed -e '1,4d' | python3 scripts/get_hashes_page.py $SCARB_VERSION \
class_hash get --json | sed -e '1,4d' | python3 scripts/get_hashes_page.py "$CAIRO_VERSION" \
> ./docs/modules/ROOT/pages/utils/_class_hashes.adoc

- name: Auto-commit changes
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,31 @@ jobs:
name: Lint and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Extract scarb version
run: |
SCARB_VERSION=$(grep 'scarb-version = ' Scarb.toml | sed 's/scarb-version = "\(.*\)"/\1/')
echo "SCARB_VERSION=$SCARB_VERSION" >> $GITHUB_ENV
echo "SCARB_VERSION=$SCARB_VERSION" >> "$GITHUB_ENV"
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ env.SCARB_VERSION }}
- name: Extract foundry version
run: |
FOUNDRY_VERSION=$(grep 'snforge_std = ' Scarb.toml | sed 's/snforge_std = .\+ tag = "v\(.*\)".*/\1/')
echo "FOUNDRY_VERSION=$FOUNDRY_VERSION" >> $GITHUB_ENV
echo "FOUNDRY_VERSION=$FOUNDRY_VERSION" >> "$GITHUB_ENV"
- uses: foundry-rs/setup-snfoundry@v3
with:
starknet-foundry-version: ${{ env.FOUNDRY_VERSION }}
- name: Markdown lint
uses: DavidAnson/markdownlint-cli2-action@5b7c9f74fec47e6b15667b2cc23c63dff11e449e # v9
uses: DavidAnson/markdownlint-cli2-action@b4c9feab76d8025d1e83c653fa3990936df0e6c8 # v16
with:
globs: |
*.md
!PULL_REQUEST_TEMPLATE.md
- name: Cairo lint
run: scarb fmt --check
- name: Temporary USC manually install
run: |
curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh -s -- v2.2.0-rc.1
- name: Cairo test
run: snforge test
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added

- TimelockController component (#996)
- HashCall implementation (#996)

### Changed

- Bump scarb to v2.7.0-rc.1 (#1025)
- Bump scarb to v2.7.0-rc.2 (#1052)
- Bump scarb to v2.7.0-rc.4 (#1064)

## 0.15.0-rc.0 (2024-07-8)

### Changed

- `Trace`, `Checkpoint`, and `StorageArray` structs made public.

### Changed (Breaking)

- Removed `num_checkpoints` and `checkpoints` from `ERC20VotesABI`.

## 0.14.0 (2024-06-14)

### Changed (Breaking)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Edit `scarb.toml` and add:

```toml
[dependencies]
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.14.0" }
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.0-rc.0" }
```

Build the project to download it:
Expand Down Expand Up @@ -105,7 +105,7 @@ mod MyToken {

### Unsupported

[`DualCase` dispatchers](https://docs.openzeppelin.com/contracts-cairo/0.14.0/interfaces#dualcase_dispatchers) rely on Sierra's ability to catch a revert to resume execution. Currently, Starknet live chains (testnets and mainnet) don't implement that behavior. Starknet's testing framework does support it.
[`DualCase` dispatchers](https://docs.openzeppelin.com/contracts-cairo/0.15.0-rc.0/interfaces#dualcase_dispatchers) rely on Sierra's ability to catch a revert to resume execution. Currently, Starknet live chains (testnets and mainnet) don't implement that behavior. Starknet's testing framework does support it.

## Learn

Expand Down Expand Up @@ -155,8 +155,8 @@ git clone [email protected]:OpenZeppelin/cairo-contracts.git
$ cd cairo-contracts
$ scarb build

Compiling lib(openzeppelin) openzeppelin v0.14.0 (~/cairo-contracts/Scarb.toml)
Compiling starknet-contract(openzeppelin) openzeppelin v0.14.0 (~/cairo-contracts/Scarb.toml)
Compiling lib(openzeppelin) openzeppelin v0.15.0-rc.0 (~/cairo-contracts/Scarb.toml)
Compiling starknet-contract(openzeppelin) openzeppelin v0.15.0-rc.0 (~/cairo-contracts/Scarb.toml)
Finished release target(s) in 16 seconds
```

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
> ⚠️ Warning! ⚠️
> This project is still in a very early and experimental phase. It has never been audited nor thoroughly reviewed for security vulnerabilities. Do not use in production.

Please report any security issues you find to [email protected].
Please report any security issues you find to <[email protected]>.
2 changes: 1 addition & 1 deletion Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version = 1

[[package]]
name = "openzeppelin"
version = "0.14.0"
version = "0.15.0-rc.0"
dependencies = [
"snforge_std",
]
Expand Down
8 changes: 4 additions & 4 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "openzeppelin"
version = "0.14.0"
version = "0.15.0-rc.0"
edition = "2023_11"
cairo-version = "2.6.4"
scarb-version = "2.6.5"
cairo-version = "2.7.0-rc.3"
scarb-version = "2.7.0-rc.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 @@ -13,7 +13,7 @@ license-file = "LICENSE"
keywords = ["openzeppelin", "starknet", "cairo", "contracts", "security", "standards"]

[dependencies]
starknet = "2.6.4"
starknet = "2.7.0-rc.3"
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.26.0" }

[lib]
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: contracts-cairo
title: Contracts for Cairo
version: 0.14.0
version: 0.15.0-rc.0
nav:
- modules/ROOT/nav.adoc
asciidoc:
Expand Down
2 changes: 0 additions & 2 deletions docs/modules/ROOT/pages/accounts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ Here’s an example of a basic contract:
mod MyEthAccount {
use openzeppelin::account::EthAccountComponent;
use openzeppelin::account::interface::EthPublicKey;
use openzeppelin::account::utils::secp256k1::Secp256k1PointSerde;
use openzeppelin::introspection::src5::SRC5Component;
use starknet::ClassHash;

Expand Down Expand Up @@ -389,7 +388,6 @@ First, let's take the example account we created before and deploy it:
mod MyEthAccount {
use openzeppelin::account::EthAccountComponent;
use openzeppelin::account::interface::EthPublicKey;
use openzeppelin::account::utils::secp256k1::Secp256k1PointSerde;
use openzeppelin::introspection::src5::SRC5Component;

component!(path: EthAccountComponent, storage: eth_account, event: EthAccountEvent);
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/pages/api/access.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ assigned each to multiple accounts.

[.contract]
[[OwnableComponent]]
=== `++OwnableComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/access/ownable/ownable.cairo[{github-icon},role=heading-link]
=== `++OwnableComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/access/ownable/ownable.cairo[{github-icon},role=heading-link]

```cairo
use openzeppelin::access::ownable::OwnableComponent;
Expand Down Expand Up @@ -267,7 +267,7 @@ Emitted when the ownership is transferred.

[.contract]
[[IAccessControl]]
=== `++IAccessControl++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/access/accesscontrol/interface.cairo[{github-icon},role=heading-link]
=== `++IAccessControl++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/access/accesscontrol/interface.cairo[{github-icon},role=heading-link]

:grant_role: xref:#IAccessControl-grant_role[grant_role]
:revoke_role: xref:#IAccessControl-revoke_role[revoke_role]
Expand Down Expand Up @@ -400,7 +400,7 @@ Emitted when `account` is revoked `role`.

[.contract]
[[AccessControlComponent]]
=== `++AccessControlComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/access/accesscontrol/accesscontrol.cairo[{github-icon},role=heading-link]
=== `++AccessControlComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/access/accesscontrol/accesscontrol.cairo[{github-icon},role=heading-link]

:assert_only_role: xref:#AccessControlComponent-assert_only_role
:grant_role: xref:#AccessControlComponent-grant_role[grant_role]
Expand Down
10 changes: 5 additions & 5 deletions docs/modules/ROOT/pages/api/account.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include::../utils/_common.adoc[]

[.contract]
[[ISRC6]]
=== `++ISRC6++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/account/interface.cairo[{github-icon},role=heading-link]
=== `++ISRC6++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/account/interface.cairo[{github-icon},role=heading-link]

```cairo
use openzeppelin::account::interface::ISRC6;
Expand Down Expand Up @@ -65,7 +65,7 @@ Returns the short string `'VALID'` if valid, otherwise it reverts.

[.contract]
[[AccountComponent]]
=== `++AccountComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/account/account.cairo[{github-icon},role=heading-link]
=== `++AccountComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/account/account.cairo[{github-icon},role=heading-link]

:OwnerAdded: xref:AccountComponent-OwnerAdded[OwnerAdded]
:OwnerRemoved: xref:AccountComponent-OwnerRemoved[OwnerRemoved]
Expand Down Expand Up @@ -315,7 +315,7 @@ Emitted when a `public_key` is removed.

[.contract]
[[EthAccountComponent]]
=== `++EthAccountComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/account/eth_account.cairo[{github-icon},role=heading-link]
=== `++EthAccountComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/account/eth_account.cairo[{github-icon},role=heading-link]

:OwnerAdded: xref:EthAccountComponent-OwnerAdded[OwnerAdded]
:OwnerRemoved: xref:EthAccountComponent-OwnerRemoved[OwnerRemoved]
Expand Down Expand Up @@ -570,7 +570,7 @@ Emitted when a `public_key` is removed.

[.contract]
[[AccountUpgradeable]]
=== `++AccountUpgradeable++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/presets/account.cairo[{github-icon},role=heading-link]
=== `++AccountUpgradeable++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/presets/account.cairo[{github-icon},role=heading-link]

```cairo
use openzeppelin::presets::AccountUpgradeable;
Expand Down Expand Up @@ -631,7 +631,7 @@ Requirements:

[.contract]
[[EthAccountUpgradeable]]
=== `++EthAccountUpgradeable++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/presets/eth_account.cairo[{github-icon},role=heading-link]
=== `++EthAccountUpgradeable++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/presets/eth_account.cairo[{github-icon},role=heading-link]

```cairo
use openzeppelin::presets::EthAccountUpgradeable;
Expand Down
12 changes: 6 additions & 6 deletions docs/modules/ROOT/pages/api/erc1155.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TIP: For an overview of ERC1155, read our xref:erc1155.adoc[ERC1155 guide].

[.contract]
[[IERC1155]]
=== `++IERC1155++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/token/erc1155/interface.cairo[{github-icon},role=heading-link]
=== `++IERC1155++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/token/erc1155/interface.cairo[{github-icon},role=heading-link]

[.hljs-theme-dark]
```cairo
Expand Down Expand Up @@ -126,7 +126,7 @@ Emitted when the token URI is updated to `value` for the `id` token.

[.contract]
[[IERC1155MetadataURI]]
=== `++IERC1155MetadataURI++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/token/erc1155/interface.cairo[{github-icon},role=heading-link]
=== `++IERC1155MetadataURI++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/token/erc1155/interface.cairo[{github-icon},role=heading-link]

[.hljs-theme-dark]
```cairo
Expand Down Expand Up @@ -156,7 +156,7 @@ Returns the Uniform Resource Identifier (URI) for the `token_id` token.

[.contract]
[[ERC1155Component]]
=== `++ERC1155Component++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/token/erc1155/erc1155.cairo[{github-icon},role=heading-link]
=== `++ERC1155Component++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/token/erc1155/erc1155.cairo[{github-icon},role=heading-link]

[.hljs-theme-dark]
```cairo
Expand Down Expand Up @@ -543,7 +543,7 @@ See <<IERC1155-URI,IERC1155::URI>>.

[.contract]
[[IERC1155Receiver]]
=== `++IERC1155Receiver++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/token/erc1155/interface.cairo[{github-icon},role=heading-link]
=== `++IERC1155Receiver++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/token/erc1155/interface.cairo[{github-icon},role=heading-link]

[.hljs-theme-dark]
```cairo
Expand Down Expand Up @@ -583,7 +583,7 @@ via <<IERC1155-safe_batch_transfer_from,IERC1155::safe_batch_transfer_from>> by

[.contract]
[[ERC1155ReceiverComponent]]
=== `++ERC1155ReceiverComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/token/erc1155/erc1155_receiver.cairo[{github-icon},role=heading-link]
=== `++ERC1155ReceiverComponent++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/token/erc1155/erc1155_receiver.cairo[{github-icon},role=heading-link]

[.hljs-theme-dark]
```cairo
Expand Down Expand Up @@ -660,7 +660,7 @@ Registers the `IERC1155Receiver` interface ID as supported through introspection

[.contract]
[[ERC1155Upgradeable]]
=== `++ERC1155Upgradeable++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.14.0/src/presets/erc1155.cairo[{github-icon},role=heading-link]
=== `++ERC1155Upgradeable++` link:https://github.com/OpenZeppelin/cairo-contracts/blob/release-v0.15.0-rc.0/src/presets/erc1155.cairo[{github-icon},role=heading-link]

```cairo
use openzeppelin::presets::ERC1155;
Expand Down
Loading