Skip to content

Commit afbcf9e

Browse files
saefstroembiryukovmaximmichaelsutton
authored
Change directory back to repo root & Fix Rust v1.81 lints (#545)
* Change directory back to repodir Change directory back to repodir after building toolchain * Clippy * Update crypto/txscript/src/caches.rs Co-authored-by: Maxim <59533214+biryukovmaxim@users.noreply.github.com> * Update crypto/txscript/src/caches.rs * rename `is_none_or` -> `is_none_or_ex` to avoid conflict with future std * remove `use std::mem::size_of` wherever possible (added to std prelude recently) --------- Co-authored-by: Maxim <59533214+biryukovmaxim@users.noreply.github.com> Co-authored-by: Michael Sutton <msutton@cs.huji.ac.il>
1 parent 06a874f commit afbcf9e

File tree

26 files changed

+31
-43
lines changed

26 files changed

+31
-43
lines changed

.github/workflows/deploy.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ jobs:
5555
run: |
5656
# Run build script for musl toolchain
5757
source musl-toolchain/build.sh
58-
58+
59+
# Go back to the workspace
60+
cd $GITHUB_WORKSPACE
61+
5962
# Build for musl
6063
cargo --verbose build --bin kaspad --bin rothschild --bin kaspa-wallet --release --target x86_64-unknown-linux-musl
6164
mkdir bin || true

consensus/core/src/utxo/utxo_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::{
55
use crate::tx::{TransactionOutpoint, UtxoEntry, VerifiableTransaction};
66
use kaspa_utils::mem_size::MemSizeEstimator;
77
use serde::{Deserialize, Serialize};
8-
use std::{collections::hash_map::Entry::Vacant, mem::size_of};
8+
use std::collections::hash_map::Entry::Vacant;
99

1010
pub trait ImmutableUtxoDiff {
1111
fn added(&self) -> &UtxoCollection;

consensus/src/consensus/storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use kaspa_consensus_core::{blockstatus::BlockStatus, BlockHashSet};
3131
use kaspa_database::registry::DatabaseStorePrefixes;
3232
use kaspa_hashes::Hash;
3333
use parking_lot::RwLock;
34-
use std::{mem::size_of, ops::DerefMut, sync::Arc};
34+
use std::{ops::DerefMut, sync::Arc};
3535

3636
pub struct ConsensusStorage {
3737
// DB

consensus/src/model/stores/acceptance_data.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use kaspa_utils::mem_size::MemSizeEstimator;
1212
use rocksdb::WriteBatch;
1313
use serde::Deserialize;
1414
use serde::Serialize;
15-
use std::mem::size_of;
1615
use std::sync::Arc;
1716

1817
pub trait AcceptanceDataStoreReader {

consensus/src/model/stores/block_transactions.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use kaspa_hashes::Hash;
99
use kaspa_utils::mem_size::MemSizeEstimator;
1010
use rocksdb::WriteBatch;
1111
use serde::{Deserialize, Serialize};
12-
use std::mem::size_of;
1312
use std::sync::Arc;
1413

1514
pub trait BlockTransactionsStoreReader {

consensus/src/model/stores/ghostdag.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use kaspa_utils::mem_size::MemSizeEstimator;
1414
use rocksdb::WriteBatch;
1515
use serde::{Deserialize, Serialize};
1616
use std::iter::once;
17-
use std::mem::size_of;
1817
use std::{cell::RefCell, sync::Arc};
1918

2019
/// Re-export for convenience

consensus/src/model/stores/headers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::mem::size_of;
21
use std::sync::Arc;
32

43
use kaspa_consensus_core::{header::Header, BlockHasher, BlockLevel};

consensus/src/model/stores/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ pub mod block_transactions;
33
pub mod block_window_cache;
44
pub mod children;
55
pub mod daa;
6-
pub mod selected_chain;
7-
use std::{fmt::Display, mem::size_of};
8-
9-
pub use kaspa_database;
106
pub mod depth;
117
pub mod ghostdag;
128
pub mod headers;
@@ -16,14 +12,17 @@ pub mod pruning;
1612
pub mod pruning_utxoset;
1713
pub mod reachability;
1814
pub mod relations;
15+
pub mod selected_chain;
1916
pub mod statuses;
2017
pub mod tips;
2118
pub mod utxo_diffs;
2219
pub mod utxo_multisets;
2320
pub mod utxo_set;
2421
pub mod virtual_state;
2522

23+
pub use kaspa_database;
2624
pub use kaspa_database::prelude::DB;
25+
use std::fmt::Display;
2726

2827
#[derive(PartialEq, Eq, Clone, Copy, Hash)]
2928
pub(crate) struct U64Key([u8; size_of::<u64>()]);

consensus/src/model/stores/utxo_set.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub trait UtxoSetStore: UtxoSetStoreReader {
2828
fn write_many(&mut self, utxos: &[(TransactionOutpoint, UtxoEntry)]) -> Result<(), StoreError>;
2929
}
3030

31-
pub const UTXO_KEY_SIZE: usize = kaspa_hashes::HASH_SIZE + std::mem::size_of::<TransactionIndexType>();
31+
pub const UTXO_KEY_SIZE: usize = kaspa_hashes::HASH_SIZE + size_of::<TransactionIndexType>();
3232

3333
#[derive(Eq, Hash, PartialEq, Debug, Copy, Clone)]
3434
struct UtxoKey([u8; UTXO_KEY_SIZE]);
@@ -81,8 +81,7 @@ impl From<UtxoKey> for TransactionOutpoint {
8181
fn from(k: UtxoKey) -> Self {
8282
let transaction_id = Hash::from_slice(&k.0[..kaspa_hashes::HASH_SIZE]);
8383
let index = TransactionIndexType::from_le_bytes(
84-
<[u8; std::mem::size_of::<TransactionIndexType>()]>::try_from(&k.0[kaspa_hashes::HASH_SIZE..])
85-
.expect("expecting index size"),
84+
<[u8; size_of::<TransactionIndexType>()]>::try_from(&k.0[kaspa_hashes::HASH_SIZE..]).expect("expecting index size"),
8685
);
8786
Self::new(transaction_id, index)
8887
}

consensus/src/pipeline/body_processor/body_validation_in_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl BlockBodyProcessor {
3737
.copied()
3838
.filter(|parent| {
3939
let status_option = statuses_read_guard.get(*parent).unwrap_option();
40-
status_option.is_none_or(|s| !s.has_block_body())
40+
status_option.is_none_or_ex(|s| !s.has_block_body())
4141
})
4242
.collect();
4343
if !missing.is_empty() {

0 commit comments

Comments
 (0)