Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
9b914c1
all: Run 'cargo clippy --fix'
lutter Jan 8, 2026
3574b8a
all: Fix warnings from clippy::from_str_radix_10
lutter Jan 8, 2026
4fd8f07
test-store, tests: Allow holding the test lock across await
lutter Jan 8, 2026
5d62b2d
all: Fix warnings from clippy::bind_instead_of_map
lutter Jan 8, 2026
ff20468
all: Fix warnings from clippy::box_collection
lutter Jan 8, 2026
66f7251
all: Fix warnings from clippy::cloned_ref_to_slice_refs
lutter Jan 8, 2026
15648c8
all: Fix warnings from clippy::collapsible_match
lutter Jan 8, 2026
a0505bc
all: Fix warnings from clippy::derivable_impls
lutter Jan 8, 2026
dfb841c
all: Fix warnings from clippy::doc_lazy_continuation
lutter Jan 8, 2026
13d99de
all: Fix warnings from clippy::doc_overindented_list_items
lutter Jan 8, 2026
e64f6ce
all: Fix warnings from clippy::empty_line_after_doc_comments
lutter Jan 8, 2026
ba7295f
all: Fix warnings from clippy::enum_variant_names
lutter Jan 8, 2026
8c84f86
all: Fix warnings from clippy::explicit_counter_loop
lutter Jan 8, 2026
2b01220
all: Fix warnings from clippy::explicit_write
lutter Jan 8, 2026
d254578
all: Fix warnings from clippy::extra_unused_lifetimes
lutter Jan 8, 2026
9b6594a
all: Fix warnings from clippy::extra_unused_type_parameters
lutter Jan 8, 2026
51b043d
all: Fix warnings from clippy::field_reassign_with_default
lutter Jan 8, 2026
d6b207e
all: Fix warnings from clippy::from_over_into
lutter Jan 8, 2026
80194e0
all: Run 'cargo clippy --fix' (again)
lutter Jan 8, 2026
05a55be
all: Fix warnings from clippy::get_first
lutter Jan 8, 2026
27a533d
all: Fix warnings from clippy::iter_kv_map
lutter Jan 8, 2026
f87a420
all: Fix warnings from clippy::iter_nth
lutter Jan 8, 2026
ed222c1
all: Fix warnings from clippy::large_enum_variant
lutter Jan 8, 2026
93d9383
all: Fix warnings from clippy::legacy_numeric_constants
lutter Jan 8, 2026
ce24137
all: Fix warnings from clippy::len_without_is_empty
lutter Jan 8, 2026
cd9d016
all: Fix warnings from clippy::len_zero
lutter Jan 8, 2026
b198210
all: Fix warnings from clippy::let_and_return
lutter Jan 8, 2026
e6e4c70
all: Fix warnings from clippy::manual_clamp
lutter Jan 8, 2026
f7459dc
all: Fix warnings from clippy::manual_inspect
lutter Jan 8, 2026
928e0aa
all: Fix warnings from clippy::manual_non_exhaustive
lutter Jan 8, 2026
0d8b10a
all: Fix warnings from clippy::manual_strip
lutter Jan 8, 2026
8541c8b
all: Run 'cargo clippy --fix' (again)
lutter Jan 8, 2026
85d2feb
all: Fix warnings from clippy::map_clone
lutter Jan 8, 2026
4375577
all: Fix warnings from clippy::map_entry
lutter Jan 8, 2026
ee41e53
all: Fix warnings from clippy::map_identity
lutter Jan 8, 2026
9022945
all: Fix warnings from clippy::match_like_matches_macro
lutter Jan 8, 2026
9adf8a8
all: Fix warnings from clippy::module_inception
lutter Jan 8, 2026
4087be2
all: Fix warnings from clippy::multiple_bound_locations
lutter Jan 8, 2026
b531b5d
all: Fix warnings from clippy::needless_lifetimes
lutter Jan 8, 2026
95dcbd4
all: Fix warnings from clippy::needless_maybe_sized
lutter Jan 8, 2026
763a50d
all: Fix warnings from clippy::new_without_default
lutter Jan 8, 2026
6c55d62
all: Fix warnings from clippy::non_canonical_clone_impl
lutter Jan 8, 2026
9e708d7
all: Fix warnings from clippy::non_canonical_partial_ord_impl
lutter Jan 9, 2026
b9a8a57
all: Fix warnings from clippy::only_used_in_recursion
lutter Jan 9, 2026
c179354
all: Fix warnings from clippy::ptr_arg
lutter Jan 9, 2026
a140bea
all: Fix warnings from clippy::question_mark
lutter Jan 9, 2026
95d117b
all: Fix warnings from clippy::redundant_allocation
lutter Jan 9, 2026
a6985f1
all: Fix warnings from clippy::redundant_guards
lutter Jan 9, 2026
f9b59c3
all: Fix warnings from clippy::redundant_locals
lutter Jan 9, 2026
47117d8
all: Fix warnings from clippy::redundant_pattern_matching
lutter Jan 9, 2026
9eee0c4
all: Fix warnings from clippy::result_large_err
lutter Jan 9, 2026
68259a1
all: Change the error for NodeId::new
lutter Jan 9, 2026
a1e2f78
all: Change the error for SubgraphName::new
lutter Jan 9, 2026
2850624
all: Fix warnings from clippy::result_unit_err
lutter Jan 9, 2026
f04ee99
all: Fix warnings from clippy::search_is_some
lutter Jan 9, 2026
a00b587
all: Fix warnings from clippy::should_implement_trait
lutter Jan 9, 2026
3aba673
all: Fix warnings from clippy::single_match
lutter Jan 9, 2026
230d4b6
all: Fix warnings from clippy::suspicious_doc_comments
lutter Jan 9, 2026
99105fd
all: Fix warnings from clippy::suspicious_map
lutter Jan 9, 2026
d420825
all: Fix warnings from clippy::suspicious_open_options
lutter Jan 9, 2026
19f4ad2
all: Admit defeat for clippy::too_many_arguments
lutter Jan 9, 2026
0fe438e
all: Fix warnings from clippy::to_string_trait_impl
lutter Jan 9, 2026
5dc4f0b
all: Admit defeat for clippy::type_complexity
lutter Jan 9, 2026
eb4e385
all: Fix warnings from clippy::unnecessary_lazy_evaluations
lutter Jan 9, 2026
98c0334
all: Fix warnings from clippy::unnecessary_to_owned
lutter Jan 9, 2026
6e397be
all: Suppress warnings from clippy::unnecessary_unwrap
lutter Jan 9, 2026
1b61f46
all: Fix warnings from clippy::useless_conversion
lutter Jan 9, 2026
2978e6e
all: Fix warnings from clippy::wrong_self_convention
lutter Jan 9, 2026
a2682f2
justfile: Make 'just lint' run clippy with all default lints turned on
lutter Jan 9, 2026
740f219
all: Run 'cargo clippy --fix --all-targets'
lutter Jan 9, 2026
b329457
test-store: Remove unneeded mutability
lutter Jan 9, 2026
051e1bb
tests: Fix warnings from clippy::approx_constant
lutter Jan 9, 2026
2d1b1af
tests: Fix warnings from clippy::arc_with_non_send_sync
lutter Jan 9, 2026
1ca9aa8
tests: Fix warnings from clippy::assertions_on_constants
lutter Jan 9, 2026
9387e33
tests: Fix warnings from clippy::cloned_ref_to_slice_refs
lutter Jan 9, 2026
5b66c5e
tests: Fix warnings from clippy::empty_line_after_doc_comments
lutter Jan 9, 2026
0f027d0
tests: Fix warnings from clippy::field_reassign_with_default
lutter Jan 9, 2026
f517a07
tests: Fix warnings from clippy::inconsistent_digit_grouping
lutter Jan 9, 2026
6c43624
tests: Fix warnings from clippy::just_underscores_and_digits
lutter Jan 9, 2026
f24f7bc
tests: Fix warnings from clippy::legacy_numeric_constants
lutter Jan 9, 2026
a5933c6
tests: Fix warnings from clippy::match_like_matches_macro
lutter Jan 9, 2026
e715368
tests: Fix warnings from clippy::mut_mutex_lock
lutter Jan 9, 2026
a3d1f1e
tests: Fix warnings from clippy::neg_cmp_op_on_partial_ord
lutter Jan 9, 2026
4550795
tests: Fix warnings from clippy::never_loop
lutter Jan 9, 2026
7d6b8f4
tests: Fix warnings from clippy::no_effect
lutter Jan 9, 2026
0c0825f
tests: Fix warnings from clippy::option_map_unit_fn
lutter Jan 9, 2026
ccffd79
tests: Fix warnings from clippy::ptr_arg
lutter Jan 9, 2026
7120b0c
tests: Fix warnings from clippy::search_is_some
lutter Jan 9, 2026
abe4c0b
tests: Fix warnings from clippy::should_implement_trait
lutter Jan 9, 2026
fd08321
tests: Fix warnings from clippy::unnecessary_fallible_conversions
lutter Jan 9, 2026
ca8ea22
tests: Fix warnings from clippy::unnecessary_to_owned
lutter Jan 9, 2026
7590c2a
tests: Fix warnings from clippy::unusual_byte_groupings
lutter Jan 9, 2026
0124080
tests: Fix warnings from clippy::useless_format
lutter Jan 9, 2026
c87aa96
tests: Fix warnings from clippy::vec_init_then_push
lutter Jan 9, 2026
7d5dff3
tests: Fix warnings from clippy::zero_prefixed_literal
lutter Jan 9, 2026
c87db35
all: Run 'cargo fmt'
lutter Jan 9, 2026
b572309
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 @@ -119,6 +119,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 @@ -760,7 +760,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