Skip to content
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# IMPORTANT: REPLACE THE BELOW HANDLE AND THE PLACEHOLDERS FURTHER BELOW WITH HANDLES OF THE ACTUAL CODE OWNERS!!!
* @0xNeshi

# SECURITY.md {{code-owner-1}} {{code-owner-2}} @OpenZeppelin/product-security
# SECURITY.md @0xNeshi @OpenZeppelin/product-security
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ body:
id: terms
attributes:
label: Contribution Guidelines
description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/0xNeshi/robust-rust-lib-template/blob/master/CONTRIBUTING.md)
description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/OpenZeppelin/rust-project-template/blob/master/CONTRIBUTING.md)
options:
- label: I agree to follow this project's Contribution Guidelines
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ body:
id: terms
attributes:
label: Contribution Guidelines
description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/0xNeshi/robust-rust-template-lib/blob/master/CONTRIBUTING.md)
description: By submitting this issue, you agree to follow our [Contribution Guidelines](https://github.com/OpenZeppelin/rust-project-template/blob/master/CONTRIBUTING.md)
options:
- label: I agree to follow this project's Contribution Guidelines
required: true
24 changes: 15 additions & 9 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
# This workflow runs whenever a PR is opened or updated, or a commit is pushed to master. It runs
# several checks:
# - fmt: checks that the code is formatted according to rustfmt
# - clippy: checks that the code does not contain any clippy warnings
Expand All @@ -10,34 +10,35 @@ permissions:
contents: read

# This configuration allows maintainers of this repo to create a branch and pull request based on
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
# the new branch. Restricting the push trigger to the master branch ensures that the PR only gets
# built once.

on:
push:
branches: [main]
branches: [master]
pull_request:

# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
fmt:
runs-on: ubuntu-latest
name: stable / fmt
name: nightly / fmt
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2
with:
submodules: true
- name: Install stable
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # branch=master
with:
toolchain: stable
toolchain: nightly
components: rustfmt
- name: cargo fmt --check
run: cargo fmt --check
- name: cargo fmt --all --check
run: cargo +nightly fmt --all --check
clippy:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }} / clippy
Expand All @@ -63,7 +64,10 @@ jobs:
with:
reporter: 'github-pr-check'
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: --all-targets --all-features -- -D warnings -D clippy::all -D clippy::pedantic
semver:
# REMOVE THE `if` CHECK AFTER FIRST PUBLISH TO crates.io
if: ${{ false }}
runs-on: ubuntu-latest
name: semver
steps:
Expand Down Expand Up @@ -95,6 +99,8 @@ jobs:
uses: dtolnay/install@982daea0f5d846abc3c83e01a6a1d73c040047c1 # branch=cargo-docs-rs
- name: cargo docs-rs
run: cargo docs-rs
env:
RUSTUP_TOOLCHAIN: nightly
hack:
# cargo-hack checks combinations of feature flags to ensure that features are all additive
# which is required for feature unification
Expand Down Expand Up @@ -123,7 +129,7 @@ jobs:
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
strategy:
matrix:
msrv: ["1.56.1"] # 2021 edition requires 1.56
msrv: ["1.85.0"] # 2024 edition requires 1.85.0
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/nostd.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# This workflow checks whether the library is able to run without the std library (e.g., embedded).
# This entire file should be removed if this crate does not support no-std. See check.yml for
# information about how the concurrency cancellation and workflow triggering works
# It is disabled by default. To enable it for a no_std project, remove the `workflow_dispatch`
# trigger below and uncomment the following triggers:
# push:
# branches: [master]
# pull_request:
# Also ensure the crate declares `#![no_std]` (or `#![cfg_attr(not(feature = "std"), no_std)]`)
# and that `--no-default-features` disables the std feature.
name: no-std
permissions:
contents: read

on:
push:
branches: [main]
pull_request:
# push:
# branches: [master]
# pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
37 changes: 21 additions & 16 deletions .github/workflows/safety.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

on:
push:
branches: [main]
branches: [master]
pull_request:

concurrency:
Expand Down Expand Up @@ -51,12 +51,14 @@ jobs:
env:
ASAN_OPTIONS: "detect_odr_violation=0:detect_leaks=0"
RUSTFLAGS: "-Z sanitizer=address"
RUSTUP_TOOLCHAIN: nightly
- name: cargo test -Zsanitizer=leak
if: always()
run: cargo test --all-features --target x86_64-unknown-linux-gnu
env:
LSAN_OPTIONS: "suppressions=lsan-suppressions.txt"
RUSTFLAGS: "-Z sanitizer=leak"
RUSTUP_TOOLCHAIN: nightly
miri:
runs-on: ubuntu-latest
steps:
Expand All @@ -74,18 +76,21 @@ jobs:
run: cargo miri test
env:
MIRIFLAGS: ""
loom:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # branch=master
with:
toolchain: stable
- name: cargo test --test loom
run: cargo test --release --test loom
env:
LOOM_MAX_PREEMPTIONS: 2
RUSTFLAGS: "--cfg loom"
RUSTUP_TOOLCHAIN: ${{ env.NIGHTLY }}
# Loom permutation testing for concurrent code. Enable this job if the crate
# uses loom (https://crates.io/crates/loom) by uncommenting the lines below.
# loom:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # tag=v6.0.2
# with:
# submodules: true
# - name: Install stable
# uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # branch=master
# with:
# toolchain: stable
# - name: cargo test --test loom
# run: cargo test --release --test loom
# env:
# LOOM_MAX_PREEMPTIONS: 2
# RUSTFLAGS: "--cfg loom"
2 changes: 1 addition & 1 deletion .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permissions:

on:
push:
branches: [main]
branches: [master]
pull_request:
schedule:
- cron: '7 7 * * *'
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is the main CI workflow that runs the test suite on all pushes to main and all pull requests.
# This is the master CI workflow that runs the test suite on all pushes to master and all pull requests.
# It runs the following jobs:
# - required: runs the test suite on ubuntu with stable and beta rust toolchains
# - minimal: runs the test suite with the minimal versions of the dependencies that satisfy the
Expand All @@ -12,7 +12,7 @@ permissions:

on:
push:
branches: [main]
branches: [master]
pull_request:

concurrency:
Expand Down Expand Up @@ -161,8 +161,11 @@ jobs:
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
- name: Upload to codecov.io
if: env.CODECOV_TOKEN != ''
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # tag=v5.5.3
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,RUST
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing Guidelines

There are many ways to contribute.

## Troubleshooting

You can help other users in the community to solve their smart contract issues
in the [OpenZeppelin Forum].

[OpenZeppelin Forum]: https://forum.openzeppelin.com/

## Opening an issue

You can [open an issue] to suggest a feature or report a minor bug.

If you believe your issue may be due to user error and not a problem in the
library, consider instead posting a question on the [OpenZeppelin Forum].

Before opening an issue, be sure to search through the existing open and closed
issues, and consider posting a comment in one of those instead.

When requesting a new feature, include as many details as you can, especially
around the use cases that motivate it. Features are prioritized according to
the impact they may have on the ecosystem, so we appreciate information showing
that the impact could be high.

[open an issue]: https://github.com/OpenZeppelin/rust-project-template/issues/new/choose

## Finding a proper issue

### New Contributors

If you're new and looking for a good place to start, check out issues labeled ["good first issue"].

["good first issue"]: https://github.com/OpenZeppelin/rust-project-template/issues?q=is%3Aopen+label%3A%22good+first+issue%22+no%3Aassignee

## Submitting a pull request

If you would like to contribute code or documentation you may do so by forking
the repository and submitting a pull request.

Any non-trivial code contribution must be first discussed with the maintainers
in an issue (see [Opening an issue](#opening-an-issue)). Only very minor
changes are accepted without prior discussion.

Make sure to read and follow the [engineering guidelines](./GUIDELINES.md). Run
linter and tests to make sure your pull request is good before submitting it.
7 changes: 7 additions & 0 deletions Cargo.lock

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

18 changes: 6 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
[package]
name = "{{project-slug}}"
name = "rust-project-template"
version = "0.1.0"
edition = "2024"
authors = ["OpenZeppelin"]
publish = true
description = "{{project-description}}"
description = "project description"
rust-version = "1.85.0"
categories = [
# https://doc.rust-lang.org/cargo/reference/manifest.html#the-categories-field
]
keywords = [
# https://doc.rust-lang.org/cargo/reference/manifest.html#the-keywords-field
]
license = "{{license}}"
repository = "https://github.com/OpenZeppelin/{{project-slug}}"
exclude = [
".github/",
".vscode/",
".config/",
".cargo/",
"benches/",
"tests/",
]
license = "MIT"
repository = "https://github.com/OpenZeppelin/rust-project-template"
exclude = [".github/", ".vscode/", ".config/", ".cargo/", "benches/", "tests/"]

[dependencies]

Expand Down
4 changes: 2 additions & 2 deletions GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ If you make documentation changes, you may want to check whether there are any
warnings or errors:

```shell
cargo doc --all-features
RUSTDOCFLAGS="--cfg docsrs" cargo doc --no-deps --all-features
```

## Pull requests

Pull requests are squash-merged to keep the `main` branch history clean. The
Pull requests are squash-merged to keep the `master` branch history clean. The
title of the pull request becomes the commit message, which should follow
[Semantic versioning].

Expand Down
Loading
Loading