Upon receiving a notification, it mainly does the following steps:
- Fetches
(handle, compressed_ct)pairs frompbs_computationsandciphertextstables. - Computes
large_ctusing the Switch-and-Squash algorithm. - Updates the
large_ctcolumn in theciphertextstable for the corresponding handle. - Emits an event indicating the availability of the computed
large_ct.
decrypt_128 - Decrypt each large_ct and print it as a plaintext (for testing purposes only).
Runs sns-executor. See also src/bin/utils/daemon_cli.rs
The SnS key can be retrieved from the Large Objects table (pg_largeobject). Before running a worker, the sns_pk should be imported into the keys table as shown below. If the keys table is not in use, then keys can be passed with CLI param --keys_file_path
-- Example query to import sns_pk from fhevm-keys/sns_pk
-- Import the sns_pk into the Large Object storage
sns_pk_loid := lo_import('../fhevm-keys/sns_pk');
-- Update the keys table with the new Large Object OID
UPDATE keys
SET sns_pk = sns_pk_loid
WHERE sequence_number = (SELECT sequence_number FROM keys ORDER BY sequence_number DESC LIMIT 1);# Run a single instance of the worker
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/coprocessor \
cargo run --release -- \
--pg-listen-channels "event_pbs_computations" "event_ciphertext_computed" \
--pg-notify-channel "event_pbs_computed" \Notes:
host_chain_idis read directly frompbs_computations/ciphertext_digestrows.
- Using
Postgresdocker image
# Run Postgres as image, execute migrations and populate the DB instance with keys from fhevm-keys
cargo test --release -- --nocapture- Using localhost DB
# Use COPROCESSOR_TEST_LOCALHOST_RESET to execute migrations once
COPROCESSOR_TEST_LOCALHOST_RESET=1 cargo test --release -- --nocapture
# Then, on every run
COPROCESSOR_TEST_LOCALHOST=1 cargo test --release