Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
2e73d0a
all: Run 'cargo clippy --fix'
lutter Jan 8, 2026
816cc91
all: Fix warnings from clippy::from_str_radix_10
lutter Jan 8, 2026
c48cd35
all: Fix warnings from clippy::bind_instead_of_map
lutter Jan 8, 2026
bf7c33e
all: Fix warnings from clippy::box_collection
lutter Jan 8, 2026
e51a5dc
all: Fix warnings from clippy::cloned_ref_to_slice_refs
lutter Jan 8, 2026
613fbd2
all: Fix warnings from clippy::collapsible_match
lutter Jan 8, 2026
5f5daa1
all: Fix warnings from clippy::derivable_impls
lutter Jan 8, 2026
7680b60
all: Fix warnings from clippy::doc_lazy_continuation
lutter Jan 8, 2026
6bda834
all: Fix warnings from clippy::doc_overindented_list_items
lutter Jan 8, 2026
6ee0ea8
all: Fix warnings from clippy::empty_line_after_doc_comments
lutter Jan 8, 2026
8a0ccfb
all: Fix warnings from clippy::enum_variant_names
lutter Jan 8, 2026
e622c3a
all: Fix warnings from clippy::explicit_counter_loop
lutter Jan 8, 2026
bc06863
all: Fix warnings from clippy::explicit_write
lutter Jan 8, 2026
67ec3de
all: Fix warnings from clippy::extra_unused_lifetimes
lutter Jan 8, 2026
c167cee
all: Fix warnings from clippy::field_reassign_with_default
lutter Jan 8, 2026
2eba5fb
all: Fix warnings from clippy::from_over_into
lutter Jan 8, 2026
bb2d187
all: Run 'cargo clippy --fix' (again)
lutter Jan 8, 2026
f0bccfe
all: Fix warnings from clippy::get_first
lutter Jan 8, 2026
c891d0d
all: Fix warnings from clippy::iter_kv_map
lutter Jan 8, 2026
3c27f9d
all: Fix warnings from clippy::iter_nth
lutter Jan 8, 2026
d624bba
all: Fix warnings from clippy::large_enum_variant
lutter Jan 8, 2026
66be8e1
all: Fix warnings from clippy::legacy_numeric_constants
lutter Jan 8, 2026
c63f90c
all: Fix warnings from clippy::len_without_is_empty
lutter Jan 8, 2026
97c58cc
all: Fix warnings from clippy::len_zero
lutter Jan 8, 2026
8d06359
all: Fix warnings from clippy::let_and_return
lutter Jan 8, 2026
fe1b86b
all: Fix warnings from clippy::manual_clamp
lutter Jan 8, 2026
998d88b
all: Fix warnings from clippy::manual_inspect
lutter Jan 8, 2026
546d95f
all: Fix warnings from clippy::manual_non_exhaustive
lutter Jan 8, 2026
8b2154d
all: Fix warnings from clippy::manual_strip
lutter Jan 8, 2026
b86bcb4
all: Run 'cargo clippy --fix' (again)
lutter Jan 8, 2026
c437459
all: Fix warnings from clippy::map_clone
lutter Jan 8, 2026
e4df61e
all: Fix warnings from clippy::map_entry
lutter Jan 8, 2026
e52faa3
all: Fix warnings from clippy::map_identity
lutter Jan 8, 2026
af77913
all: Fix warnings from clippy::match_like_matches_macro
lutter Jan 8, 2026
db82555
all: Fix warnings from clippy::module_inception
lutter Jan 8, 2026
fd304ca
all: Fix warnings from clippy::multiple_bound_locations
lutter Jan 8, 2026
8ad40f0
all: Fix warnings from clippy::needless_lifetimes
lutter Jan 8, 2026
f0e18a3
all: Fix warnings from clippy::needless_maybe_sized
lutter Jan 8, 2026
4d15870
all: Fix warnings from clippy::new_without_default
lutter Jan 8, 2026
3d81b24
all: Fix warnings from clippy::non_canonical_clone_impl
lutter Jan 8, 2026
2380297
all: Fix warnings from clippy::non_canonical_partial_ord_impl
lutter Jan 9, 2026
65617ca
all: Fix warnings from clippy::only_used_in_recursion
lutter Jan 9, 2026
75cc00f
all: Fix warnings from clippy::ptr_arg
lutter Jan 9, 2026
7e8659b
all: Fix warnings from clippy::question_mark
lutter Jan 9, 2026
371f861
all: Fix warnings from clippy::redundant_allocation
lutter Jan 9, 2026
6dc57c7
all: Fix warnings from clippy::redundant_locals
lutter Jan 9, 2026
ccdb2da
all: Fix warnings from clippy::redundant_pattern_matching
lutter Jan 9, 2026
58d8600
all: Fix warnings from clippy::result_large_err
lutter Jan 9, 2026
a7ac724
all: Change the error for NodeId::new
lutter Jan 9, 2026
54aea68
all: Change the error for SubgraphName::new
lutter Jan 9, 2026
2a1199b
all: Fix warnings from clippy::result_unit_err
lutter Jan 9, 2026
7b88ca4
all: Fix warnings from clippy::search_is_some
lutter Jan 9, 2026
46fc658
all: Fix warnings from clippy::should_implement_trait
lutter Jan 9, 2026
cab443b
all: Fix warnings from clippy::single_match
lutter Jan 9, 2026
a509d66
all: Fix warnings from clippy::suspicious_doc_comments
lutter Jan 9, 2026
67f8cf4
all: Fix warnings from clippy::suspicious_map
lutter Jan 9, 2026
2b9d0f8
all: Fix warnings from clippy::suspicious_open_options
lutter Jan 9, 2026
eda24bf
all: Admit defeat for clippy::too_many_arguments
lutter Jan 9, 2026
25b4b00
all: Fix warnings from clippy::to_string_trait_impl
lutter Jan 9, 2026
383c9da
all: Admit defeat for clippy::type_complexity
lutter Jan 9, 2026
b7d517e
all: Fix warnings from clippy::unnecessary_lazy_evaluations
lutter Jan 9, 2026
274046a
all: Fix warnings from clippy::unnecessary_to_owned
lutter Jan 9, 2026
127d8de
all: Suppress warnings from clippy::unnecessary_unwrap
lutter Jan 9, 2026
206e187
all: Fix warnings from clippy::useless_conversion
lutter Jan 9, 2026
818d6d3
all: Fix warnings from clippy::wrong_self_convention
lutter Jan 9, 2026
862abdb
justfile: Make 'just lint' run clippy with all default lints turned on
lutter Jan 9, 2026
c55aeef
all: Run 'cargo clippy --fix --all-targets'
lutter Jan 9, 2026
6c38d43
test-store: Remove unneeded mutability
lutter Jan 9, 2026
7d6f157
tests: Fix warnings from clippy::approx_constant
lutter Jan 9, 2026
6fe5d47
tests: Fix warnings from clippy::arc_with_non_send_sync
lutter Jan 9, 2026
7f8e28d
tests: Fix warnings from clippy::assertions_on_constants
lutter Jan 9, 2026
c416983
tests: Fix warnings from clippy::cloned_ref_to_slice_refs
lutter Jan 9, 2026
5e8d469
tests: Fix warnings from clippy::empty_line_after_doc_comments
lutter Jan 9, 2026
b2ba9ce
tests: Fix warnings from clippy::field_reassign_with_default
lutter Jan 9, 2026
2e6981b
tests: Fix warnings from clippy::just_underscores_and_digits
lutter Jan 9, 2026
06dfcb5
tests: Fix warnings from clippy::legacy_numeric_constants
lutter Jan 9, 2026
9016044
tests: Fix warnings from clippy::match_like_matches_macro
lutter Jan 9, 2026
a60f640
tests: Fix warnings from clippy::mut_mutex_lock
lutter Jan 9, 2026
e910eae
tests: Fix warnings from clippy::neg_cmp_op_on_partial_ord
lutter Jan 9, 2026
2b7dbb3
tests: Fix warnings from clippy::never_loop
lutter Jan 9, 2026
83a3c78
tests: Fix warnings from clippy::no_effect
lutter Jan 9, 2026
76f25e9
tests: Fix warnings from clippy::ptr_arg
lutter Jan 9, 2026
ecf6bd9
tests: Fix warnings from clippy::search_is_some
lutter Jan 9, 2026
a482a33
tests: Fix warnings from clippy::should_implement_trait
lutter Jan 9, 2026
9c00ae0
tests: Fix warnings from clippy::unnecessary_fallible_conversions
lutter Jan 9, 2026
f02381c
tests: Fix warnings from clippy::unnecessary_to_owned
lutter Jan 9, 2026
fe94732
tests: Fix warnings from clippy::unusual_byte_groupings
lutter Jan 9, 2026
747a354
tests: Fix warnings from clippy::useless_format
lutter Jan 9, 2026
760dced
tests: Fix warnings from clippy::vec_init_then_push
lutter Jan 9, 2026
5a87f36
tests: Fix warnings from clippy::zero_prefixed_literal
lutter Jan 9, 2026
d4745c3
all: Run 'cargo fmt'
lutter Jan 9, 2026
7b02b32
justfile: Make 'just lint' run clippy against all targets
lutter Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ parking_lot = "0.12.4"
sqlparser-latest = { version = "0.57.0", package = "sqlparser", features = ["visitor"] }
tokio-util = "0.7.15"

[workspace.lints.clippy]
too_many_arguments = "allow"
type_complexity = "allow"

# Incremental compilation on Rust 1.58 causes an ICE on build. As soon as graph node builds again, these can be removed.
[profile.test]
incremental = false
Expand Down
3 changes: 3 additions & 0 deletions chain/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ protobuf = "3.0.2"
protobuf-parse = "3.7.2"
anyhow = "1"
heck = "0.5"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion chain/common/tests/test-acme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn required_ok() {
!f.required,
"Transaction.events field should NOT be required!"
),
_ => assert!(false, "Unexpected message field [{}]!", f.name),
_ => panic!("Unexpected message field [{}]!", f.name),
};
});
}
Expand Down
3 changes: 3 additions & 0 deletions chain/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ base64 = "0"

[build-dependencies]
tonic-build = { workspace = true }

[lints]
workspace = true
3 changes: 2 additions & 1 deletion chain/ethereum/examples/firehose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use graph::{
use graph_chain_ethereum::codec;
use hex::ToHex;
use prost::Message;
use std::slice;
use std::sync::Arc;
use tonic::Streaming;

Expand All @@ -25,7 +26,7 @@ async fn main() -> Result<(), Error> {
let host = "https://api.streamingfast.io:443".to_string();
let metrics = Arc::new(EndpointMetrics::new(
logger,
&[host.clone()],
slice::from_ref(&host),
Arc::new(MetricsRegistry::mock()),
));

Expand Down
124 changes: 55 additions & 69 deletions chain/ethereum/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl EventSignatureWithTopics {
/// If self.address is None, it's considered a wildcard match.
/// Otherwise, it must match the provided address.
/// It must also match the topics if they are Some
pub fn matches(&self, address: Option<&H160>, sig: H256, topics: &Vec<H256>) -> bool {
pub fn matches(&self, address: Option<&H160>, sig: H256, topics: &[H256]) -> bool {
// If self.address is None, it's considered a wildcard match. Otherwise, it must match the provided address.
let address_matches = match self.address {
Some(ref self_addr) => address == Some(self_addr),
Expand All @@ -80,15 +80,18 @@ impl EventSignatureWithTopics {

address_matches
&& self.signature == sig
&& self.topic1.as_ref().map_or(true, |t1| {
topics.get(1).map_or(false, |topic| t1.contains(topic))
})
&& self.topic2.as_ref().map_or(true, |t2| {
topics.get(2).map_or(false, |topic| t2.contains(topic))
})
&& self.topic3.as_ref().map_or(true, |t3| {
topics.get(3).map_or(false, |topic| t3.contains(topic))
})
&& self
.topic1
.as_ref()
.is_none_or(|t1| topics.get(1).is_some_and(|topic| t1.contains(topic)))
&& self
.topic2
.as_ref()
.is_none_or(|t2| topics.get(2).is_some_and(|topic| t2.contains(topic)))
&& self
.topic3
.as_ref()
.is_none_or(|t3| topics.get(3).is_some_and(|topic| t3.contains(topic)))
}
}

Expand Down Expand Up @@ -390,7 +393,7 @@ impl EthereumLogFilter {
&self,
event_signature: &H256,
contract_address: Option<&Address>,
topics: &Vec<H256>,
topics: &[H256],
) -> bool {
// Check for wildcard events first.
if self.wildcard_events.get(event_signature) == Some(&true) {
Expand Down Expand Up @@ -536,10 +539,8 @@ impl EthereumLogFilter {
// Handle events with topic filters.
filters.extend(
self.events_with_topic_filters
.into_iter()
.map(|(event_with_topics, _)| {
EthGetLogsFilter::from_event_with_topics(event_with_topics)
}),
.into_keys()
.map(EthGetLogsFilter::from_event_with_topics),
);

// The current algorithm is to repeatedly find the maximum cardinality vertex and turn all
Expand Down Expand Up @@ -614,16 +615,16 @@ pub struct EthereumCallFilter {
pub wildcard_signatures: HashSet<FunctionSelector>,
}

impl Into<Vec<CallToFilter>> for EthereumCallFilter {
fn into(self) -> Vec<CallToFilter> {
if self.is_empty() {
impl From<EthereumCallFilter> for Vec<CallToFilter> {
fn from(val: EthereumCallFilter) -> Self {
if val.is_empty() {
return Vec::new();
}

let EthereumCallFilter {
contract_addresses_function_signatures,
wildcard_signatures,
} = self;
} = val;

let mut filters: Vec<CallToFilter> = contract_addresses_function_signatures
.into_iter()
Expand Down Expand Up @@ -771,14 +772,13 @@ impl FromIterator<(BlockNumber, Address, FunctionSelector)> for EthereumCallFilt
.for_each(|(start_block, address, function_signature)| {
lookup
.entry(address)
.and_modify(|set| {
if set.0 > start_block {
set.0 = start_block
}
set.1.insert(function_signature);
})
.or_insert((start_block, HashSet::default()));
lookup.get_mut(&address).map(|set| {
if set.0 > start_block {
set.0 = start_block
}
set.1.insert(function_signature);
set
});
});
EthereumCallFilter {
contract_addresses_function_signatures: lookup,
Expand Down Expand Up @@ -810,9 +810,9 @@ pub struct EthereumBlockFilter {
pub trigger_every_block: bool,
}

impl Into<Vec<CallToFilter>> for EthereumBlockFilter {
fn into(self) -> Vec<CallToFilter> {
self.contract_addresses
impl From<EthereumBlockFilter> for Vec<CallToFilter> {
fn from(val: EthereumBlockFilter) -> Self {
val.contract_addresses
.into_iter()
.map(|(_, addr)| addr)
.sorted()
Expand Down Expand Up @@ -847,9 +847,8 @@ impl EthereumBlockFilter {
.block_handlers
.clone()
.into_iter()
.any(|block_handler| match block_handler.filter {
Some(BlockHandlerFilter::Call) => true,
_ => false,
.any(|block_handler| {
matches!(block_handler.filter, Some(BlockHandlerFilter::Call))
});

let has_block_handler_without_filter = data_source
Expand Down Expand Up @@ -1411,7 +1410,7 @@ mod tests {
filter.event_signatures.sort();
}
assert_eq!(expected_log_filters, actual_log_filters);
assert_eq!(true, actual_send_all_block_headers);
assert!(actual_send_all_block_headers);
}

#[test]
Expand Down Expand Up @@ -1478,7 +1477,7 @@ mod tests {
}
assert_eq!(expected_log_filters, actual_log_filters);

assert_eq!(true, actual_send_all_block_headers);
assert!(actual_send_all_block_headers);
}

#[test]
Expand All @@ -1505,76 +1504,63 @@ mod tests {
wildcard_signatures: HashSet::from_iter(vec![[11u8; 4]]),
};

assert_eq!(
false,
filter.matches(&call(address(2), vec![])),
assert!(
!filter.matches(&call(address(2), vec![])),
"call with empty bytes are always ignore, whatever the condition"
);

assert_eq!(
false,
filter.matches(&call(address(4), vec![1; 36])),
assert!(
!filter.matches(&call(address(4), vec![1; 36])),
"call with incorrect address should be ignored"
);

assert_eq!(
true,
assert!(
filter.matches(&call(address(1), vec![1; 36])),
"call with correct address & signature should match"
);

assert_eq!(
true,
assert!(
filter.matches(&call(address(1), vec![1; 32])),
"call with correct address & signature, but with incorrect input size should match"
);

assert_eq!(
false,
filter.matches(&call(address(1), vec![4u8; 36])),
assert!(
!filter.matches(&call(address(1), vec![4u8; 36])),
"call with correct address but incorrect signature for a specific contract filter (i.e. matches some signatures) should be ignored"
);

assert_eq!(
false,
filter.matches(&call(address(0), vec![11u8; 36])),
assert!(
!filter.matches(&call(address(0), vec![11u8; 36])),
"this signature should not match filter1, this avoid false passes if someone changes the code"
);
assert_eq!(
false,
filter2.matches(&call(address(1), vec![10u8; 36])),
assert!(
!filter2.matches(&call(address(1), vec![10u8; 36])),
"this signature should not match filter2 because the address is not the expected one"
);
assert_eq!(
true,
assert!(
filter2.matches(&call(address(0), vec![10u8; 36])),
"this signature should match filter2 on the non wildcard clause"
);
assert_eq!(
true,
assert!(
filter2.matches(&call(address(0), vec![11u8; 36])),
"this signature should match filter2 on the wildcard clause"
);

// extend filter1 and test the filter 2 stuff again
filter.extend(filter2);
assert_eq!(
true,
assert!(
filter.matches(&call(address(0), vec![11u8; 36])),
"this signature should not match filter1, this avoid false passes if someone changes the code"
);
assert_eq!(
false,
filter.matches(&call(address(1), vec![10u8; 36])),
assert!(
!filter.matches(&call(address(1), vec![10u8; 36])),
"this signature should not match filter2 because the address is not the expected one"
);
assert_eq!(
true,
assert!(
filter.matches(&call(address(0), vec![10u8; 36])),
"this signature should match filter2 on the non wildcard clause"
);
assert_eq!(
true,
assert!(
filter.matches(&call(address(0), vec![11u8; 36])),
"this signature should match filter2 on the wildcard clause"
);
Expand Down Expand Up @@ -1674,7 +1660,7 @@ mod tests {

base.extend(extension);

assert_eq!(true, base.trigger_every_block);
assert!(base.trigger_every_block);
}

#[test]
Expand All @@ -1694,7 +1680,7 @@ mod tests {

base.extend(extension);

assert_eq!(true, base.trigger_every_block);
assert!(base.trigger_every_block);
assert_eq!(
HashSet::from_iter(vec![(10, address(2))]),
base.contract_addresses,
Expand All @@ -1718,7 +1704,7 @@ mod tests {

base.extend(extension);

assert_eq!(true, base.trigger_every_block);
assert!(base.trigger_every_block);
assert_eq!(
HashSet::from_iter(vec![(10, address(2)), (10, address(1))]),
base.contract_addresses,
Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/src/buffered_call_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl EthereumCallCache for BufferedCallCache {
return Ok(Some(value));
}

let result = self.call_cache.get_call(&call, block).await?;
let result = self.call_cache.get_call(call, block).await?;

let mut buffer = self.buffer.lock().unwrap();
if let Some(call::Response {
Expand Down
2 changes: 1 addition & 1 deletion chain/ethereum/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ async fn fetch_unique_blocks_from_cache(
// Load blocks from the cache
let blocks_map = chain_store
.cheap_clone()
.block_ptrs_by_numbers(block_numbers.iter().map(|&b| b.into()).collect::<Vec<_>>())
.block_ptrs_by_numbers(block_numbers.iter().copied().collect::<Vec<_>>())
.await
.map_err(|e| {
error!(logger, "Error accessing block cache {}", e);
Expand Down
Loading
Loading