-
Notifications
You must be signed in to change notification settings - Fork 6
Jp/hack negative queries #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f1ade45
559b071
501ffad
b566eab
5ad7595
d440d69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,7 +12,30 @@ pub mod hypersync_net_types_capnp { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct BlockSelection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct Selection<T> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Filters where matching values should be included in the response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Default::default() means include everything | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[serde(default, flatten)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub include: T, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Filters where matching values should be excluded from the response | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// None means exclude nothing, Some(Default::default()) means exclude everything | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[serde(default)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub exclude: Option<T>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
14
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Document the exclude field behavior and validate the design. The new
Additionally, the Consider adding comprehensive documentation: #[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct Selection<T> {
/// Filters where matching values should be included in the response
- /// Default::default() means include everything
+ /// Default::default() means include everything.
+ /// Items must match the include filter to be considered for the response.
#[serde(default, flatten)]
pub include: T,
/// Filters where matching values should be excluded from the response
- /// None means exclude nothing, Some(Default::default()) means exclude everything
+ /// None means exclude nothing. Some(Default::default()) means exclude everything.
+ /// Exclusion is applied after inclusion, so an item matching both include and exclude
+ /// filters will be excluded from the response.
#[serde(default)]
pub exclude: Option<T>,
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
impl<T> From<T> for Selection<T> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
fn from(include: T) -> Self { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Self { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
include, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
exclude: None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub type BlockSelection = Selection<BlockFilter>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct BlockFilter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Hash of a block, any blocks that have one of these hashes will be returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Empty means match all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[serde(default)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -23,8 +46,10 @@ pub struct BlockSelection { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
pub miner: Vec<Address>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub type LogSelection = Selection<LogFilter>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct LogSelection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct LogFilter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Address of the contract, any logs that has any of these addresses will be returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Empty means match all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[serde(default)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -37,8 +62,10 @@ pub struct LogSelection { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
pub topics: ArrayVec<Vec<LogArgument>, 4>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub type TransactionSelection = Selection<TransactionFilter>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[derive(Default, Serialize, Deserialize, Clone, Debug)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct TransactionSelection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct TransactionFilter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Address the transaction should originate from. If transaction.from matches any of these, the transaction | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// will be returned. Keep in mind that this has an and relationship with to filter, so each transaction should | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// match both of them. Empty means match all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -90,8 +117,10 @@ pub struct AuthorizationSelection { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
pub address: Vec<Address>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub type TraceSelection = Selection<TraceFilter>; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[derive(Default, Serialize, Deserialize, Clone, Debug)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct TraceSelection { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub struct TraceFilter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[serde(default)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub from: Vec<Address>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[serde(default)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -177,8 +206,13 @@ pub struct Query { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Copy)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub enum JoinMode { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Join in this order logs -> transactions -> traces -> blocks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Default, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Join everything to everything. For example if logSelection matches log0, we get the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// associated transaction of log0 and then we get associated logs of that transaction as well. Applites similarly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// to blocks, traces. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
JoinAll, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// JoinNothing: join nothing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
JoinNothing, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade outdated GitHub Actions.
The static analysis tool correctly identifies that these actions are outdated and may fail on GitHub Actions:
actions/checkout@v3
uses Node 16, which is deprecated. Upgrade toactions/checkout@v4
.actions-rs/toolchain@v1
is from an archived repository and is no longer maintained. Consider usingdtolnay/rust-toolchain
or the officialactions/setup-rust
instead.Apply this diff to upgrade the actions across all jobs:
Note:
dtolnay/rust-toolchain
uses the version as a tag (e.g.,@stable
), so thewith
block is no longer needed.Also applies to: 45-46, 68-69
🧰 Tools
🪛 actionlint (1.7.7)
22-22: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
23-23: the runner of "actions-rs/toolchain@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this as a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JasoonS, understood! I'll defer this change to a separate PR to keep this one focused on the negative queries work.
Would you like me to create a GitHub issue to track the GitHub Actions upgrade (actions/checkout@v3 → v4 and replacing actions-rs/toolchain@v1 with a maintained alternative like dtolnay/rust-toolchain)?