Skip to content

Commit a92b899

Browse files
authored
fix(coprocessor): add missing indices for ciphertext_digest table (#1450)
* `idx_ciphertext_digest_handle` - we want the txn-sender to select by handle only * `idx_ciphertext_digest_unsent` - we want the txn-sender to select unsent txns with ordered limited retries efficiently Furthermore, add fair ordering of rows in the ciphertext_digest table by tracking when entries are created and order by that in the txn-sender. Also, update the `svm-rs-builds` dependency to fix an issue with it failing to fetch 0.8.31 prerelease version during build time from the Soliditylang JSON file.
1 parent cf1d385 commit a92b899

File tree

5 files changed

+34
-16
lines changed

5 files changed

+34
-16
lines changed
Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/Cargo.lock

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Track when entries are created for fair queuing of unsent transactions.
2+
ALTER TABLE ciphertext_digest
3+
ADD COLUMN IF NOT EXISTS created_at TIMESTAMP NOT NULL DEFAULT NOW();
4+
5+
-- Handle SELECTs on handle only by the txn-sender.
6+
CREATE INDEX IF NOT EXISTS idx_ciphertext_digest_handle
7+
ON ciphertext_digest (handle);
8+
9+
-- Handle SELECTs on unsent txns with limited retries by the txn-sender.
10+
CREATE INDEX IF NOT EXISTS idx_ciphertext_digest_unsent
11+
ON ciphertext_digest (txn_is_sent, created_at);

coprocessor/fhevm-engine/transaction-sender/src/ops/add_ciphertext.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ where
310310
AND ciphertext IS NOT NULL
311311
AND ciphertext128 IS NOT NULL
312312
AND txn_limited_retries_count < $1
313+
ORDER BY created_at ASC
313314
LIMIT $2",
314315
self.conf.add_ciphertexts_max_retries,
315316
self.conf.add_ciphertexts_batch_limit as i64,

0 commit comments

Comments
 (0)