Skip to content

Commit 97fa9bf

Browse files
authored
chore(coprocessor): cleanup ACL allow settings and metrics (#2205)
Since ACL allow settings are no longer used, remove related code, metrics and DB triggers from txn-sender. Furthermore, remove the `AddCiphertextMaterial` event from the mock contract in txn-sender as it is not being used.
1 parent c8f7e16 commit 97fa9bf

File tree

10 files changed

+4
-87
lines changed

10 files changed

+4
-87
lines changed

charts/coprocessor/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: coprocessor
22
description: A helm chart to distribute and deploy Zama fhevm Co-Processor services
3-
version: 0.8.5
3+
version: 0.8.6
44
apiVersion: v2
55
keywords:
66
- fhevm

charts/coprocessor/values.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,13 +937,10 @@ txSender:
937937
- --database-polling-interval-secs=1
938938
- --verify-proof-resp-database-channel=event_zkpok_computed
939939
- --add-ciphertexts-database-channel=event_ciphertexts_uploaded
940-
- --allow-handle-database-channel=event_allowed_handle
941940
- --verify-proof-resp-batch-limit=128
942941
- --verify-proof-resp-max-retries=6
943942
- --verify-proof-remove-after-max-retries
944943
- --add-ciphertexts-batch-limit=10
945-
- --allow-handle-batch-limit=10
946-
- --allow-handle-max-retries=2147483647
947944
- --add-ciphertexts-max-retries=2147483647
948945
- --error-sleep-initial-secs=1
949946
- --error-sleep-max-secs=4

coprocessor/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ Options:
205205
[default: event_zkpok_computed]
206206
--add-ciphertexts-database-channel <ADD_CIPHERTEXTS_DATABASE_CHANNEL>
207207
[default: event_ciphertexts_uploaded]
208-
--allow-handle-database-channel <ALLOW_HANDLE_DATABASE_CHANNEL>
209-
[default: event_allowed_handle]
210208
--verify-proof-resp-batch-limit <VERIFY_PROOF_RESP_BATCH_LIMIT>
211209
[default: 128]
212210
--verify-proof-resp-max-retries <VERIFY_PROOF_RESP_MAX_RETRIES>
@@ -215,10 +213,6 @@ Options:
215213

216214
--add-ciphertexts-batch-limit <ADD_CIPHERTEXTS_BATCH_LIMIT>
217215
[default: 10]
218-
--allow-handle-batch-limit <ALLOW_HANDLE_BATCH_LIMIT>
219-
[default: 10]
220-
--allow-handle-max-retries <ALLOW_HANDLE_MAX_RETRIES>
221-
[default: 2147483647]
222216
--add-ciphertexts-max-retries <ADD_CIPHERTEXTS_MAX_RETRIES>
223217
[default: 2147483647]
224218
--error-sleep-initial-secs <ERROR_SLEEP_INITIAL_SECS>

coprocessor/fhevm-engine/.sqlx/query-a3581b82aa78344b06e4270d0aec5ac76c2d0fa1661c1502600852450d92fe8a.json

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Drop the allowed handle notify trigger and function as they are no longer used by transaction-sender.
2+
DROP TRIGGER IF EXISTS on_insert_notify_event_allowed_handle ON allowed_handles;
3+
DROP FUNCTION IF EXISTS notify_event_allowed_handle();

coprocessor/fhevm-engine/transaction-sender/contracts/CiphertextCommits.sol

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ contract CiphertextCommits {
77
error CoprocessorAlreadyAdded(bytes32 ctHandle, address coprocessorTxSenderAddress);
88
error NotCoprocessorTxSender(address txSenderAddress);
99

10-
event AddCiphertextMaterial(
11-
bytes32 indexed ctHandle,
12-
bytes32 ciphertextDigest,
13-
bytes32 snsCiphertextDigest,
14-
address[] coprocessorTxSenderAddresses
15-
);
16-
1710
bool alreadyAddedRevert;
1811
ConfigErrorMode configErrorMode;
1912

@@ -44,11 +37,5 @@ contract CiphertextCommits {
4437
revert CoprocessorAlreadyAdded(ctHandle, msg.sender);
4538
}
4639

47-
emit AddCiphertextMaterial(
48-
ctHandle,
49-
ciphertextDigest,
50-
snsCiphertextDigest,
51-
new address[](0)
52-
);
5340
}
5441
}

coprocessor/fhevm-engine/transaction-sender/src/bin/transaction_sender.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ struct Conf {
7373
#[arg(long, default_value = "event_ciphertexts_uploaded")]
7474
add_ciphertexts_database_channel: String,
7575

76-
#[arg(long, default_value = "event_allowed_handle")]
77-
allow_handle_database_channel: String,
78-
7976
#[arg(long, default_value_t = 128)]
8077
verify_proof_resp_batch_limit: u32,
8178

@@ -88,13 +85,6 @@ struct Conf {
8885
#[arg(long, default_value_t = 10)]
8986
add_ciphertexts_batch_limit: u32,
9087

91-
#[arg(long, default_value_t = 10)]
92-
allow_handle_batch_limit: u32,
93-
94-
// For now, use i32 as that's what we have in the DB as integer type.
95-
#[arg(long, default_value_t = i32::MAX, value_parser = clap::value_parser!(i32).range(0..))]
96-
allow_handle_max_retries: i32,
97-
9888
// For now, use i32 as that's what we have in the DB as integer type.
9989
#[arg(long, default_value_t = i32::MAX, value_parser = clap::value_parser!(i32).range(0..))]
10090
add_ciphertexts_max_retries: i32,
@@ -309,7 +299,6 @@ async fn main() -> anyhow::Result<()> {
309299
let config = ConfigSettings {
310300
verify_proof_resp_db_channel: conf.verify_proof_resp_database_channel,
311301
add_ciphertexts_db_channel: conf.add_ciphertexts_database_channel,
312-
allow_handle_db_channel: conf.allow_handle_database_channel,
313302
verify_proof_resp_batch_limit: conf.verify_proof_resp_batch_limit,
314303
verify_proof_resp_max_retries: conf.verify_proof_resp_max_retries,
315304
verify_proof_remove_after_max_retries: conf.verify_proof_remove_after_max_retries,
@@ -318,8 +307,6 @@ async fn main() -> anyhow::Result<()> {
318307
error_sleep_initial_secs: conf.error_sleep_initial_secs,
319308
error_sleep_max_secs: conf.error_sleep_max_secs,
320309
add_ciphertexts_max_retries: conf.add_ciphertexts_max_retries,
321-
allow_handle_batch_limit: conf.allow_handle_batch_limit,
322-
allow_handle_max_retries: conf.allow_handle_max_retries,
323310
send_txn_sync_timeout_secs: conf.send_txn_sync_timeout_secs,
324311
review_after_unlimited_retries: conf.review_after_unlimited_retries,
325312
health_check_port: conf.health_check_port,

coprocessor/fhevm-engine/transaction-sender/src/config.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ pub const DEFAULT_GAS_LIMIT_OVERPROVISION_PERCENT: u32 = 120;
66
pub struct ConfigSettings {
77
pub verify_proof_resp_db_channel: String,
88
pub add_ciphertexts_db_channel: String,
9-
pub allow_handle_db_channel: String,
10-
119
pub verify_proof_resp_batch_limit: u32,
1210
pub verify_proof_resp_max_retries: u32,
1311
pub verify_proof_remove_after_max_retries: bool,
@@ -17,11 +15,6 @@ pub struct ConfigSettings {
1715
// For now, use i32 as that's what we have in the DB as integer type.
1816
pub add_ciphertexts_max_retries: i32,
1917

20-
pub allow_handle_batch_limit: u32,
21-
22-
// For now, use i32 as that's what we have in the DB as integer type.
23-
pub allow_handle_max_retries: i32,
24-
2518
pub db_polling_interval_secs: u16,
2619

2720
pub error_sleep_initial_secs: u16,
@@ -45,7 +38,6 @@ impl Default for ConfigSettings {
4538
Self {
4639
verify_proof_resp_db_channel: "event_zkpok_computed".to_owned(),
4740
add_ciphertexts_db_channel: "event_ciphertexts_uploaded".to_owned(),
48-
allow_handle_db_channel: "event_allowed_handle".to_owned(),
4941
verify_proof_resp_batch_limit: 128,
5042
verify_proof_resp_max_retries: 6,
5143
verify_proof_remove_after_max_retries: true,
@@ -54,8 +46,6 @@ impl Default for ConfigSettings {
5446
error_sleep_max_secs: 4,
5547
add_ciphertexts_batch_limit: 10,
5648
add_ciphertexts_max_retries: i32::MAX,
57-
allow_handle_batch_limit: 10,
58-
allow_handle_max_retries: i32::MAX,
5949
send_txn_sync_timeout_secs: 4,
6050
review_after_unlimited_retries: 30,
6151
health_check_port: 8080,

coprocessor/fhevm-engine/transaction-sender/src/metrics.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,6 @@ pub(crate) static ADD_CIPHERTEXT_MATERIAL_FAIL_COUNTER: LazyLock<IntCounter> =
3838
.unwrap()
3939
});
4040

41-
pub(crate) static ALLOW_HANDLE_UNSENT: LazyLock<IntGauge> = LazyLock::new(|| {
42-
register_int_gauge!(
43-
"coprocessor_allow_handle_unsent_gauge",
44-
"Number of unsent allow handle transactions"
45-
)
46-
.unwrap()
47-
});
48-
4941
pub(crate) static ADD_CIPHERTEXT_MATERIAL_UNSENT: LazyLock<IntGauge> = LazyLock::new(|| {
5042
register_int_gauge!(
5143
"coprocessor_add_ciphertext_material_unsent_gauge",
@@ -73,21 +65,6 @@ pub(crate) static VERIFY_PROOF_PENDING: LazyLock<IntGauge> = LazyLock::new(|| {
7365
pub fn spawn_gauge_update_routine(period: std::time::Duration, db_pool: PgPool) -> JoinHandle<()> {
7466
tokio::spawn(async move {
7567
loop {
76-
match sqlx::query_scalar(
77-
"SELECT COUNT(*) FROM allowed_handles WHERE txn_is_sent = FALSE",
78-
)
79-
.fetch_one(&db_pool)
80-
.await
81-
{
82-
Ok(count) => {
83-
info!(unsent_allow_handle_count = %count, "Fetched unsent allow handle count");
84-
ALLOW_HANDLE_UNSENT.set(count);
85-
}
86-
Err(e) => {
87-
error!(error = %e, "Failed to fetch unsent allow handle count");
88-
}
89-
}
90-
9168
match sqlx::query_scalar(
9269
"SELECT COUNT(*) FROM ciphertext_digest WHERE txn_is_sent = FALSE",
9370
)

docs/metrics/metrics.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ Note that recommendations assume a smoke test that runs transactions/requests at
3434
- **Alarm**: If the counter increases over a period of time.
3535
- **Recommendation**: more than 60 failures in 1 minute, i.e. `increase(counter[1m]) > 60`.
3636

37-
#### Metric Name: `coprocessor_allow_handle_unsent_gauge`
38-
- **Type**: Gauge
39-
- **Description**: Tracks the number of unsent allow handle transactions in the transaction-sender.
40-
- **Alarm**: If the gauge value exceeds a predefined threshold.
41-
- **Recommendation**: more than 100 unsent over 2 minutes, i.e. `min_over_time(gauge[2m]) > 100`.
42-
4337
#### Metric Name: `coprocessor_add_ciphertext_material_unsent_gauge`
4438
- **Type**: Gauge
4539
- **Description**: Tracks the number of unsent add ciphertext material transactions in the transaction-sender.

0 commit comments

Comments
 (0)