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

chore: merge v0.1.0 release #370

Merged
merged 17 commits into from
Oct 18, 2024
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
5 changes: 2 additions & 3 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Link Checker
uses: lycheeverse/lychee-action@v2
with:
Expand All @@ -30,9 +30,8 @@ jobs:
if: startsWith(github.ref, 'refs/heads/v') || startsWith(github.base_ref, 'v')
steps:
- uses: actions/checkout@v4

- name: Run linkspector
uses: umbrelladocs/action-linkspector@v1
with:
fail_on_error: true

7 changes: 3 additions & 4 deletions .github/workflows/check-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: check-publish
# This workflow checks that the libraries can be published on crates.io.
# This workflow checks if the libraries can be published on crates.io.
permissions:
contents: read
on:
Expand Down Expand Up @@ -40,6 +40,5 @@ jobs:
- name: check openzeppelin-stylus-proc
run: cargo publish -p openzeppelin-stylus-proc --target wasm32-unknown-unknown --dry-run

# TODO: https://github.com/OpenZeppelin/rust-contracts-stylus/issues/291
# - name: check openzeppelin-stylus
# run: cargo publish -p openzeppelin-stylus --target wasm32-unknown-unknown --dry-run
- name: check openzeppelin-stylus
run: cargo publish -p openzeppelin-stylus --target wasm32-unknown-unknown --dry-run
29 changes: 16 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ authors = ["OpenZeppelin"]
edition = "2021"
license = "MIT"
repository = "https://github.com/OpenZeppelin/rust-contracts-stylus"
version = "0.1.0-rc"
version = "0.1.0"

[workspace.lints.rust]
missing_docs = "warn"
Expand All @@ -65,7 +65,7 @@ all = "warn"
stylus-sdk = { version = "=0.6.0", default-features = false }
mini-alloc = "0.4.2"

alloy = { version = "0.1.4", features = [
alloy = { version = "=0.1.4", features = [
"contract",
"network",
"providers",
Expand All @@ -78,8 +78,11 @@ alloy = { version = "0.1.4", features = [
# Even though `alloy` includes `alloy-primitives` and `alloy-sol-types` we need
# to keep both versions for compatibility with the Stylus SDK. Once they start
# using `alloy` we can remove these.
alloy-primitives = { version = "0.7.6", default-features = false }
alloy-sol-types = { version = "0.7.6", default-features = false }
alloy-primitives = { version = "=0.7.6", default-features = false }
alloy-sol-types = { version = "=0.7.6", default-features = false }
alloy-sol-macro = { version = "=0.7.6", default-features = false }
alloy-sol-macro-expander = { version = "=0.7.6", default-features = false }
alloy-sol-macro-input = { version = "=0.7.6", default-features = false }

const-hex = { version = "1.11.1", default-features = false }
eyre = "0.6.8"
Expand All @@ -99,7 +102,7 @@ quote = "1.0.35"

# members
openzeppelin-stylus = { path = "contracts" }
openzeppelin-stylus-proc = { path = "contracts-proc" }
openzeppelin-stylus-proc = { path = "contracts-proc", version = "0.1.0" }
openzeppelin-crypto = { path = "lib/crypto" }
motsu = { path = "lib/motsu"}
motsu-proc = { path = "lib/motsu-proc", version = "0.1.0" }
Expand Down
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
**A library for secure smart contract development** written in Rust for
[Arbitrum Stylus](https://docs.arbitrum.io/stylus/stylus-gentle-introduction).

> [!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.

## Features

- Security-first smart contracts, ported from the [`openzeppelin-contracts`]
Expand All @@ -31,7 +26,7 @@ line to your `Cargo.toml` (We recommend pinning to a specific version):

```toml
[dependencies]
openzeppelin-stylus = "0.1.0-rc"
openzeppelin-stylus = "0.1.0"
```

Optionally, you can specify a git dependency if you want to have the latest
Expand All @@ -56,7 +51,7 @@ sol_storage! {
}
}

#[external]
#[public]
#[inherit(Erc20)]
impl Erc20Example {}
```
Expand All @@ -71,8 +66,7 @@ For more information on what this library will include in the future, see our
[roadmap].

[basic]: ./examples/basic

[roadmap]: https://github.com/OpenZeppelin/rust-contracts-stylus/milestone/1
[roadmap]: https://github.com/OpenZeppelin/rust-contracts-stylus/milestone/2

## Contribute

Expand All @@ -82,10 +76,7 @@ the [contribution guide](CONTRIBUTING.md)!

## Security

> [!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.
Past audits can be found in [`audits/`](./audits).

Refer to our [Security Policy](SECURITY.md) for more details.

Expand Down
5 changes: 1 addition & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Security

> [!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.
Past audits can be found in [`audits/`](./audits).

Please report any security issues you find to [email protected].
Binary file added audits/2024-10-v0.1.0.pdf
Binary file not shown.
7 changes: 3 additions & 4 deletions contracts-proc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[package]
name = "openzeppelin-stylus-proc"
description = "Procedural macros for OpenZeppelin Stylus contracts"
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
categories = ["cryptography::cryptocurrencies", "no-std", "wasm"]
keywords = ["arbitrum", "ethereum", "stylus", "smart-contracts", "standards"]
repository.workspace = true

keywords = ["arbitrum", "ethereum", "stylus", "smart-contracts", "standards"]
categories = ["cryptography::cryptocurrencies", "no-std", "wasm"]
version = "0.1.0"

[dependencies]
proc-macro2.workspace = true
Expand Down
3 changes: 3 additions & 0 deletions contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ version.workspace = true
[dependencies]
alloy-primitives.workspace = true
alloy-sol-types.workspace = true
alloy-sol-macro.workspace = true
alloy-sol-macro-expander.workspace = true
alloy-sol-macro-input.workspace = true
stylus-sdk.workspace = true
mini-alloc.workspace = true
keccak-const.workspace = true
Expand Down
5 changes: 0 additions & 5 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ Robust, reliable, and secure smart contracts for the Arbitrum Stylus upgrade.

## Security

> [!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.

Refer to our [Security Policy](../SECURITY.md) for more details.
6 changes: 1 addition & 5 deletions contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ A library for secure smart contract development written in Rust for
This library offers common smart contract primitives and affordances that take
advantage of the nature of Stylus.
> 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.
## Usage
To start using it, add `openzeppelin-stylus` to your `Cargo.toml`, or simply run
Expand All @@ -36,7 +32,7 @@ sol_storage! {
}
}
#[external]
#[public]
#[inherit(Erc20)]
impl MyContract { }
```
Expand Down
4 changes: 2 additions & 2 deletions contracts/src/token/erc20/extensions/burnable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ mod tests {
}

#[motsu::test]
fn burns_from_errors_when_invalid_sender(contract: Erc20) {
fn burns_from_errors_when_invalid_approver(contract: Erc20) {
let one = uint!(1_U256);

contract
Expand All @@ -168,7 +168,7 @@ mod tests {
.set(one);

let result = contract.burn_from(Address::ZERO, one);
assert!(matches!(result, Err(Error::InvalidSender(_))));
assert!(matches!(result, Err(Error::InvalidApprover(_))));
}

#[motsu::test]
Expand Down
6 changes: 0 additions & 6 deletions contracts/src/token/erc20/extensions/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ pub trait IErc20Metadata {
fn decimals(&self) -> u8;
}

// FIXME: Apply multi-level inheritance to export Metadata's functions.
// With the current version of SDK it is not possible.
// See https://github.com/OffchainLabs/stylus-sdk-rs/pull/120
#[public]
impl IErc20Metadata for Erc20Metadata {
fn name(&self) -> String {
Expand All @@ -75,9 +72,6 @@ impl IErc20Metadata for Erc20Metadata {
}

fn decimals(&self) -> u8 {
// TODO: Use `U8` an avoid the conversion once
// https://github.com/OffchainLabs/stylus-sdk-rs/issues/117
// gets resolved.
DEFAULT_DECIMALS
}
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/token/erc20/extensions/permit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl<T: IEip712 + StorageType> Erc20Permit<T> {
return Err(ERC2612InvalidSigner { signer, owner }.into());
}

self.erc20._approve(owner, spender, value)?;
self.erc20._approve(owner, spender, value, true)?;

Ok(())
}
Expand Down
Loading
Loading