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 taplo CI + format all TOML files #915

Closed
wants to merge 3 commits into from
Closed
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
18 changes: 17 additions & 1 deletion .github/workflows/fmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- main
- dev

name: Rustfmt
name: Rustfmt + Taplo

jobs:
fmt:
Expand All @@ -32,6 +32,7 @@ jobs:
toolchain: nightly
override: true
components: rustfmt

- name: Run fmt in different workspaces and crates
run: |
cargo fmt --all --manifest-path=benches/Cargo.toml -- --check
Expand All @@ -40,3 +41,18 @@ jobs:
cargo fmt --all --manifest-path=roles/Cargo.toml -- --check
cargo fmt --all --manifest-path=utils/Cargo.toml -- --check
cargo fmt --all --manifest-path=utils/message-generator/Cargo.toml -- --check

- name: Install Taplo
run: cargo install taplo-cli

- name: Run Taplo to check formatting on Cargo.toml files
id: taplo-check
run: taplo fmt --check -c .taplo-cargo.toml

- name: Run Taplo to check formatting on user-facing TOML files
id: taplo-check
run: taplo fmt --check -c .taplo-user-config.toml

- name: Run Taplo to check formatting on misc TOML files (not user-facing configs nor Cargo.toml)
id: taplo-check
run: taplo fmt --check -c .taplo-misc.toml
2 changes: 2 additions & 0 deletions .taplo-cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# these formatting rules only apply to Cargo.toml files
include = ["*/**/Cargo.toml"]
7 changes: 7 additions & 0 deletions .taplo-misc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# these formatting rules only apply to misc TOML files (not user-facing configs nor Cargo.toml)
exclude = [
"roles/**/*config*.toml",
"test/config/**/*.toml",
"examples/**/*config*.toml",
"*/**/Cargo.toml",
]
6 changes: 6 additions & 0 deletions .taplo-user-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# these formatting rules only apply to user-facing TOML files
include = [
"roles/**/*config*.toml",
"test/config/**/*.toml",
"examples/**/*config*.toml",
]
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ The SRI project follows an open contributor model, where anyone is welcome to co

`cargo fmt`: this command formats your code according to the project's style guidelines. Make sure to run this command to ensure consistency in code formatting.

`taplo fmt`: this command formats TOML files according to the project's style guidelines. Make sure to run this command to ensure consistency in code formatting.

5. **Submit a Pull Request:** once you're satisfied with your changes, submit a pull request to the original SRI repository. Provide a clear and concise description of the changes you've made. If your pull request addresses an existing issue, reference the issue number in the description. In order to contribute to the protocol implementation, every PR must be opened against `dev` branch. To better understand which is the SRI branches structure, please have a look [here](https://github.com/stratum-mining/stratum/blob/main/RELEASE.md#principal-branches).

6. **Review and Iterate**
Expand Down
27 changes: 17 additions & 10 deletions benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,39 @@ version = "1.0.0"
edition = "2021"

[dependencies]
async-std={version = "1.10.0", features = ["attributes"]}
async-std = { version = "1.10.0", features = ["attributes"] }
criterion = "0.5.1"
async-channel = "1.4.0"
v1 = { path="../protocols/v1", package="sv1_api", version = "^1.0.0" }
serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] }
iai="0.1"
v1 = { path = "../protocols/v1", package = "sv1_api", version = "^1.0.0" }
serde_json = { version = "1.0.64", default-features = false, features = [
"alloc",
] }
iai = "0.1"
mining_sv2 = { path = "../protocols/v2/subprotocols/mining", version = "^1.0.0" }
roles_logic_sv2 = { path = "../protocols/v2/roles-logic-sv2", version = "^1.0.0" }
framing_sv2 = { version = "1.1.0", path = "../protocols/v2/framing-sv2" }
serde = { version = "1.0.89", default-features = false, features = ["derive", "alloc"] }
serde = { version = "1.0.89", default-features = false, features = [
"derive",
"alloc",
] }
num-bigint = "0.4.3"
num-traits = "0.2.15"
bitcoin="0.28.1"
codec_sv2 = { path = "../protocols/v2/codec-sv2", features=["noise_sv2"] }
bitcoin = "0.28.1"
codec_sv2 = { path = "../protocols/v2/codec-sv2", features = ["noise_sv2"] }
binary_sv2 = { path = "../protocols/v2/binary-sv2/binary-sv2" }
network_helpers_sv2 = { path = "../roles/roles-utils/network-helpers", features=["async_std"] }
network_helpers_sv2 = { path = "../roles/roles-utils/network-helpers", features = [
"async_std",
] }
rand = "0.8.4"

[[bench]]
name = "criterion_sv1_benchmark"
path="benches/src/sv1/criterion_sv1_benchmark.rs"
path = "benches/src/sv1/criterion_sv1_benchmark.rs"
harness = false

[[bench]]
name = "iai_sv1_benchmark"
path="benches/src/sv1/iai_sv1_benchmark.rs"
path = "benches/src/sv1/iai_sv1_benchmark.rs"
harness = false

[[bench]]
Expand Down
8 changes: 6 additions & 2 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/stratum-mining/stratum"

[dependencies]
bitcoin = {version="0.29.1",optional=true}
secp256k1 = { version = "0.28.2", default-features = false, features =["alloc","rand","rand-std"] }
bitcoin = { version = "0.29.1", optional = true }
secp256k1 = { version = "0.28.2", default-features = false, features = [
"alloc",
"rand",
"rand-std",
] }
22 changes: 17 additions & 5 deletions examples/ping-pong-with-noise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,26 @@ publish = false

[dependencies]
rand = "0.8.3"
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false, optional = true}
serde = { version = "1.0.89", features = [
"derive",
"alloc",
], default-features = false, optional = true }
async-channel = "1.5.1"
async-std="1.8.0"
async-std = "1.8.0"
bytes = "1.0.1"
binary_sv2 = { version = "^1.0.0", path = "../../protocols/v2/binary-sv2/binary-sv2" }
codec_sv2 = { version = "^1.0.0", path = "../../protocols/v2/codec-sv2", features=["noise_sv2"] }
network_helpers_sv2 = { version = "^2.0.0", path = "../../roles/roles-utils/network-helpers", features=["async_std"] }
codec_sv2 = { version = "^1.0.0", path = "../../protocols/v2/codec-sv2", features = [
"noise_sv2",
] }
network_helpers_sv2 = { version = "^2.0.0", path = "../../roles/roles-utils/network-helpers", features = [
"async_std",
] }
key-utils = { version = "^1.0.0", path = "../../utils/key-utils" }

[features]
with_serde = ["binary_sv2/with_serde", "serde", "codec_sv2/with_serde", "network_helpers_sv2/with_serde"]
with_serde = [
"binary_sv2/with_serde",
"serde",
"codec_sv2/with_serde",
"network_helpers_sv2/with_serde",
]
7 changes: 5 additions & 2 deletions examples/ping-pong-without-noise/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ publish = false

[dependencies]
rand = "0.8.3"
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false, optional = true}
serde = { version = "1.0.89", features = [
"derive",
"alloc",
], default-features = false, optional = true }
async-channel = "1.5.1"
async-std="1.8.0"
async-std = "1.8.0"
bytes = "1.0.1"
binary_sv2 = { path = "../../protocols/v2/binary-sv2/binary-sv2" }
codec_sv2 = { path = "../../protocols/v2/codec-sv2" }
Expand Down
13 changes: 9 additions & 4 deletions examples/sv1-client-and-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
v1={path="../../protocols/v1", package="sv1_api"}
async-std="1.8.0"
serde = { version = "1.0.89", default-features = false, features = ["derive", "alloc"] }
serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] }
v1 = { path = "../../protocols/v1", package = "sv1_api" }
async-std = "1.8.0"
serde = { version = "1.0.89", default-features = false, features = [
"derive",
"alloc",
] }
serde_json = { version = "1.0.64", default-features = false, features = [
"alloc",
] }
async-channel = "1.5.1"
4 changes: 3 additions & 1 deletion examples/sv2-proxy/proxy-config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
upstreams = [{ address = "127.0.0.1", port = 34254, pub_key = "2di19GHYQnAZJmEpoUeP7C3Eg9TCcksHr23rZCC83dvUiZgiDL"}]
upstreams = [
{ address = "127.0.0.1", port = 34254, pub_key = "2di19GHYQnAZJmEpoUeP7C3Eg9TCcksHr23rZCC83dvUiZgiDL" },
]
listen_address = "127.0.0.1"
listen_mining_port = 34255
max_supported_version = 2
Expand Down
10 changes: 7 additions & 3 deletions examples/template-provider-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
codec_sv2 = { version = "1.0", path = "../../protocols/v2/codec-sv2", features=["noise_sv2"] }
codec_sv2 = { version = "1.0", path = "../../protocols/v2/codec-sv2", features = [
"noise_sv2",
] }
roles_logic_sv2 = { version = "^0.1.0", path = "../../protocols/v2/roles-logic-sv2" }
network_helpers_sv2 = { version = "^0.1.0", path = "../../roles/roles-utils/network-helpers", features=["async_std"] }
network_helpers_sv2 = { version = "^0.1.0", path = "../../roles/roles-utils/network-helpers", features = [
"async_std",
] }
async-channel = "1.5.1"
async-std={version = "1.8.0", features = ["attributes"]}
async-std = { version = "1.8.0", features = ["attributes"] }
32 changes: 16 additions & 16 deletions protocols/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ keywords = ["stratum", "mining", "bitcoin", "protocol"]

[workspace]

resolver="2"
resolver = "2"

members = [
"v1",
"v2/binary-sv2/serde-sv2",
"v2/binary-sv2/no-serde-sv2/codec",
"v2/binary-sv2/no-serde-sv2/derive_codec",
"v2/binary-sv2/binary-sv2",
"v2/noise-sv2",
"v2/framing-sv2",
"v2/codec-sv2",
"v2/const-sv2",
"v2/subprotocols/common-messages",
"v2/subprotocols/template-distribution",
"v2/subprotocols/mining",
"v2/subprotocols/job-declaration",
"v2/sv2-ffi",
"v2/roles-logic-sv2",
"v1",
"v2/binary-sv2/serde-sv2",
"v2/binary-sv2/no-serde-sv2/codec",
"v2/binary-sv2/no-serde-sv2/derive_codec",
"v2/binary-sv2/binary-sv2",
"v2/noise-sv2",
"v2/framing-sv2",
"v2/codec-sv2",
"v2/const-sv2",
"v2/subprotocols/common-messages",
"v2/subprotocols/template-distribution",
"v2/subprotocols/mining",
"v2/subprotocols/job-declaration",
"v2/sv2-ffi",
"v2/roles-logic-sv2",
]

[profile.dev]
Expand Down
8 changes: 5 additions & 3 deletions protocols/fuzz-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ cargo-fuzz = true
libfuzzer-sys = { version = "0.4.0", features = ["arbitrary-derive"] }
arbitrary = { version = "1", features = ["derive"] }
rand = "0.8.3"
binary_codec_sv2 = { version = "1.0.0", path = "../v2/binary-sv2/no-serde-sv2/codec"}
codec_sv2 = { version = "1.0.0", path = "../v2/codec-sv2", features = ["noise_sv2"]}
roles_logic_sv2 = { version = "1.0.0", path = "../v2/roles-logic-sv2"}
binary_codec_sv2 = { version = "1.0.0", path = "../v2/binary-sv2/no-serde-sv2/codec" }
codec_sv2 = { version = "1.0.0", path = "../v2/codec-sv2", features = [
"noise_sv2",
] }
roles_logic_sv2 = { version = "1.0.0", path = "../v2/roles-logic-sv2" }
affinity = "0.1.1"
threadpool = "1.8.1"
lazy_static = "1.4.0"
Expand Down
2 changes: 1 addition & 1 deletion protocols/tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[default]
features = "disable_nopanic prop_test noise_sv2 with_buffer_pool derive_codec_sv2 binary_codec_sv2 default core"
run-types = [ "Lib" ]
run-types = ["Lib"]
timeout = "120s"
fail-under = 20

Expand Down
13 changes: 9 additions & 4 deletions protocols/v1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ byteorder = "1.2.7"
pretty_env_logger = "0.4.0"
log = "0.4.0"
hex = "0.4.3"
serde = { version = "1.0.89", default-features = false, features = ["derive", "alloc"] }
serde_json = { version = "1.0.64", default-features = false, features = ["alloc"] }
tracing = {version = "0.1"}
binary_sv2 = { version = "^1.0.0", path = "../v2/binary-sv2/binary-sv2"}
serde = { version = "1.0.89", default-features = false, features = [
Copy link
Contributor

@jbesraa jbesraa Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line break because of line length? the previous formatting made more sense(each crate on its own line)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, the .taplo*.toml files are all empty with regards to actual formatting policies, they only do filtering for which file they will format

so I assume this is coming from the default formatting policy that taplo brings

"derive",
"alloc",
] }
serde_json = { version = "1.0.64", default-features = false, features = [
"alloc",
] }
tracing = { version = "0.1" }
binary_sv2 = { version = "^1.0.0", path = "../v2/binary-sv2/binary-sv2" }

[dev-dependencies]
quickcheck = "1"
Expand Down
13 changes: 8 additions & 5 deletions protocols/v2/binary-sv2/binary-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ repository = "https://github.com/stratum-mining/stratum"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde_sv2 = {version = "^1.0.0", path = "../serde-sv2", optional = true}
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false, optional = true }
binary_codec_sv2 = {version = "^1.0.0", path = "../no-serde-sv2/codec", optional = true}
derive_codec_sv2 = {version = "^1.0.0", path = "../no-serde-sv2/derive_codec", optional = true}
tracing = {version = "0.1"}
serde_sv2 = { version = "^1.0.0", path = "../serde-sv2", optional = true }
serde = { version = "1.0.89", features = [
"derive",
"alloc",
], default-features = false, optional = true }
binary_codec_sv2 = { version = "^1.0.0", path = "../no-serde-sv2/codec", optional = true }
derive_codec_sv2 = { version = "^1.0.0", path = "../no-serde-sv2/derive_codec", optional = true }
tracing = { version = "0.1" }

[features]
default = ["core"]
Expand Down
4 changes: 2 additions & 2 deletions protocols/v2/binary-sv2/no-serde-sv2/codec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ repository = "https://github.com/stratum-mining/stratum"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
quickcheck = {version = "1.0.0", optional = true}
buffer_sv2 = { version = "^1.0.0", path = "../../../../../utils/buffer", optional=true}
quickcheck = { version = "1.0.0", optional = true }
buffer_sv2 = { version = "^1.0.0", path = "../../../../../utils/buffer", optional = true }

[features]
no_std = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/stratum-mining/stratum"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
binary_codec_sv2 = {version = "^1.0.0", path="../codec"}
binary_codec_sv2 = { version = "^1.0.0", path = "../codec" }

[lib]
proc-macro = true
8 changes: 5 additions & 3 deletions protocols/v2/binary-sv2/serde-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ description = "Serlializer and Deserializer for Stratum V2 data format"
license = "MIT"
repository = "https://github.com/stratum-mining/stratum"


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde = { version = "1.0.89", features = ["derive", "alloc"], default-features = false }
buffer_sv2 = {version = "^1.0.0", path = "../../../../utils/buffer"}
serde = { version = "1.0.89", features = [
"derive",
"alloc",
], default-features = false }
buffer_sv2 = { version = "^1.0.0", path = "../../../../utils/buffer" }
17 changes: 10 additions & 7 deletions protocols/v2/codec-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ repository = "https://github.com/stratum-mining/stratum"
[dependencies]
serde = { version = "1.0.89", default-features = false, optional = true }
framing_sv2 = { version = "1.1.0", path = "../../../protocols/v2/framing-sv2" }
noise_sv2 = { version = "1.0", path = "../../../protocols/v2/noise-sv2", optional=true}
noise_sv2 = { version = "1.0", path = "../../../protocols/v2/noise-sv2", optional = true }
binary_sv2 = { version = "1.0.0", path = "../../../protocols/v2/binary-sv2/binary-sv2" }
const_sv2 = { version = "1.0.0", path = "../../../protocols/v2/const-sv2"}
buffer_sv2 = { version = "1.0.0", path = "../../../utils/buffer"}
tracing = { version = "0.1"}


const_sv2 = { version = "1.0.0", path = "../../../protocols/v2/const-sv2" }
buffer_sv2 = { version = "1.0.0", path = "../../../utils/buffer" }
tracing = { version = "0.1" }

[features]
with_serde = ["binary_sv2/with_serde", "serde", "framing_sv2/with_serde", "buffer_sv2/with_serde"]
with_serde = [
"binary_sv2/with_serde",
"serde",
"framing_sv2/with_serde",
"buffer_sv2/with_serde",
]
with_buffer_pool = ["framing_sv2/with_buffer_pool"]
7 changes: 6 additions & 1 deletion protocols/v2/const-sv2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ repository = "https://github.com/stratum-mining/stratum"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
secp256k1 = { version = "0.28.2", default-features = false, features =["hashes", "alloc","rand","rand-std"] }
secp256k1 = { version = "0.28.2", default-features = false, features = [
"hashes",
"alloc",
"rand",
"rand-std",
] }

#[dev-dependencies]
#cbindgen = "0.16.0"
Loading
Loading