Skip to content

Commit 67f39b7

Browse files
Merge branch 'next' into santiagopittella-merge-main-to-next
2 parents eb0131c + 871cec9 commit 67f39b7

114 files changed

Lines changed: 2628 additions & 553 deletions

File tree

Some content is hidden

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

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[alias]
2+
xtask = "run --locked --package xtask --"
3+
14
[target.wasm32-unknown-unknown]
25
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']
36

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,15 @@ jobs:
258258
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
259259
with:
260260
persist-credentials: false
261+
- name: Rustup
262+
run: rustup toolchain install --no-self-update
261263
- name: Rustup +nightly
262264
run: rustup toolchain install --no-self-update nightly --component rustfmt
265+
- uses: WarpBuilds/rust-cache@9d0cc3090d9c87de74ea67617b246e978735b1a1 # v2.9.1
266+
with:
267+
shared-key: ${{ github.job }}
268+
prefix-key: ${{ env.CACHE_PREFIX }}
269+
save-if: ${{ env.SAVE_CACHE }}
263270
- name: Fmt
264271
run: make format-check
265272

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ members = [
1919
"crates/test-macro",
2020
"crates/utils",
2121
"proto",
22+
"xtask",
2223
]
2324

2425
resolver = "2"
@@ -108,8 +109,10 @@ rand_chacha = { default-features = false, version = "0.9" }
108109
rayon = { version = "1.10" }
109110
reqwest = { version = "0.13" }
110111
rstest = { version = "0.26" }
112+
rusqlite = { features = ["bundled"], version = "0.37" }
111113
serde = { features = ["derive"], version = "1" }
112114
serial_test = { version = "3.2" }
115+
sha2 = { version = "0.10" }
113116
syn = { version = "2.0" }
114117
tempfile = { version = "3.12" }
115118
thiserror = { default-features = false, version = "2.0" }

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ fix: ## Runs Fix with configs
2626

2727

2828
.PHONY: format
29-
format: ## Runs Format using nightly toolchain
29+
format: ## Runs rustfmt and comment reflow
30+
cargo xtask fmt-comments --write
3031
cargo +nightly fmt --all
3132

3233

3334
.PHONY: format-check
34-
format-check: ## Runs Format using nightly toolchain but only in check mode
35+
format-check: ## Checks rustfmt and comment reflow
36+
cargo xtask fmt-comments --check
3537
cargo +nightly fmt --all --check
3638

3739

bin/genesis/src/main.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ use rand::Rng;
2323
use rand_chacha::ChaCha20Rng;
2424
use rand_chacha::rand_core::SeedableRng;
2525

26-
/// Generate canonical Miden genesis accounts (bridge, bridge admin, GER manager)
27-
/// and a genesis.toml configuration file.
26+
/// Generate canonical Miden genesis accounts (bridge, bridge admin, GER manager) and a genesis.toml
27+
/// configuration file.
2828
#[derive(Parser)]
2929
#[command(name = "miden-genesis")]
3030
struct Cli {
3131
/// Output directory for generated files.
3232
#[arg(long, default_value = "./genesis")]
3333
output_dir: PathBuf,
3434

35-
/// Hex-encoded Falcon512 public key for the bridge admin account.
36-
/// If omitted, a new keypair is generated and the secret key is included in the .mac file.
35+
/// Hex-encoded Falcon512 public key for the bridge admin account. If omitted, a new keypair is
36+
/// generated and the secret key is included in the .mac file.
3737
#[arg(long, value_name = "HEX", requires = "ger_manager_public_key")]
3838
bridge_admin_public_key: Option<String>,
3939

40-
/// Hex-encoded Falcon512 public key for the GER manager account.
41-
/// If omitted, a new keypair is generated and the secret key is included in the .mac file.
40+
/// Hex-encoded Falcon512 public key for the GER manager account. If omitted, a new keypair is
41+
/// generated and the secret key is included in the .mac file.
4242
#[arg(long, value_name = "HEX", requires = "bridge_admin_public_key")]
4343
ger_manager_public_key: Option<String>,
4444
}
@@ -97,9 +97,8 @@ fn run(
9797
let bridge_seed = Word::from(bridge_seed.map(Felt::new));
9898
let bridge = create_bridge_account(bridge_seed, bridge_admin_id, ger_manager_id);
9999

100-
// Bump bridge nonce to 1 (required for genesis accounts).
101-
// File-loaded accounts via [[account]] in genesis.toml are included as-is,
102-
// so we must set nonce=1 before writing the .mac file.
100+
// Bump bridge nonce to 1 (required for genesis accounts). File-loaded accounts via [[account]]
101+
// in genesis.toml are included as-is, so we must set nonce=1 before writing the .mac file.
103102
let bridge = bump_nonce_to_one(bridge).context("failed to bump bridge account nonce")?;
104103

105104
// Write .mac files.
@@ -203,8 +202,8 @@ mod tests {
203202

204203
use super::*;
205204

206-
/// Parses the generated genesis.toml, builds a genesis block, and asserts the bridge account
207-
/// is included with nonce=1.
205+
/// Parses the generated genesis.toml, builds a genesis block, and asserts the bridge account is
206+
/// included with nonce=1.
208207
fn assert_valid_genesis_block(dir: &Path) {
209208
let bridge_id = AccountFile::read(dir.join("bridge.mac")).unwrap().account.id();
210209

bin/network-monitor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ rand_chacha = { workspace = true }
3232
reqwest = { features = ["json", "query"], workspace = true }
3333
serde = { workspace = true }
3434
serde_json = { version = "1.0" }
35-
sha2 = { version = "0.10" }
35+
sha2 = { workspace = true }
3636
time = { features = ["formatting", "macros"], version = "0.3" }
3737
tokio = { features = ["full"], workspace = true }
3838
tonic = { features = ["codegen", "tls-native-roots", "transport"], workspace = true }

bin/network-monitor/src/counter.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ impl IncrementService {
156156
})
157157
}
158158

159-
/// Applies a successful increment: updates the wallet nonce, bumps counters, and returns
160-
/// the next expected counter value.
159+
/// Applies a successful increment: updates the wallet nonce, bumps counters, and returns the
160+
/// next expected counter value.
161161
fn handle_increment_success(&mut self, final_account: &AccountHeader, tx_id: String) -> u64 {
162162
let updated_wallet = Account::new(
163163
self.tx.wallet_account.id(),
@@ -407,9 +407,9 @@ impl CounterTrackingService {
407407
})
408408
}
409409

410-
/// The increment service regenerates accounts on persistent failure and rewrites the
411-
/// counter account file. If the file's account ID has changed, switch to the new account
412-
/// and reset tracking state.
410+
/// The increment service regenerates accounts on persistent failure and rewrites the counter
411+
/// account file. If the file's account ID has changed, switch to the new account and reset
412+
/// tracking state.
413413
async fn reload_counter_account_if_changed(&mut self) {
414414
let reloaded = match load_counter_account(&self.config.counter_filepath) {
415415
Ok(account) => account,
@@ -523,8 +523,8 @@ impl Service for CounterTrackingService {
523523
}
524524

525525
fn interval(&self) -> Duration {
526-
// Tracking polls twice per increment cadence so it catches freshly-incremented values
527-
// soon after submission.
526+
// Tracking polls twice per increment cadence so it catches freshly-incremented values soon
527+
// after submission.
528528
self.config.counter_increment_interval / 2
529529
}
530530

@@ -542,8 +542,8 @@ impl Service for CounterTrackingService {
542542
// SETUP
543543
// ================================================================================================
544544

545-
/// Load wallet + counter accounts, fetch the genesis block header, and build the data store
546-
/// and increment script needed to produce network notes.
545+
/// Load wallet + counter accounts, fetch the genesis block header, and build the data store and
546+
/// increment script needed to produce network notes.
547547
async fn setup_increment_task(
548548
config: MonitorConfig,
549549
rpc_client: &mut RpcClient,

bin/network-monitor/src/deploy/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ use crate::deploy::wallet::{create_wallet_account, save_wallet_account};
3838
pub mod counter;
3939
pub mod wallet;
4040

41-
/// Create an RPC client configured with the correct genesis metadata in the
42-
/// `Accept` header so that write RPCs such as `SubmitProvenTx` are
43-
/// accepted by the node.
41+
/// Create an RPC client configured with the correct genesis metadata in the `Accept` header so that
42+
/// write RPCs such as `SubmitProvenTx` are accepted by the node.
4443
pub async fn create_genesis_aware_rpc_client(
4544
rpc_url: &Url,
4645
timeout: Duration,
4746
) -> Result<RpcClient> {
48-
// First, create a temporary client without genesis metadata to discover the
49-
// genesis block header and its commitment.
47+
// First, create a temporary client without genesis metadata to discover the genesis block
48+
// header and its commitment.
5049
let mut rpc: RpcClient = Builder::new(rpc_url.clone())
5150
.with_tls()
5251
.context("Failed to configure TLS for RPC client")?
@@ -78,8 +77,8 @@ pub async fn create_genesis_aware_rpc_client(
7877
let genesis_commitment = genesis_header.commitment();
7978
let genesis = genesis_commitment.to_hex();
8079

81-
// Rebuild the client, this time including the required genesis metadata so that
82-
// write RPCs like SubmitProvenTx are accepted by the node.
80+
// Rebuild the client, this time including the required genesis metadata so that write RPCs like
81+
// SubmitProvenTx are accepted by the node.
8382
let rpc_client = Builder::new(rpc_url.clone())
8483
.with_tls()
8584
.context("Failed to configure TLS for RPC client")?

bin/network-monitor/src/explorer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ mod tests {
244244

245245
#[test]
246246
fn truncate_json_multibyte_chars_are_handled() {
247-
// Each 'é' is 2 bytes in UTF-8. Build a string whose serialized JSON form
248-
// exceeds 60 characters, ensuring truncation lands on a char boundary.
247+
// Each 'é' is 2 bytes in UTF-8. Build a string whose serialized JSON form exceeds 60
248+
// characters, ensuring truncation lands on a char boundary.
249249
let multibyte_string = "é".repeat(80);
250250
let value = json!(multibyte_string);
251251
// Should not panic and should still truncate correctly.
@@ -255,8 +255,8 @@ mod tests {
255255

256256
#[test]
257257
fn truncate_json_exactly_60_chars_is_not_truncated() {
258-
// Build a JSON string whose serialized form is exactly 60 characters.
259-
// json!("x".repeat(58)) serializes as `"xxx...xxx"` (58 chars + 2 quotes = 60).
258+
// Build a JSON string whose serialized form is exactly 60 characters. json!("x".repeat(58))
259+
// serializes as `"xxx...xxx"` (58 chars + 2 quotes = 60).
260260
let value = json!("x".repeat(58));
261261
let result = truncate_json(&value);
262262
assert_eq!(result.chars().count(), 60);

0 commit comments

Comments
 (0)