Skip to content

Commit

Permalink
Simplify hashing in shuffling (#6483)
Browse files Browse the repository at this point in the history
* Simplify hashing in shuffling

* Fix benchmark deps

* Check benchmarks when linting
  • Loading branch information
michaelsproul authored Oct 14, 2024
1 parent 17711b7 commit 2e440df
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ resolver = "2"
edition = "2021"

[workspace.dependencies]
alloy-primitives = "0.8"
alloy-primitives = { version = "0.8", features = ["rlp", "getrandom"] }
alloy-rlp = "0.3.4"
alloy-consensus = "0.3.0"
anyhow = "1"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ test-full: cargo-fmt test-release test-debug test-ef test-exec-engine
# Lints the code for bad style and potentially unsafe arithmetic using Clippy.
# Clippy lints are opt-in per-crate for now. By default, everything is allowed except for performance and correctness lints.
lint:
cargo clippy --workspace --tests $(EXTRA_CLIPPY_OPTS) --features "$(TEST_FEATURES)" -- \
cargo clippy --workspace --benches --tests $(EXTRA_CLIPPY_OPTS) --features "$(TEST_FEATURES)" -- \
-D clippy::fn_to_numeric_cast_any \
-D clippy::manual_let_else \
-D clippy::large_stack_frames \
Expand Down
1 change: 0 additions & 1 deletion consensus/swap_or_not_shuffle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ fixed_bytes = { workspace = true }

[features]
arbitrary = ["alloy-primitives/arbitrary"]
getrandom = ["alloy-primitives/getrandom"]
2 changes: 1 addition & 1 deletion consensus/swap_or_not_shuffle/src/shuffle_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Buf {

/// Hash the entire buffer.
fn hash(&self) -> Hash256 {
Hash256::from_slice(&hash_fixed(&self.0))
Hash256::from(hash_fixed(&self.0))
}
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ name = "benches"
harness = false

[dependencies]
alloy-primitives = { workspace = true, features = ["rlp", "getrandom"] }
alloy-primitives = { workspace = true }
merkle_proof = { workspace = true }
bls = { workspace = true, features = ["arbitrary"] }
kzg = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion consensus/types/benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn all_benches(c: &mut Criterion) {
|| (bytes.clone(), spec.clone()),
|(bytes, spec)| {
let state: BeaconState<MainnetEthSpec> =
BeaconState::from_ssz_bytes(&bytes, &spec).expect("should decode");
BeaconState::from_ssz_bytes(bytes, spec).expect("should decode");
black_box(state)
},
BatchSize::SmallInput,
Expand Down
4 changes: 2 additions & 2 deletions crypto/kzg/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub fn bench_init_context(c: &mut Criterion) {
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
.expect("should have trusted setup");

c.bench_function(&format!("Initialize context rust_eth_kzg"), |b| {
c.bench_function("Initialize context rust_eth_kzg", |b| {
b.iter(|| {
let trusted_setup = PeerDASTrustedSetup::from(&trusted_setup);
DASContext::new(
Expand All @@ -19,7 +19,7 @@ pub fn bench_init_context(c: &mut Criterion) {
)
})
});
c.bench_function(&format!("Initialize context c-kzg (4844)"), |b| {
c.bench_function("Initialize context c-kzg (4844)", |b| {
b.iter(|| {
let trusted_setup: TrustedSetup =
serde_json::from_reader(get_trusted_setup().as_slice())
Expand Down

0 comments on commit 2e440df

Please sign in to comment.