Skip to content

Commit c1734eb

Browse files
committed
remove signature
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent 5a43a57 commit c1734eb

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

common/src/indexer_service/http/request_handler.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ where
5555

5656
let attestation_signer = if let Some(receipt) = receipt.into_signed_receipt() {
5757
let allocation_id = receipt.message.allocation_id;
58-
let signature = receipt.signature;
5958

6059
let request: QueryBody = serde_json::from_slice(&body)
6160
.map_err(|e| IndexerServiceError::InvalidRequest(e.into()))?;
@@ -66,7 +65,6 @@ where
6665
.unwrap_or_default();
6766
let mut ctx = Context::new();
6867
ctx.insert(AgoraQuery {
69-
signature,
7068
deployment_id: manifest_id,
7169
query: request.query.clone(),
7270
variables,

common/src/tap/checks/value_check.rs

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// Copyright 2023-, GraphOps and Semiotic Labs.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use alloy::signers::Signature;
54
use anyhow::anyhow;
65
use bigdecimal::ToPrimitive;
76
use cost_model::CostModel;
7+
use sqlx::{postgres::PgListener, PgPool};
8+
use tracing::error;
89
use std::{
910
cmp::min,
1011
collections::HashMap,
@@ -89,6 +90,67 @@ impl MinimumValue {
8990
model_handle,
9091
}
9192
}
93+
94+
async fn cost_models_watcher(
95+
pgpool: PgPool,
96+
mut pglistener: PgListener,
97+
denylist: Arc<Mutex<HashMap<DeploymentId, CostModelCache>>>,
98+
cancel_token: tokio_util::sync::CancellationToken,
99+
) {
100+
#[derive(serde::Deserialize)]
101+
struct DenylistNotification {
102+
tg_op: String,
103+
deployment: DeploymentId,
104+
}
105+
106+
loop {
107+
tokio::select! {
108+
_ = cancel_token.cancelled() => {
109+
break;
110+
}
111+
112+
pg_notification = pglistener.recv() => {
113+
let pg_notification = pg_notification.expect(
114+
"should be able to receive Postgres Notify events on the channel \
115+
'scalar_tap_deny_notification'",
116+
);
117+
118+
let denylist_notification: DenylistNotification =
119+
serde_json::from_str(pg_notification.payload()).expect(
120+
"should be able to deserialize the Postgres Notify event payload as a \
121+
DenylistNotification",
122+
);
123+
124+
match denylist_notification.tg_op.as_str() {
125+
"INSERT" => {
126+
denylist
127+
.write()
128+
.unwrap()
129+
.insert(denylist_notification.sender_address);
130+
}
131+
"DELETE" => {
132+
denylist
133+
.write()
134+
.unwrap()
135+
.remove(&denylist_notification.sender_address);
136+
}
137+
// UPDATE and TRUNCATE are not expected to happen. Reload the entire denylist.
138+
_ => {
139+
error!(
140+
"Received an unexpected denylist table notification: {}. Reloading entire \
141+
denylist.",
142+
denylist_notification.tg_op
143+
);
144+
145+
Self::sender_denylist_reload(pgpool.clone(), denylist.clone())
146+
.await
147+
.expect("should be able to reload the sender denylist")
148+
}
149+
}
150+
}
151+
}
152+
}
153+
}
92154
}
93155

94156
impl Drop for MinimumValue {
@@ -155,7 +217,6 @@ fn compile_cost_model(src: CostModelSource) -> anyhow::Result<CostModel> {
155217
}
156218

157219
pub struct AgoraQuery {
158-
pub signature: Signature,
159220
pub deployment_id: DeploymentId,
160221
pub query: String,
161222
pub variables: String,

0 commit comments

Comments
 (0)