Skip to content
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

Add custom filtering support (needed for liquidator) #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

farnyser
Copy link
Contributor

No description provided.

@farnyser farnyser force-pushed the serge/custom_filtering branch from 9cae769 to a52c31e Compare March 26, 2024 07:29
@@ -84,6 +84,31 @@ pub fn init(
},
);
}
Ok(FeedWrite::Snapshot(snapshot_write)) = account_write_queue_receiver.recv() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this kind of pattern matching on the future-result allowed? I'm worried that this runs two account_write_queue_receiver.recv() futures and then fails if whichever returns first doesn't match the pattern

@@ -219,6 +248,9 @@ async fn feed_data_geyser(
EntityFilter::FilterByProgramId(program_id) => {
snapshot_gpa = tokio::spawn(get_snapshot_gpa(snapshot_rpc_http_url.clone(), program_id.to_string())).fuse();
},
EntityFilter::FilterByProgramIdAndCustomCriteria(program_id,filters) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

run cargo fmt; also FilterByProgramId sounds very close to FilterByProgramIdAndCustomCriteria with zero extra filters - could that be the same thing? If not, maybe rename FilterByProgramIdFiltered or FilterByProgramIdSelective or so? the "custom criteria" sounds odd to me


#[derive(Clone, PartialEq, Debug)]
pub struct SnapshotWrite {
pub accounts: Vec<AccountWrite>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it's useful to have a separate SnapshotWrite when it's just a bundle of AccountWrites, consumers may be happy if they don't have to special case?

Copy link
Contributor

@ckamm ckamm Apr 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the liquidator actually depends on knowing when the first snapshot is done. Making the startup of this convenient for users is probably a separate task.

@@ -38,7 +47,7 @@ pub async fn get_snapshot_gpa(
min_context_slot: None,
};
let program_accounts_config = RpcProgramAccountsConfig {
filters: None,
filters: fitlers.map(|v| v.iter().map(|f| f.to_rpc_filter()).collect()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo fitlers

@farnyser farnyser force-pushed the serge/custom_filtering branch from 7165e7d to 1096ee3 Compare April 11, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants