Skip to content

Commit 3b4f42e

Browse files
committed
refactor: send just the value
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent 00b332e commit 3b4f42e

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

tap-agent/src/agent/sender_account.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use tap_core::rav::SignedRAV;
2323
use thegraph_core::Address;
2424
use tracing::{error, Level};
2525

26-
use super::sender_accounts_manager::NewReceiptNotification;
2726
use super::sender_allocation::{SenderAllocation, SenderAllocationArgs};
2827
use crate::agent::sender_allocation::SenderAllocationMessage;
2928
use crate::agent::sender_fee_tracker::SenderFeeTracker;
@@ -80,7 +79,7 @@ type Balance = U256;
8079

8180
#[derive(Debug, Eq, PartialEq)]
8281
pub enum ReceiptFees {
83-
NewReceipt(NewReceiptNotification),
82+
NewReceipt(u128),
8483
UpdateValue(UnaggregatedReceipts),
8584
Retry,
8685
}
@@ -569,15 +568,15 @@ impl Actor for SenderAccount {
569568
}
570569

571570
match receipt_fees {
572-
ReceiptFees::NewReceipt(receipt) => {
573-
state.sender_fee_tracker.add(allocation_id, receipt.value);
571+
ReceiptFees::NewReceipt(value) => {
572+
state.sender_fee_tracker.add(allocation_id, value);
574573

575574
UNAGGREGATED_FEES
576575
.with_label_values(&[
577576
&state.sender.to_string(),
578577
&allocation_id.to_string(),
579578
])
580-
.add(receipt.value as f64);
579+
.add(value as f64);
581580
}
582581
ReceiptFees::UpdateValue(unaggregated_fees) => {
583582
state

tap-agent/src/agent/sender_allocation.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl Actor for SenderAllocation {
249249
.sender_account_ref
250250
.cast(SenderAccountMessage::UpdateReceiptFees(
251251
state.allocation_id,
252-
ReceiptFees::NewReceipt(notification),
252+
ReceiptFees::NewReceipt(fees),
253253
))?;
254254
}
255255
}
@@ -1074,10 +1074,7 @@ pub mod tests {
10741074
// should emit update aggregate fees message to sender account
10751075
let expected_message = SenderAccountMessage::UpdateReceiptFees(
10761076
*ALLOCATION_ID_0,
1077-
ReceiptFees::UpdateValue(UnaggregatedReceipts {
1078-
last_id: 1,
1079-
value: 20,
1080-
}),
1077+
ReceiptFees::NewReceipt(20u128),
10811078
);
10821079
let last_message_emitted = last_message_emitted.lock().unwrap();
10831080
assert_eq!(last_message_emitted.len(), 2);

0 commit comments

Comments
 (0)