Skip to content

Commit 61b3c27

Browse files
authored
fix: use collection_id for database queries instead of allocation_id (#835)
* fix: use collection_id for database queries instead of allocation_id Signed-off-by: Tomás Migone <[email protected]> * ci: make cargo fmt happy Signed-off-by: Tomás Migone <[email protected]> --------- Signed-off-by: Tomás Migone <[email protected]>
1 parent aac2ad7 commit 61b3c27

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/tap-agent/src/agent/sender_allocation.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ use tap_core::{
2626
},
2727
signed_message::Eip712SignedMessage,
2828
};
29-
use thegraph_core::alloy::{hex::ToHexExt, primitives::Address, sol_types::Eip712Domain};
29+
use thegraph_core::{
30+
alloy::{hex::ToHexExt, primitives::Address, sol_types::Eip712Domain},
31+
CollectionId,
32+
};
3033
use thiserror::Error;
3134
use tokio::sync::watch::Receiver;
3235

@@ -1263,7 +1266,7 @@ impl DatabaseInteractions for SenderAllocationState<Horizon> {
12631266
"#,
12641267
BigDecimal::from(min_timestamp),
12651268
BigDecimal::from(max_timestamp),
1266-
self.allocation_id.to_string(),
1269+
CollectionId::from(self.allocation_id).encode_hex(),
12671270
self.indexer_address.encode_hex(),
12681271
&signers,
12691272
)
@@ -1288,7 +1291,7 @@ impl DatabaseInteractions for SenderAllocationState<Horizon> {
12881291
collection_id = $1
12891292
AND signer_address IN (SELECT unnest($2::text[]))
12901293
"#,
1291-
self.allocation_id.to_string(),
1294+
CollectionId::from(self.allocation_id).encode_hex(),
12921295
&signers
12931296
)
12941297
.fetch_one(&self.pgpool)
@@ -1337,7 +1340,7 @@ impl DatabaseInteractions for SenderAllocationState<Horizon> {
13371340
AND signer_address IN (SELECT unnest($4::text[]))
13381341
AND timestamp_ns > $5
13391342
"#,
1340-
self.allocation_id.to_string(),
1343+
CollectionId::from(self.allocation_id).encode_hex(),
13411344
self.indexer_address.encode_hex(),
13421345
last_id,
13431346
&signers,
@@ -1388,7 +1391,7 @@ impl DatabaseInteractions for SenderAllocationState<Horizon> {
13881391
AND payer = $2
13891392
AND service_provider = $3
13901393
"#,
1391-
self.allocation_id.to_string(),
1394+
CollectionId::from(self.allocation_id).encode_hex(),
13921395
self.sender.encode_hex(),
13931396
self.indexer_address.encode_hex(),
13941397
)

0 commit comments

Comments
 (0)