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

Add script to check rust versions + cleanup #272

Merged
merged 17 commits into from
Mar 14, 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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ on:
types: [opened, reopened, synchronize]

jobs:
version:
name: check rust version consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
profile: minimal
override: true
- name: check rust versions
run: ./scripts/check-rust-version.sh

rustfmt:
name: rustfmt nightly on ubuntu-latest
runs-on: ubuntu-latest
Expand Down
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Generated by Cargo

# will have compiled files and executables
debug/
target/

# Generated by protox `file_descriptor_set.bin`
*.bin

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
11 changes: 9 additions & 2 deletions CONTRIBUTING.md
phklive marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

We want to make contributing to this project as easy and transparent as possible, whether it's:

- Reporting a [bug](https://github.com/0xPolygonMiden/miden-node/issues/new)
- Reporting a [bug](https://github.com/0xPolygonMiden/miden-node/issues/new?assignees=&labels=bug&projects=&template=1-bugreport.yml&title=%5BBug%5D%3A+)
- Taking part in [discussions](https://github.com/0xPolygonMiden/miden-node/discussions)
- Submitting a [fix](https://github.com/0xPolygonMiden/miden-node/pulls)
- Proposing new [features](https://github.com/0xPolygonMiden/miden-node/issues/new)
- Proposing new [features](https://github.com/0xPolygonMiden/miden-node/issues/new?assignees=&labels=enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)

 

Expand Down Expand Up @@ -80,6 +80,13 @@ For example, a new change to the `miden-node-store` crate might have the followi

You can find more information about the `cargo make` commands in the [Makefile](Makefile.toml)

### Testing
After writing code different types of tests (unit, integration, end-to-end) are required to make sure that the correct behavior has been achieved and that no bugs have been introduced. You can run tests using the following command:

```
cargo make test
```

### Versioning
We use [semver](https://semver.org/) naming convention.

Expand Down
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@ members = [
"utils",
"test-macro",
]

resolver = "2"

[workspace.package]
edition = "2021"
rust-version = "1.75"
bobbinth marked this conversation as resolved.
Show resolved Hide resolved
license = "MIT"
authors = ["Miden contributors"]
readme = "README.md"
homepage = "https://polygon.technology/polygon-miden"
repository = "https://github.com/0xPolygonMiden/miden-node"
exclude = [".github/"]

[workspace.dependencies]
miden-air = { version = "0.8", default-features = false }
miden-lib = { version = "0.1" }
Expand Down
6 changes: 6 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
[tasks.format]
toolchain = "nightly"
command = "cargo"
args = ["fmt", "--all"]

[tasks.format-check]
toolchain = "nightly"
command = "cargo"
args = ["fmt", "--all", "--", "--check"]

[tasks.clippy-default]
Expand Down Expand Up @@ -34,6 +39,7 @@ args = ["test", "--all-features", "--workspace", "--", "--nocapture"]
[tasks.lint]
dependencies = [
"format",
"format-check",
"clippy",
"docs"
]
15 changes: 8 additions & 7 deletions block-producer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
name = "miden-node-block-producer"
version = "0.2.0"
description = "Miden node's block producer component"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-node"
keywords = ["miden", "node", "store"]
edition = "2021"
rust-version = "1.75"
keywords = ["miden", "node", "block-producer"]
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[[bin]]
name = "miden-node-block-producer"
Expand Down
15 changes: 8 additions & 7 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "miden-node"
version = "0.2.0"
description = "Miden node single binary"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-node"
description = "Miden node binary"
keywords = ["miden", "node"]
edition = "2021"
rust-version = "1.75"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[features]
# Makes `make-genesis` subcommand run faster. Is only suitable for testing.
Expand Down
13 changes: 7 additions & 6 deletions proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
name = "miden-node-proto"
version = "0.2.0"
description = "Miden RPC message definitions"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-node"
keywords = ["miden", "node", "protobuf", "rpc"]
edition = "2021"
rust-version = "1.75"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[dependencies]
hex = { version = "0.4" }
Expand Down
13 changes: 7 additions & 6 deletions rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
name = "miden-node-rpc"
version = "0.2.0"
description = "Miden node's front-end RPC server"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-node"
keywords = ["miden", "node", "rpc"]
edition = "2021"
rust-version = "1.75"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[dependencies]
anyhow = { version = "1.0" }
Expand Down
13 changes: 13 additions & 0 deletions scripts/check-rust-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Check rust-toolchain file
TOOLCHAIN_VERSION=$(cat rust-toolchain)

# Check workspace Cargo.toml file
CARGO_VERSION=$(cat Cargo.toml | grep "rust-version" | cut -d '"' -f 2)
if [ "$CARGO_VERSION" != "$TOOLCHAIN_VERSION" ]; then
echo "Mismatch in $file. Expected $TOOLCHAIN_VERSION, found $CARGO_VERSION"
exit 1
fi

echo "Rust versions match ✅"
13 changes: 7 additions & 6 deletions store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
name = "miden-node-store"
version = "0.2.0"
description = "Miden node's state store component"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-node"
keywords = ["miden", "node", "store"]
edition = "2021"
rust-version = "1.75"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[[bin]]
name = "miden-node-store"
Expand Down
15 changes: 8 additions & 7 deletions test-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "miden-node-test-macro"
version = "0.1.0"
description = "Miden's test macro"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-node"
description = "Miden node's test macro"
keywords = ["miden", "node", "utils", "macro"]
edition = "2021"
rust-version = "1.75"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[dependencies]
quote = { version = "1.0" }
Expand Down
13 changes: 7 additions & 6 deletions utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
name = "miden-node-utils"
version = "0.2.0"
description = "Miden node's shared utilities"
authors = ["miden contributors"]
readme = "README.md"
license = "MIT"
repository = "https://github.com/0xPolygonMiden/miden-node"
keywords = ["miden", "node", "utils"]
edition = "2021"
rust-version = "1.75"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme.workspace = true
homepage.workspace = true
repository.workspace = true

[dependencies]
anyhow = { version = "1.0" }
Expand Down
Loading