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

fix: check allocation id blocked before sending rav req #600

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion crates/tap-agent/src/agent/sender_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,11 @@ impl Actor for SenderAccount {
"Total fee greater than the trigger value. Triggering RAV request"
);
state.rav_request_for_heaviest_allocation().await
} else if counter_greater_receipt_limit {
} else if counter_greater_receipt_limit
&& !state
.sender_fee_tracker
.is_allocation_id_blocked(&allocation_id)
{
tracing::debug!(
total_counter_for_allocation,
rav_request_receipt_limit = state.config.rav_request_receipt_limit,
Expand Down
11 changes: 11 additions & 0 deletions crates/tap-agent/src/tracker/generic_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::{
};

use thegraph_core::alloy::primitives::Address;
use tracing::warn;

use super::{
global_tracker::GlobalTracker, AllocationStats, DefaultFromExtra, DurationInfo, SenderFeeStats,
Expand Down Expand Up @@ -214,6 +215,16 @@ where
});
}

pub fn is_allocation_id_blocked(&self, address: &Address) -> bool {
match self.id_to_fee.get(address).map(|v| v.blocked) {
Some(val) => val,
None => {
warn!("Allocation ID {} not found in the tracker", address);
false
}
}
}

pub fn can_trigger_rav(&self, allocation_id: Address) -> bool {
self.id_to_fee
.get(&allocation_id)
Expand Down
Loading