Skip to content

Commit 57fef3a

Browse files
authored
Merge pull request #323 from monadicus/chore/package-chores
Chore: package chores
2 parents c4cd20b + bf3addd commit 57fef3a

File tree

128 files changed

+570
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+570
-530
lines changed

.github/workflows/pr.yml

Lines changed: 91 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ env:
66
CARGO_TERM_COLOR: always
77
RUST_BACKTRACE: 1
88
# https://releases.rs/docs/1.83.0/ release date
9-
NIGHTLY_TOOLCHAIN: nightly-2024-11-28
9+
NIGHTLY_TOOLCHAIN: nightly-2025-02-20
1010

1111
# Cancel in progress workflows on pull_requests.
1212
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
@@ -15,46 +15,6 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
# TODO move to a release ci
19-
# build:
20-
# runs-on: ubuntu-latest
21-
22-
# steps:
23-
# - name: Checkout
24-
# uses: actions/checkout@v4
25-
# with:
26-
# path: snarkos-test
27-
28-
# - name: Checkout snarkOS
29-
# uses: actions/checkout@v4
30-
# with:
31-
# repository: AleoNet/snarkOS
32-
# path: snarkos
33-
34-
# - name: Checkout snarkVM
35-
# uses: actions/checkout@v4
36-
# with:
37-
# repository: AleoNet/snarkVM
38-
# path: snarkvm
39-
40-
# - name: Use mold linker
41-
# uses: rui314/setup-mold@v1
42-
43-
# - name: Install nightly and cranelift
44-
# uses: dtolnay/rust-toolchain@nightly
45-
# with:
46-
# toolchain: nightly
47-
# components: rustc-codegen-cranelift-preview
48-
49-
# - uses: Swatinem/rust-cache@v2
50-
# with:
51-
# key: cache-v1
52-
53-
# - name: Build
54-
# env:
55-
# RUSTFLAGS: -Zcodegen-backend=cranelift -Zbuild-std=std,panic_abort -Zbuild-std-features=panic_immediate_abort
56-
# run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} build --verbose
57-
5818
fmt:
5919
runs-on: ubuntu-latest
6020

@@ -71,12 +31,63 @@ jobs:
7131
- name: 📋 Format Check
7232
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} fmt -- --check
7333

74-
test:
34+
filter:
7535
runs-on: ubuntu-latest
76-
permissions: read-all
77-
# env:
78-
# RUSTFLAGS: -Zcodegen-backend=cranelift
36+
outputs:
37+
top_toml: ${{ steps.filter.outputs.top_toml }}
38+
aot: ${{ steps.filter.outputs.aot }}
39+
checkpoint: ${{ steps.filter.outputs.checkpoint }}
40+
common: ${{ steps.filter.outputs.common }}
41+
snops: ${{ steps.filter.outputs.snops }}
42+
agent: ${{ steps.filter.outputs.agent }}
43+
scli: ${{ steps.filter.outputs.scli }}
44+
steps:
45+
- uses: actions/checkout@v4
46+
- id: filter
47+
uses: dorny/paths-filter@v3
48+
with:
49+
base: ${{ github.ref_name }}
50+
filters: |
51+
top_toml:
52+
- 'Cargo.toml'
53+
aot:
54+
- 'crates/aot/**/*'
55+
checkpoint:
56+
- 'crates/checkpoint/**/*'
57+
snops:
58+
- 'crates/controlplane/**/*'
59+
agent:
60+
- 'crates/agent/**/*'
61+
scli:
62+
- 'crates/cli/**/*'
63+
common:
64+
- 'crates/common/**/*'
7965
66+
crate-checks:
67+
runs-on: ubuntu-latest
68+
needs: [filter]
69+
env:
70+
TOP_TOML: ${{ needs.filter.outputs.top_toml }}
71+
AOT: ${{ needs.filter.outputs.aot }}
72+
CHECKPOINT: ${{ needs.filter.outputs.checkpoint }}
73+
COMMON: ${{ needs.filter.outputs.common }}
74+
SNOPS: ${{ needs.filter.outputs.snops }}
75+
AGENT: ${{ needs.filter.outputs.agent }}
76+
SCLI: ${{ needs.filter.outputs.scli }}
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
crate:
81+
- { name: "aot", package: "snarkos-aot", dir: "crates/aot" }
82+
- {
83+
name: "checkpoint",
84+
package: "snops-checkpoint",
85+
dir: "crates/checkpoint",
86+
}
87+
- { name: "common", package: "snops-common", dir: "crates/common" }
88+
- { name: "snops", package: "snops", dir: "crates/controlplane" }
89+
- { name: "agent", package: "snops-agent", dir: "crates/agent" }
90+
- { name: "snops-cli", package: "snops-cli", dir: "crates/cli" }
8091
steps:
8192
- name: 📥 Checkout
8293
uses: actions/checkout@v4
@@ -99,74 +110,42 @@ jobs:
99110
- name: ☁️ Install Nextest
100111
uses: taiki-e/install-action@nextest
101112

102-
# - name: ☁️ Install cargo-machete
103-
# run: cargo install cargo-machete
113+
- name: ☁️ Install cargo-machete
114+
uses: taiki-e/install-action@cargo-machete
104115

105-
# - name: 📋 Clippy Check
106-
# env:
107-
# RUSTFLAGS: -Zcodegen-backend=cranelift
108-
# run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} clippy --all --all-targets -- -D warnings
116+
- name: ☁️ Install cargo-binstall
117+
uses: taiki-e/install-action@cargo-binstall
109118

110-
# - name: 📋 Check Unused Deps
111-
# if: always()
112-
# env:
113-
# RUSTFLAGS: -Zcodegen-backend=cranelift
114-
# run: cargo machete
119+
- name: ☁️ Install cargo-msrv
120+
run: cargo binstall --version 0.18.1 --no-confirm cargo-msrv --force
115121

116-
- uses: dorny/paths-filter@v3
117-
id: changes
118-
with:
119-
base: ${{ github.ref_name }}
120-
filters: |
121-
top_toml:
122-
- 'Cargo.toml'
123-
aot:
124-
- 'crates/aot/**/*'
125-
checkpoint:
126-
- 'crates/checkpoint/**/*'
127-
control_plane:
128-
- 'crates/controlplane/**/*'
129-
agent:
130-
- 'crates/agent/**/*'
131-
scli:
132-
- 'crates/cli/**/*'
133-
common:
134-
- 'crates/common/**/*'
122+
- name: ☁️ Install cargo-hack
123+
uses: taiki-e/install-action@cargo-hack
124+
125+
- name: ☁️ Install cargo-minimal-versions
126+
uses: taiki-e/install-action@cargo-minimal-versions
127+
128+
- name: 🧪 Test ${{ matrix.crate.name }}
129+
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
130+
env:
131+
RUSTFLAGS: ${{ (matrix.crate.name == 'aot' || matrix.crate.name == 'checkpoint' || matrix.crate.name == 'common' || matrix.crate.name == 'snops') && '-Zcodegen-backend=cranelift' || '' }}
132+
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p ${{ matrix.crate.package }} --verbose --fail-fast --all-features --no-tests=warn
133+
134+
- name: 🚯 Unused Deps ${{ matrix.crate.name }}
135+
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
136+
run: cd ${{ matrix.crate.dir }} && cargo +${{ env.NIGHTLY_TOOLCHAIN }} machete
137+
138+
- name: 🦀 MSRV ${{ matrix.crate.name }}
139+
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
140+
run: cargo msrv --manifest-path ${{ matrix.crate.dir }}/Cargo.toml verify --output-format minimal
141+
142+
- name: 🕵️ Minimal Versions ${{ matrix.crate.name }}
143+
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
144+
continue-on-error: true
145+
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} minimal-versions check -p ${{ matrix.crate.package }}
135146

136-
- name: 🧪 Test All
137-
if: steps.changes.outputs.top_toml == 'true'
138-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run --all --verbose --fail-fast --all-features --exclude snops-agent --exclude xtask --no-tests=warn
139-
140-
- name: 🧪 Test Aot
141-
if: steps.changes.outputs.aot == 'true' && steps.changes.outputs.top_toml == 'false'
142-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p snarkos-aot --verbose --fail-fast --all-features --no-tests=warn
143-
144-
- name: 🧪 Test Checkpoint
145-
# env:
146-
# RUSTFLAGS: -Zcodegen-backend=cranelift
147-
if: steps.changes.outputs.checkpoint == 'true' && steps.changes.outputs.top_toml == 'false'
148-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p snops-checkpoint --verbose --fail-fast --all-features --no-tests=warn
149-
150-
- name: 🧪 Test Common
151-
# env:
152-
# RUSTFLAGS: -Zcodegen-backend=cranelift
153-
if: steps.changes.outputs.common == 'true' && steps.changes.outputs.top_toml == 'false'
154-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p snops-common --verbose --fail-fast --all-features --no-tests=warn
155-
156-
- name: 🧪 Test Control Plane
157-
# env:
158-
# RUSTFLAGS: -Zcodegen-backend=cranelift
159-
if: (steps.changes.outputs.control_plane == 'true' || steps.changes.outputs.common == 'true') && steps.changes.outputs.top_toml == 'false'
160-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p snops --verbose --fail-fast --all-features --no-tests=warn
161-
162-
- name: 🧪 Test Agent
163-
# env:
164-
# RUSTFLAGS: ""
165-
if: (steps.changes.outputs.agent == 'true' || steps.changes.outputs.common == 'true')
166-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p snops-agent --verbose --fail-fast --all-features --no-tests=warn
167-
168-
- name: 🧪 Test Scli
169-
# env:
170-
# RUSTFLAGS: -Zcodegen-backend=cranelift
171-
if: (steps.changes.outputs.scli == 'true' || steps.changes.outputs.common == 'true') && steps.changes.outputs.top_toml == 'false'
172-
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} nextest run -p snops-cli --verbose --fail-fast --all-features --no-tests=warn
147+
- name: 📋 Clippy ${{ matrix.crate.name }}
148+
if: always() && ${{ env.TOP_TOML == 'true' || (matrix.crate.name == 'aot' && env.AOT == 'true') || (matrix.crate.name == 'checkpoint' && env.CHECKPOINT == 'true') || (matrix.crate.name == 'common' && env.COMMON == 'true') || (matrix.crate.name == 'snops' && env.CONTROL_PLANE == 'true') || (matrix.crate.name == 'agent' && env.AGENT == 'true') || (matrix.crate.name == 'scli' && env.SCLI == 'true') }}
149+
env:
150+
RUSTFLAGS: ${{ (matrix.crate.name == 'aot' || matrix.crate.name == 'checkpoint' || matrix.crate.name == 'common' || matrix.crate.name == 'snops') && '-Zcodegen-backend=cranelift' || '' }}
151+
run: cargo +${{ env.NIGHTLY_TOOLCHAIN }} clippy -p ${{ matrix.crate.package }} --all-targets --locked -- -D warnings

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ members = [
1010
]
1111
resolver = "2"
1212

13+
[workspace.package]
14+
authors = []
15+
edition = "2024"
16+
homepage = "https://github.com/monadicus/snarkops"
17+
license = "MIT"
18+
rust-version = "1.85.0"
19+
1320
[profile.dev]
1421
codegen-units = 512
1522
opt-level = 1

crates/agent/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[package]
22
name = "snops-agent"
33
version = "0.2.0"
4-
edition = "2021"
5-
license = "MIT"
4+
65
description = "A snarkops agent for communicating with snarkos nodes and the control plane"
6+
authors.workspace = true
7+
edition.workspace = true
8+
homepage.workspace = true
9+
license.workspace = true
10+
rust-version.workspace = true
711

812
[features]
913
default = []

crates/agent/src/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use http::{HeaderValue, StatusCode, Uri};
88
use snops_common::{
99
constant::{ENV_AGENT_KEY, HEADER_AGENT_KEY},
1010
rpc::{
11-
control::{agent::AgentService, ControlServiceClient, PING_HEADER},
12-
RpcTransport, PING_INTERVAL_SEC, PING_LENGTH,
11+
PING_INTERVAL_SEC, PING_LENGTH, RpcTransport,
12+
control::{ControlServiceClient, PING_HEADER, agent::AgentService},
1313
},
1414
};
1515
use tarpc::server::Channel;
@@ -56,7 +56,7 @@ pub async fn ws_connection(ws_req: Request, state: Arc<GlobalState>) {
5656
// Ignore connection refused errors, we only care if something interesting is
5757
// causing the connection to fail.
5858
tungstenite::Error::Io(e) if e.kind() == std::io::ErrorKind::ConnectionRefused => {
59-
return
59+
return;
6060
}
6161
// Shutdown the agent if the control plane requires an upgrade
6262
tungstenite::Error::Http(e) if e.status() == StatusCode::UPGRADE_REQUIRED => {

crates/agent/src/db.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use indexmap::IndexMap;
99
use snops_common::{
1010
api::AgentEnvInfo,
1111
db::{
12+
Database as DatabaseTrait,
1213
error::DatabaseError,
1314
tree::{DbRecords, DbTree},
14-
Database as DatabaseTrait,
1515
},
1616
format::{DataFormat, DataReadError, DataWriteError, PackedUint},
1717
state::{AgentId, AgentState, EnvId, HeightRequest},
@@ -123,9 +123,7 @@ impl Database {
123123
}
124124

125125
pub fn env_info(&self) -> Result<Option<(EnvId, Arc<AgentEnvInfo>)>, DatabaseError> {
126-
self.documents
127-
.restore(&AgentDbString::EnvInfo)
128-
.map_err(DatabaseError::from)
126+
self.documents.restore(&AgentDbString::EnvInfo)
129127
}
130128

131129
pub fn set_env_info(

crates/agent/src/log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use tracing::level_filters::LevelFilter;
22
use tracing_appender::non_blocking::WorkerGuard;
3-
use tracing_subscriber::{layer::SubscriberExt, reload, util::SubscriberInitExt, EnvFilter};
3+
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, reload, util::SubscriberInitExt};
44

55
pub type ReloadHandler = reload::Handle<EnvFilter, tracing_subscriber::Registry>;
66

crates/agent/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use reconcile::agent::{AgentStateReconciler, AgentStateReconcilerContext};
2424
use snops_common::{db::Database, util::OpaqueDebug};
2525
use tokio::{
2626
select,
27-
signal::unix::{signal, Signal, SignalKind},
28-
sync::{mpsc, RwLock},
27+
signal::unix::{Signal, SignalKind, signal},
28+
sync::{RwLock, mpsc},
2929
};
3030
use tracing::{error, info};
3131

crates/agent/src/metrics/tps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use simple_moving_average::{SingleSumSMA, SMA};
1+
use simple_moving_average::{SMA, SingleSumSMA};
22

33
use super::*;
44

crates/agent/src/reconcile/address.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ impl Reconcile<(), ReconcileError> for AddressResolveReconciler {
4747
}
4848

4949
let Some(client) = state.client.read().await.clone() else {
50-
warn!("Agent state contains {} addresses that need to be resolved, but client is not connected", unresolved_addrs.len());
50+
warn!(
51+
"Agent state contains {} addresses that need to be resolved, but client is not connected",
52+
unresolved_addrs.len()
53+
);
5154

5255
// Client is offline so new addrs cannot be requested
5356
return Ok(ReconcileStatus::default());

0 commit comments

Comments
 (0)