Skip to content

Commit 7f1957e

Browse files
committed
Merge remote-tracking branch 'origin/main' into fan-out-dep
2 parents e6a17ed + cc62cf8 commit 7f1957e

File tree

124 files changed

+2607
-2201
lines changed

Some content is hidden

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

124 files changed

+2607
-2201
lines changed

.github/workflows/create-release-announce.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,5 @@ jobs:
162162
repository: MystenLabs/sui-operations
163163
token: ${{ secrets.SUI_OPS_DISPATCH_TOKEN }}
164164
event-type: walrus-release-announce
165-
client-payload: '{"walrus_commit": "${{ needs.create-release.outputs.walrus_commit }}", "environment": "${{ inputs.network }}"}'
165+
client-payload: >
166+
{"walrus_commit": "${{ needs.create-release.outputs.walrus_commit }}", "environment": "${{ inputs.network }}"}

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
5454
- name: Install yamlfmt
5555
run: |
56-
url="https://github.com/google/yamlfmt/releases/download/v0.14.0/yamlfmt_0.14.0_Linux_x86_64.tar.gz"
56+
url="https://github.com/google/yamlfmt/releases/download/v0.17.0/yamlfmt_0.17.0_Linux_x86_64.tar.gz"
5757
curl -sSL "$url" | tar xvz yamlfmt
5858
- name: Check formatting of all YAML files
5959
run: ./yamlfmt -lint

.github/workflows/update-operators-cache.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
type: string
1515
default: 'bfH-ZqYV5faXTiq2-FVBT2cLQD61VYRuDje0cIkMWMo'
1616
schedule:
17-
- cron: '0 11 * * 1' # Every Monday at 11:00 UTC
17+
- cron: '0 11 * * 1' # Every Monday at 11:00 UTC
1818

1919
env:
2020
MAINNET_BLOB_ID: ${{ github.event.inputs.mainnet-blob-id || 'bfH-ZqYV5faXTiq2-FVBT2cLQD61VYRuDje0cIkMWMo' }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: editorconfig-checker
1515
alias: ec
1616
- repo: https://github.com/google/yamlfmt
17-
rev: v0.15.0
17+
rev: v0.17.0
1818
hooks:
1919
- id: yamlfmt
2020
- repo: https://github.com/notken12/licensesnip

.yamlfmt.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ formatter:
1010
scan_folded_as_literal: true
1111
max_line_length: 120
1212
drop_merge_tag: true
13+
disable_alias_key_correction: true

Cargo.lock

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

Cargo.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ proc-macro2 = "1.0.95"
8888
prometheus = "0.13.4"
8989
quote = "1.0"
9090
rand = "0.8.5"
91-
raptorq = "2.0.0"
9291
rayon = "1.10.0"
9392
rcgen = "0.13.2"
9493
reed-solomon-simd = "3.0.1"
@@ -154,9 +153,19 @@ walrus-utils = { path = "crates/walrus-utils" }
154153
x509-cert = "0.2.5"
155154

156155
[workspace.lints.rust]
156+
future_incompatible = "warn"
157157
missing_debug_implementations = "warn"
158158
missing_docs = "warn"
159-
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(msim)'] }
159+
nonstandard_style = "warn"
160+
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(msim)'], priority = 1 }
161+
unused = "warn"
162+
163+
[workspace.lints.clippy]
164+
cast_lossless = "warn"
165+
cast_possible_truncation = "warn"
166+
cast_possible_wrap = "warn"
167+
empty_structs_with_brackets = "warn"
168+
unwrap_used = "warn"
160169

161170
[profile.release]
162171
panic = 'abort'

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
allow-unwrap-in-tests = true

crates/checkpoint-downloader/src/downloader.rs

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,11 @@ impl ParallelCheckpointDownloaderInner {
230230
.send(WorkerMessage::Shutdown)
231231
.await?;
232232
let new_count = worker_count.fetch_sub(1, std::sync::atomic::Ordering::Relaxed);
233-
config.metrics.num_workers.set(new_count as i64);
233+
config.metrics.num_workers.set(
234+
new_count
235+
.try_into()
236+
.expect("new_count should always fit into a i64"),
237+
);
234238
}
235239
}
236240
std::cmp::Ordering::Less => {
@@ -249,7 +253,11 @@ impl ParallelCheckpointDownloaderInner {
249253
);
250254
*next_worker_id += 1;
251255
let new_count = worker_count.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
252-
config.metrics.num_workers.set(new_count as i64);
256+
config.metrics.num_workers.set(
257+
new_count
258+
.try_into()
259+
.expect("new_count should always fit into a i64"),
260+
);
253261
}
254262
}
255263
std::cmp::Ordering::Equal => {}
@@ -318,7 +326,9 @@ impl ParallelCheckpointDownloaderInner {
318326
};
319327

320328
consecutive_failures = 0;
321-
config.metrics.checkpoint_lag.set(lag as i64);
329+
config.metrics.checkpoint_lag.set(lag.try_into().expect(
330+
"lag should always fit into a i64"
331+
));
322332

323333
let current = worker_count.load(std::sync::atomic::Ordering::Relaxed);
324334
if lag > downloader_config.scale_up_lag_threshold &&
@@ -456,22 +466,20 @@ impl ParallelCheckpointDownloaderInner {
456466
};
457467

458468
loop {
459-
let result = client.get_full_checkpoint(sequence_number).await;
460-
let Ok(checkpoint) = result else {
461-
let err = result.unwrap_err();
462-
handle_checkpoint_error(&err, sequence_number);
469+
match client.get_full_checkpoint(sequence_number).await {
470+
Ok(checkpoint) => return CheckpointEntry::new(sequence_number, Ok(checkpoint)),
471+
Err(err) => {
472+
handle_checkpoint_error(&err, sequence_number);
473+
if let Some(delay) = backoff.next() {
474+
tokio::time::sleep(delay).await;
475+
continue;
476+
}
463477

464-
if let Some(delay) = backoff.next() {
465-
tokio::time::sleep(delay).await;
466-
continue;
478+
// Note that we only return error in test mode.
479+
assert!(cfg!(test));
480+
return CheckpointEntry::new(sequence_number, Err(err.into()));
467481
}
468-
469-
// Note that we only return error in test mode.
470-
assert!(cfg!(test));
471-
return CheckpointEntry::new(sequence_number, Err(err.into()));
472-
};
473-
474-
return CheckpointEntry::new(sequence_number, Ok(checkpoint));
482+
}
475483
}
476484
}
477485
}

crates/typed-store/src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
//! This crate provides functionality for storing and retrieving typed data in RocksDB,
66
//! with support for column families, batch operations, and metrics.
77
8-
#![warn(
9-
future_incompatible,
10-
nonstandard_style,
11-
rust_2018_idioms,
12-
rust_2021_compatibility,
13-
unused,
14-
missing_docs
8+
// TODO(WAL-869): Remove this attribute and fix corresponding warnings.
9+
#![allow(
10+
clippy::cast_possible_truncation,
11+
clippy::cast_possible_wrap,
12+
clippy::unwrap_used
1513
)]
14+
#![warn(rust_2018_idioms)]
1615

1716
/// Re-export rocksdb so that consumers can use the version of rocksdb via typed-store
1817
pub use rocksdb;

crates/typed-store/src/rocks.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,10 @@ impl<K, V> DBMap<K, V> {
928928
let mut num_keys = 0;
929929
let mut key_bytes_total = 0;
930930
let mut value_bytes_total = 0;
931-
let mut key_hist = hdrhistogram::Histogram::<u64>::new_with_max(100000, 2).unwrap();
932-
let mut value_hist = hdrhistogram::Histogram::<u64>::new_with_max(100000, 2).unwrap();
931+
let mut key_hist = hdrhistogram::Histogram::<u64>::new_with_max(100000, 2)
932+
.expect("the function parameters are valid");
933+
let mut value_hist = hdrhistogram::Histogram::<u64>::new_with_max(100000, 2)
934+
.expect("the function parameters are valid");
933935
for item in self.safe_iter() {
934936
let (key, value) = item?;
935937
num_keys += 1;
@@ -987,7 +989,8 @@ impl<K, V> DBMap<K, V> {
987989
)
988990
}
989991

990-
// Creates a RocksDB read option with specified lower and upper bounds.
992+
/// Creates a RocksDB read option with specified lower and upper bounds.
993+
///
991994
/// Lower bound is inclusive, and upper bound is exclusive.
992995
fn create_read_options_with_bounds(
993996
&self,

crates/walrus-core/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ edition.workspace = true
77
license.workspace = true
88

99
[features]
10-
default = ["rs2"]
11-
raptorq = []
12-
rs2 = []
1310
sui-types = ["dep:sui-types"]
1411
test-utils = ["walrus-test-utils"]
1512

@@ -21,7 +18,6 @@ fastcrypto.workspace = true
2118
hex.workspace = true
2219
p256 = { workspace = true, features = ["pem", "pkcs8"] }
2320
rand.workspace = true
24-
raptorq.workspace = true
2521
reed-solomon-simd.workspace = true
2622
serde.workspace = true
2723
serde_with.workspace = true

crates/walrus-core/benches/basic_encoding.rs

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// Copyright (c) Walrus Foundation
22
// SPDX-License-Identifier: Apache-2.0
33

4+
// Allowing `unwrap`s in benchmarks.
5+
#![allow(clippy::unwrap_used)]
6+
47
//! Benchmarks for the basic encoding and decoding.
58
69
use core::time::Duration;
710

811
use criterion::{AxisScale, BatchSize, BenchmarkId, Criterion, PlotConfiguration};
912
use fastcrypto::hash::Blake2b256;
10-
use raptorq::SourceBlockEncodingPlan;
1113
use walrus_core::{
12-
encoding::{Decoder as _, DecodingSymbol, Primary, RaptorQDecoder, RaptorQEncoder},
14+
encoding::{Decoder as _, DecodingSymbol, Primary, ReedSolomonDecoder, ReedSolomonEncoder},
1315
merkle::MerkleTree,
1416
};
1517
use walrus_test_utils::{random_data, random_subset};
1618

17-
// TODO (WAL-610): Support both encoding types.
18-
1919
const N_SHARDS: u16 = 1000;
2020
// Likely values for the number of source symbols for the primary and secondary encoding, which are
2121
// consistent with BFT.
@@ -31,8 +31,6 @@ fn basic_encoding(c: &mut Criterion) {
3131
group.plot_config(PlotConfiguration::default().summary_scale(AxisScale::Logarithmic));
3232

3333
for symbol_count in SYMBOL_COUNTS {
34-
let encoding_plan = SourceBlockEncodingPlan::generate(symbol_count);
35-
3634
for symbol_size in SYMBOL_SIZES {
3735
let data_length = usize::from(symbol_size) * usize::from(symbol_count);
3836
let data = random_data(data_length);
@@ -48,14 +46,13 @@ fn basic_encoding(c: &mut Criterion) {
4846
&(symbol_count, data),
4947
|b, (symbol_count, data)| {
5048
b.iter(|| {
51-
let encoder = RaptorQEncoder::new(
49+
let mut encoder = ReedSolomonEncoder::new(
5250
data,
5351
(*symbol_count).try_into().unwrap(),
5452
N_SHARDS.try_into().unwrap(),
55-
&encoding_plan,
5653
)
5754
.unwrap();
58-
let _encoded_symbols = encoder.encode_all().collect::<Vec<_>>();
55+
let _encoded_symbols = encoder.encode_all();
5956
});
6057
},
6158
);
@@ -70,25 +67,24 @@ fn basic_decoding(c: &mut Criterion) {
7067
group.plot_config(PlotConfiguration::default().summary_scale(AxisScale::Logarithmic));
7168

7269
for symbol_count in SYMBOL_COUNTS {
73-
let encoding_plan = SourceBlockEncodingPlan::generate(symbol_count);
7470
for symbol_size in SYMBOL_SIZES {
7571
let data_length = usize::from(symbol_size) * usize::from(symbol_count);
7672
let data = random_data(data_length);
7773
group.throughput(criterion::Throughput::Bytes(
7874
u64::try_from(data_length).unwrap(),
7975
));
80-
let encoder = RaptorQEncoder::new(
76+
let mut encoder = ReedSolomonEncoder::new(
8177
&data,
8278
symbol_count.try_into().unwrap(),
8379
N_SHARDS.try_into().unwrap(),
84-
&encoding_plan,
8580
)
8681
.unwrap();
8782
let symbols: Vec<_> = random_subset(
8883
encoder
8984
.encode_all()
85+
.into_iter()
9086
.enumerate()
91-
.map(|(i, s)| DecodingSymbol::<Primary>::new(i as u16, s)),
87+
.map(|(i, s)| DecodingSymbol::<Primary>::new(i.try_into().unwrap(), s)),
9288
usize::from(symbol_count) + 1,
9389
)
9490
.collect();
@@ -102,7 +98,7 @@ fn basic_decoding(c: &mut Criterion) {
10298
b.iter_batched(
10399
|| symbols.clone(),
104100
|symbols| {
105-
let mut decoder = RaptorQDecoder::new(
101+
let mut decoder = ReedSolomonDecoder::new(
106102
(*symbol_count).try_into().unwrap(),
107103
N_SHARDS.try_into().unwrap(),
108104
(*symbol_size).try_into().unwrap(),
@@ -190,18 +186,16 @@ fn merkle_tree(c: &mut Criterion) {
190186
group.plot_config(PlotConfiguration::default().summary_scale(AxisScale::Logarithmic));
191187

192188
for symbol_count in SYMBOL_COUNTS {
193-
let encoding_plan = SourceBlockEncodingPlan::generate(symbol_count);
194-
195189
for symbol_size in SYMBOL_SIZES {
196190
let data_length = usize::from(symbol_size) * usize::from(symbol_count);
197191
let data = random_data(data_length);
198-
let encoder = RaptorQEncoder::new(
192+
let encoded_symbols = ReedSolomonEncoder::new(
199193
&data,
200194
symbol_count.try_into().unwrap(),
201195
N_SHARDS.try_into().unwrap(),
202-
&encoding_plan,
203196
)
204-
.unwrap();
197+
.unwrap()
198+
.encode_all();
205199

206200
group.throughput(criterion::Throughput::Bytes(
207201
u64::try_from(data_length).unwrap(),
@@ -212,10 +206,9 @@ fn merkle_tree(c: &mut Criterion) {
212206
"symbol_count={},symbol_size={}",
213207
symbol_count, symbol_size
214208
)),
215-
&encoder,
216-
|b, encoder| {
209+
&encoded_symbols,
210+
|b, encoded_symbols| {
217211
b.iter(|| {
218-
let encoded_symbols = encoder.encode_all().collect::<Vec<_>>();
219212
let _tree = MerkleTree::<Blake2b256>::build(encoded_symbols);
220213
});
221214
},

crates/walrus-core/benches/blob_encoding.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
// Copyright (c) Walrus Foundation
22
// SPDX-License-Identifier: Apache-2.0
33

4+
// Allowing `unwrap`s in benchmarks.
5+
#![allow(clippy::unwrap_used)]
6+
47
//! Benchmarks for the blob encoding and decoding with and without authentication.
58
69
use core::{num::NonZeroU16, time::Duration};
710

811
use criterion::{AxisScale, BatchSize, BenchmarkId, Criterion, PlotConfiguration};
9-
use walrus_core::encoding::{EncodingConfigTrait as _, Primary, RaptorQEncodingConfig};
12+
use walrus_core::encoding::{EncodingConfigTrait as _, Primary, ReedSolomonEncodingConfig};
1013
use walrus_test_utils::{random_data, random_subset};
1114

12-
// TODO (WAL-610): Support both encoding types.
13-
1415
const N_SHARDS: u16 = 1000;
1516

1617
// The maximum symbol size is `u16::MAX`, which means a maximum blob size of ~13 GiB.
@@ -24,8 +25,8 @@ const BLOB_SIZES: [(u64, &str); 6] = [
2425
(1 << 30, "1GiB"),
2526
];
2627

27-
fn encoding_config() -> RaptorQEncodingConfig {
28-
RaptorQEncodingConfig::new(NonZeroU16::new(N_SHARDS).unwrap())
28+
fn encoding_config() -> ReedSolomonEncodingConfig {
29+
ReedSolomonEncodingConfig::new(NonZeroU16::new(N_SHARDS).unwrap())
2930
}
3031

3132
fn blob_encoding(c: &mut Criterion) {

crates/walrus-core/src/by_axis.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
//!
99
//! Additionally provides the [`by_axis::flat_map`][`flat_map`] macro that can be used to apply
1010
//! the same operation to the value stored in the primary or secondary variants of [`ByAxis`].
11+
12+
#[cfg(feature = "utoipa")]
1113
use alloc::{string::String, vec::Vec};
1214
use core::fmt::{self, Display};
1315

0 commit comments

Comments
 (0)