Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
388 changes: 285 additions & 103 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions services/oprf-accountant/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ repository.workspace = true
license.workspace = true

[dependencies]
alloy-primitives.workspace = true
alloy = { workspace = true, features = ["full", "rpc", "rpc-client-ws"] }
ark-babyjubjub = { workspace = true }
ark-serde-compat = { workspace = true }
ark-serialize = { workspace = true }
axum = { workspace = true, features = ["json", "macros"] }
backon = { workspace = true, features = ["std", "tokio-sleep"] }
config.workspace = true
eyre = { workspace = true }
futures-util = { workspace = true }
humantime-serde = { workspace = true }
itertools.workspace = true
metrics = { workspace = true }
rustls = { workspace = true }
secrecy = { workspace = true, features = ["serde"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
sqlx = { workspace = true, features = ["postgres", "runtime-tokio-rustls"] }
taceo-nodes-common = { workspace = true, features = ["api", "postgres"] }
taceo-nodes-common = { workspace = true, features = ["api", "postgres", "web3"] }
telemetry-batteries = { workspace = true }
thiserror.workspace = true
tokio = { workspace = true, features = [
Expand All @@ -34,8 +36,15 @@ tokio = { workspace = true, features = [
"time",
"tokio-macros",
] }
tokio-util = { workspace = true }
tracing = { workspace = true, features = ["release_max_level_debug"] }
world-id-primitives = { workspace = true }

[dev-dependencies]
taceo-nodes-common = { workspace = true, features = [
"postgres",
"test-utils",
] }

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator = { workspace = true }
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DROP TABLE IF EXISTS epoch_cursor;
DROP TABLE IF EXISTS rp_signatures;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Stores RP (relying party) signatures over proof requests so they can be verified later.
create table if not exists rp_signatures (
CREATE TABLE IF NOT EXISTS rp_signatures (
id BIGINT GENERATED ALWAYS AS identity PRIMARY KEY,
rp_id BIGINT NOT NULL,
epoch BIGINT NOT NULL,
Expand All @@ -10,10 +10,21 @@ create table if not exists rp_signatures (
signed_created_at BIGINT NOT NULL,
signed_expires_at BIGINT NOT NULL,
-- RP ECDSA (secp256k1) signature over the message (alloy Signature, 65 bytes)
signature BYTEA NOT NULL,
signature BYTEA,
-- Record insertion timestamp (bookkeeping)
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),

-- A given nonce should be signed at most once per RP (replay protection)
constraint uq_rp_signatures_rp_id_nonce unique (rp_id, nonce, epoch)
);
);

-- Singleton table holding the last epoch the accountant has fully processed (i.e. voted
-- on). `id` is pinned to `true` so there can only ever be one row. Seeded at -1 (no epoch
-- processed yet) so the first tick starts from epoch 0.
CREATE TABLE IF NOT EXISTS epoch_cursor (
id BOOLEAN PRIMARY KEY DEFAULT TRUE CHECK (id),
epoch BIGINT NOT NULL
);

INSERT INTO epoch_cursor (epoch)
VALUES (-1);
Loading
Loading