Skip to content

Commit 57afc67

Browse files
committed
Make RAV value threshold per sender
Fixes #93 Signed-off-by: Alexis Asseman <[email protected]>
1 parent d3b58eb commit 57afc67

12 files changed

+1706
-1216
lines changed

.sqlx/query-4b2b09179ed5f7acc2b04b5ced93613210267f47350d4aabdd91b108479fbf59.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.sqlx/query-778a427621acd2003b94340e46df1b73bfc863f0fa48004a4d5bd39cd97b07bb.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

tap-agent/src/agent.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ use indexer_common::prelude::{
99
};
1010

1111
use crate::{
12-
aggregator_endpoints, config, database,
13-
tap::sender_allocation_relationships_manager::SenderAllocationRelationshipsManager,
12+
aggregator_endpoints, config, database, tap::sender_accounts_manager::SenderAccountsManager,
1413
};
1514

16-
pub async fn start_agent(config: &'static config::Cli) -> SenderAllocationRelationshipsManager {
15+
pub async fn start_agent(config: &'static config::Cli) -> SenderAccountsManager {
1716
let pgpool = database::connect(&config.postgres).await;
1817

1918
let http_client = reqwest::Client::new();
@@ -80,7 +79,7 @@ pub async fn start_agent(config: &'static config::Cli) -> SenderAllocationRelati
8079
verifying_contract: config.receipts.receipts_verifier_address,
8180
};
8281

83-
SenderAllocationRelationshipsManager::new(
82+
SenderAccountsManager::new(
8483
config,
8584
pgpool,
8685
indexer_allocations,

tap-agent/src/tap/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ mod escrow_adapter;
1111
mod rav_storage_adapter;
1212
mod receipt_checks_adapter;
1313
mod receipt_storage_adapter;
14-
mod sender_allocation_relationship;
15-
pub mod sender_allocation_relationships_manager;
14+
mod sender_account;
15+
pub mod sender_accounts_manager;
16+
mod sender_allocation;
17+
mod unaggregated_receipts;
1618

1719
#[cfg(test)]
1820
pub mod test_utils;

tap-agent/src/tap/rav_storage_adapter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ impl RAVStorageAdapter {
9191
#[cfg(test)]
9292
mod test {
9393
use super::*;
94-
use crate::tap::test_utils::{create_rav, ALLOCATION_ID, SENDER, SIGNER};
94+
use crate::tap::test_utils::{create_rav, ALLOCATION_ID_0, SENDER, SIGNER};
9595
use tap_core::adapters::rav_storage_adapter::RAVStorageAdapter as RAVStorageAdapterTrait;
9696

9797
#[sqlx::test(migrations = "../migrations")]
9898
async fn update_and_retrieve_rav(pool: PgPool) {
9999
let timestamp_ns = u64::MAX - 10;
100100
let value_aggregate = u128::MAX;
101-
let rav_storage_adapter = RAVStorageAdapter::new(pool.clone(), *ALLOCATION_ID, SENDER.1);
101+
let rav_storage_adapter = RAVStorageAdapter::new(pool.clone(), *ALLOCATION_ID_0, SENDER.1);
102102

103103
// Insert a rav
104104
let mut new_rav = create_rav(
105-
*ALLOCATION_ID,
105+
*ALLOCATION_ID_0,
106106
SIGNER.0.clone(),
107107
timestamp_ns,
108108
value_aggregate,
@@ -121,7 +121,7 @@ mod test {
121121
// Update the RAV 3 times in quick succession
122122
for i in 0..3 {
123123
new_rav = create_rav(
124-
*ALLOCATION_ID,
124+
*ALLOCATION_ID_0,
125125
SIGNER.0.clone(),
126126
timestamp_ns + i,
127127
value_aggregate - (i as u128),

tap-agent/src/tap/receipt_storage_adapter.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ mod test {
194194

195195
use super::*;
196196
use crate::tap::test_utils::{
197-
create_received_receipt, store_receipt, ALLOCATION_ID, ALLOCATION_ID_IRRELEVANT, SENDER,
197+
create_received_receipt, store_receipt, ALLOCATION_ID_0, ALLOCATION_ID_IRRELEVANT, SENDER,
198198
SENDER_IRRELEVANT, SIGNER, TAP_EIP712_DOMAIN_SEPARATOR,
199199
};
200200
use anyhow::Result;
@@ -381,7 +381,7 @@ mod test {
381381

382382
let storage_adapter = ReceiptStorageAdapter::new(
383383
pgpool.clone(),
384-
*ALLOCATION_ID,
384+
*ALLOCATION_ID_0,
385385
SENDER.1,
386386
get_full_list_of_checks(),
387387
escrow_accounts.clone(),
@@ -392,7 +392,7 @@ mod test {
392392
for i in 0..10 {
393393
received_receipt_vec.push(
394394
create_received_receipt(
395-
&ALLOCATION_ID,
395+
&ALLOCATION_ID_0,
396396
&SIGNER.0,
397397
i + 684,
398398
i + 42,
@@ -416,7 +416,7 @@ mod test {
416416
);
417417
received_receipt_vec.push(
418418
create_received_receipt(
419-
&ALLOCATION_ID,
419+
&ALLOCATION_ID_0,
420420
&SENDER_IRRELEVANT.0,
421421
i + 684,
422422
i + 42,
@@ -525,7 +525,7 @@ mod test {
525525

526526
let storage_adapter = ReceiptStorageAdapter::new(
527527
pgpool,
528-
*ALLOCATION_ID,
528+
*ALLOCATION_ID_0,
529529
SENDER.1,
530530
get_full_list_of_checks(),
531531
escrow_accounts.clone(),
@@ -536,7 +536,7 @@ mod test {
536536
for i in 0..10 {
537537
received_receipt_vec.push(
538538
create_received_receipt(
539-
&ALLOCATION_ID,
539+
&ALLOCATION_ID_0,
540540
&SIGNER.0,
541541
i + 684,
542542
i + 42,
@@ -560,7 +560,7 @@ mod test {
560560
);
561561
received_receipt_vec.push(
562562
create_received_receipt(
563-
&ALLOCATION_ID,
563+
&ALLOCATION_ID_0,
564564
&SENDER_IRRELEVANT.0,
565565
i + 684,
566566
i + 42,

0 commit comments

Comments
 (0)