From 62c274f9d77ffab59c0d5ff7aef8d3f1dd3a47b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Fri, 20 Jun 2025 13:28:26 -0300 Subject: [PATCH 1/2] fix: replace allocation id with collection id in migrations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- migrations/20250131122241_tap_horizon_receipts.up.sql | 8 ++++---- migrations/20250210152412_tap_horizon_ravs.up.sql | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/migrations/20250131122241_tap_horizon_receipts.up.sql b/migrations/20250131122241_tap_horizon_receipts.up.sql index 02df77256..c442b1f9e 100644 --- a/migrations/20250131122241_tap_horizon_receipts.up.sql +++ b/migrations/20250131122241_tap_horizon_receipts.up.sql @@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS tap_horizon_receipts ( -- Values below are the individual fields of the EIP-712 receipt signature BYTEA NOT NULL, - allocation_id CHAR(40) NOT NULL, + collection_id CHAR(64) NOT NULL, payer CHAR(40) NOT NULL, data_service CHAR(40) NOT NULL, service_provider CHAR(40) NOT NULL, @@ -14,14 +14,14 @@ CREATE TABLE IF NOT EXISTS tap_horizon_receipts ( value NUMERIC(39) NOT NULL ); -CREATE INDEX IF NOT EXISTS tap_horizon_receipts_allocation_id_idx ON tap_horizon_receipts (allocation_id); +CREATE INDEX IF NOT EXISTS tap_horizon_receipts_collection_id_idx ON tap_horizon_receipts (collection_id); CREATE INDEX IF NOT EXISTS tap_horizon_receipts_timestamp_ns_idx ON tap_horizon_receipts (timestamp_ns); CREATE FUNCTION tap_horizon_receipt_notify() RETURNS trigger AS $$ BEGIN - PERFORM pg_notify('tap_horizon_receipt_notification', format('{"id": %s, "allocation_id": "%s", "signer_address": "%s", "timestamp_ns": %s, "value": %s}', NEW.id, NEW.allocation_id, NEW.signer_address, NEW.timestamp_ns, NEW.value)); + PERFORM pg_notify('tap_horizon_receipt_notification', format('{"id": %s, "collection_id": "%s", "signer_address": "%s", "timestamp_ns": %s, "value": %s}', NEW.id, NEW.collection_id, NEW.signer_address, NEW.timestamp_ns, NEW.value)); RETURN NEW; END; $$ LANGUAGE 'plpgsql'; @@ -39,7 +39,7 @@ CREATE TABLE IF NOT EXISTS tap_horizon_receipts_invalid ( -- Values below are the individual fields of the EIP-712 receipt signature BYTEA NOT NULL, - allocation_id CHAR(40) NOT NULL, + collection_id CHAR(64) NOT NULL, payer CHAR(40) NOT NULL, data_service CHAR(40) NOT NULL, service_provider CHAR(40) NOT NULL, diff --git a/migrations/20250210152412_tap_horizon_ravs.up.sql b/migrations/20250210152412_tap_horizon_ravs.up.sql index a59418b67..418cfdc75 100644 --- a/migrations/20250210152412_tap_horizon_ravs.up.sql +++ b/migrations/20250210152412_tap_horizon_ravs.up.sql @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS tap_horizon_ravs ( -- Values below are the individual fields of the EIP-712 RAV signature BYTEA NOT NULL, - allocation_id CHAR(40) NOT NULL, + collection_id CHAR(64) NOT NULL, payer CHAR(40) NOT NULL, data_service CHAR(40) NOT NULL, service_provider CHAR(40) NOT NULL, @@ -12,9 +12,10 @@ CREATE TABLE IF NOT EXISTS tap_horizon_ravs ( last BOOLEAN DEFAULT FALSE NOT NULL, final BOOLEAN DEFAULT FALSE NOT NULL, - PRIMARY KEY (payer, data_service, service_provider, allocation_id), + PRIMARY KEY (payer, data_service, service_provider, collection_id), -- To make indexer-agent's sequelize happy + redeemed_at TIMESTAMP WITH TIME ZONE, created_at TIMESTAMP WITH TIME ZONE, updated_at TIMESTAMP WITH TIME ZONE ); @@ -23,7 +24,7 @@ CREATE TABLE IF NOT EXISTS tap_horizon_ravs ( -- Used for logging and debugging purposes. CREATE TABLE IF NOT EXISTS tap_horizon_rav_requests_failed ( id BIGSERIAL PRIMARY KEY, - allocation_id CHAR(40) NOT NULL, + collection_id CHAR(64) NOT NULL, payer CHAR(40) NOT NULL, data_service CHAR(40) NOT NULL, service_provider CHAR(40) NOT NULL, From 152b23d23f157e4295e5f5183f3f2914dfaa1ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Mon, 23 Jun 2025 12:15:23 -0300 Subject: [PATCH 2/2] wip: allocation id to collection id for horizon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- ...e98e97e45684d9a1ba867e7c5050eadda560.json} | 4 +- ...a1f84f9555e6b55d9dcf9a5a3305d0e239126.json | 56 ------ ...60023577bbbdbab7a83788204d066bdd9fec5.json | 12 -- ...0817f582abaec68e1ba01d55daee1e1edcbbd.json | 26 --- ...e469cd7bc10a39e7c94f2b3d57946e4a060ff.json | 68 -------- ...cbc51b1353880d211de44325a62c2b1f94405.json | 44 ----- ...23ba3e5b034fadec433945e4718032d1b023.json} | 6 +- ...ddc1646e68d6db58124b6e0d780c037f73513.json | 160 ------------------ ...e72f26fad65b8e3cbb706bc17bb7140e47192.json | 14 -- ...cc0b8ef122bd08f064338d23e3061cfe402a.json} | 6 +- ...d07007990cc244f598b763ec5470515efe019.json | 62 ------- ...f6ed0cd31da6b57918a2d600ef90adce1345d.json | 20 --- ...456055d5ebda5cb136d9d015f101ebbfe495f.json | 56 ------ ...7e871955e9eb8a0a6f8b9f23a3f38597793f6.json | 62 ------- ...7e761625a862578b61ce925910c351edbbda8.json | 70 -------- ...b130e4d7414aa9038581f0ccaf079c8fc0ab.json} | 4 +- ...57dbf78225c58f68e5f1b581f4f13c8678268.json | 27 --- ...a5b4ace9acc032be502cd1d9fc72c5b9ed50a.json | 26 --- ...edc4204bbbd32aac6f7da7e99fb501ca5cc14.json | 2 +- ...e8a19c2197f08d576e5cbf978e39432bb3d5a.json | 30 ---- ...159932331aaf7fe2fd7fdbb5df04485ec91ec.json | 12 -- ...c2e847f24a2e086abcbe8e7be618f84d58f78.json | 16 -- ...ee551ece8619860f3fbcb184ebded33898cbd.json | 35 ---- ...a1732bb3638a3a4f942a665cf1fd38eb70c2d.json | 2 +- ...3431e1a0c922742d1c7a14e828f5953713f5.json} | 4 +- ...2cc59876e13468b43b3fb5860592918e647f0.json | 14 -- ...651e43b6b9ffe9834df85a62707d3a2d051b4.json | 2 +- ...a24471d24c11c957f986144ed04694024e922.json | 20 --- ...bc7c298006af22134c144048b0ac7183353c0.json | 12 -- ...3cc7ff7349af9afcf283399ff278bec0abefa.json | 20 --- ...4651cfd94b4b82f26baf0755efa80e6045c0a.json | 2 +- ...893b4f7209c985c367215b2eed25adc78c462.json | 15 -- ...9872832048b338237c786727a6c9173e23b38.json | 66 -------- ...66c4b7e60ca1a6c09920cd9194de913fe6307.json | 27 --- ...b4e24c08d5763d97da4e2ec759c30d6170a68.json | 23 --- ...9e04328fb1e758a0b538319c5fb132251a7ed.json | 38 ----- Cargo.lock | 71 ++++---- Cargo.toml | 6 +- crates/indexer-receipt/src/lib.rs | 23 ++- .../src/tap/checks/allocation_eligible.rs | 6 +- crates/service/src/tap/receipt_store.rs | 14 +- crates/tap-agent/src/agent/sender_account.rs | 7 +- .../src/agent/sender_accounts_manager.rs | 26 +-- .../tap-agent/src/agent/sender_allocation.rs | 26 +-- .../src/tap/context/checks/allocation_id.rs | 7 +- crates/tap-agent/src/tap/context/rav.rs | 21 +-- crates/tap-agent/src/tap/context/receipt.rs | 25 +-- crates/test-assets/src/lib.rs | 12 +- 48 files changed, 151 insertions(+), 1156 deletions(-) rename .sqlx/{query-cd279b9b74e3efdb79ece086b1e6713d2fc766e6553568df8c6ab1d39a5282f6.json => query-0924b9278fc18e29b3880720abf4e98e97e45684d9a1ba867e7c5050eadda560.json} (78%) delete mode 100644 .sqlx/query-0e91bdaef6302f57fbea7b4f55ca1f84f9555e6b55d9dcf9a5a3305d0e239126.json delete mode 100644 .sqlx/query-10bd83671f30f7bc2096e9158be60023577bbbdbab7a83788204d066bdd9fec5.json delete mode 100644 .sqlx/query-386e6b18da62b478ccdba5439490817f582abaec68e1ba01d55daee1e1edcbbd.json delete mode 100644 .sqlx/query-3d76b9e04b0c09999c5653e4176e469cd7bc10a39e7c94f2b3d57946e4a060ff.json delete mode 100644 .sqlx/query-439265d98b8301eec00664222eccbc51b1353880d211de44325a62c2b1f94405.json rename .sqlx/{query-b94514ce9abc8be15ba3b5a67f33ead0d83e409210ce5e711932bcb32888f2bf.json => query-46cc101d5149337de6e6d7f28fd523ba3e5b034fadec433945e4718032d1b023.json} (88%) delete mode 100644 .sqlx/query-47f848e049f3ff22e65bb53edc7ddc1646e68d6db58124b6e0d780c037f73513.json delete mode 100644 .sqlx/query-48e85bc0089528df458970d0aeee72f26fad65b8e3cbb706bc17bb7140e47192.json rename .sqlx/{query-27a9c5a16714c8551c8921e4012bceda54664d0f41228f60b3a0f7f601cf9923.json => query-4f841a3df3b3774658b7aa68e68acc0b8ef122bd08f064338d23e3061cfe402a.json} (76%) delete mode 100644 .sqlx/query-56c3678866ffe0ec2eed7290394d07007990cc244f598b763ec5470515efe019.json delete mode 100644 .sqlx/query-5f0c42c9a92a446d37b2971175df6ed0cd31da6b57918a2d600ef90adce1345d.json delete mode 100644 .sqlx/query-6c05fc541bf0bb2af20fbe62747456055d5ebda5cb136d9d015f101ebbfe495f.json delete mode 100644 .sqlx/query-6ce2133a20924d5098fa2e27f897e871955e9eb8a0a6f8b9f23a3f38597793f6.json delete mode 100644 .sqlx/query-6fc518e6b980f6dcc160d8310fc7e761625a862578b61ce925910c351edbbda8.json rename .sqlx/{query-eef0d4e41d62691f9987cf4a086da379c5d5c363f378b31f226444a6b808a239.json => query-7056483e39f0e03aa5797ad7382fb130e4d7414aa9038581f0ccaf079c8fc0ab.json} (81%) delete mode 100644 .sqlx/query-74656664f9b27c28a8726800d7e57dbf78225c58f68e5f1b581f4f13c8678268.json delete mode 100644 .sqlx/query-7bf9c412120de537eecb8efb64da5b4ace9acc032be502cd1d9fc72c5b9ed50a.json delete mode 100644 .sqlx/query-8b904cecdd8e9c5dd0cd8a0dbc2e8a19c2197f08d576e5cbf978e39432bb3d5a.json delete mode 100644 .sqlx/query-8e0a94a7385212c8bd515a77671159932331aaf7fe2fd7fdbb5df04485ec91ec.json delete mode 100644 .sqlx/query-9a11e8e814e42113c91050acf54c2e847f24a2e086abcbe8e7be618f84d58f78.json delete mode 100644 .sqlx/query-b467894d499541f2bca15965f38ee551ece8619860f3fbcb184ebded33898cbd.json rename .sqlx/{query-5ee76e76f4ace2dbab69fd58eaf7f0539d2ffab1289130555dba0f6fdc3065ff.json => query-b5c7a7f7d9fc5e06ee54bc5cce913431e1a0c922742d1c7a14e828f5953713f5.json} (82%) delete mode 100644 .sqlx/query-b5eeb6b9501c2f2ca883040d9f62cc59876e13468b43b3fb5860592918e647f0.json delete mode 100644 .sqlx/query-dc8cea825babfaadfc1845481c1a24471d24c11c957f986144ed04694024e922.json delete mode 100644 .sqlx/query-dcc710ebd4fa7a86f95a45ebf13bc7c298006af22134c144048b0ac7183353c0.json delete mode 100644 .sqlx/query-df0ec56dbd903b38581efc492c93cc7ff7349af9afcf283399ff278bec0abefa.json delete mode 100644 .sqlx/query-ef6affb9039ad19a69f4a5116d7893b4f7209c985c367215b2eed25adc78c462.json delete mode 100644 .sqlx/query-f02805d423945f35b93dde58db49872832048b338237c786727a6c9173e23b38.json delete mode 100644 .sqlx/query-f427b53120026e6df1e41ca864866c4b7e60ca1a6c09920cd9194de913fe6307.json delete mode 100644 .sqlx/query-f65b5a6c2149155d69fb1f187ebb4e24c08d5763d97da4e2ec759c30d6170a68.json delete mode 100644 .sqlx/query-fa31900971e23fdf98dd48fcd649e04328fb1e758a0b538319c5fb132251a7ed.json diff --git a/.sqlx/query-cd279b9b74e3efdb79ece086b1e6713d2fc766e6553568df8c6ab1d39a5282f6.json b/.sqlx/query-0924b9278fc18e29b3880720abf4e98e97e45684d9a1ba867e7c5050eadda560.json similarity index 78% rename from .sqlx/query-cd279b9b74e3efdb79ece086b1e6713d2fc766e6553568df8c6ab1d39a5282f6.json rename to .sqlx/query-0924b9278fc18e29b3880720abf4e98e97e45684d9a1ba867e7c5050eadda560.json index 6a50789b9..f6797a373 100644 --- a/.sqlx/query-cd279b9b74e3efdb79ece086b1e6713d2fc766e6553568df8c6ab1d39a5282f6.json +++ b/.sqlx/query-0924b9278fc18e29b3880720abf4e98e97e45684d9a1ba867e7c5050eadda560.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n DELETE FROM tap_horizon_receipts\n WHERE\n allocation_id = $1\n AND signer_address IN (SELECT unnest($2::text[]))\n AND $3::numrange @> timestamp_ns\n AND payer = $4\n AND service_provider = $5\n ", + "query": "\n DELETE FROM tap_horizon_receipts\n WHERE\n collection_id = $1\n AND signer_address IN (SELECT unnest($2::text[]))\n AND $3::numrange @> timestamp_ns\n AND payer = $4\n AND service_provider = $5\n ", "describe": { "columns": [], "parameters": { @@ -14,5 +14,5 @@ }, "nullable": [] }, - "hash": "cd279b9b74e3efdb79ece086b1e6713d2fc766e6553568df8c6ab1d39a5282f6" + "hash": "0924b9278fc18e29b3880720abf4e98e97e45684d9a1ba867e7c5050eadda560" } diff --git a/.sqlx/query-0e91bdaef6302f57fbea7b4f55ca1f84f9555e6b55d9dcf9a5a3305d0e239126.json b/.sqlx/query-0e91bdaef6302f57fbea7b4f55ca1f84f9555e6b55d9dcf9a5a3305d0e239126.json deleted file mode 100644 index ba0866162..000000000 --- a/.sqlx/query-0e91bdaef6302f57fbea7b4f55ca1f84f9555e6b55d9dcf9a5a3305d0e239126.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT * FROM scalar_tap_receipts;\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "signer_address", - "type_info": "Bpchar" - }, - { - "ordinal": 2, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 3, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 4, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 5, - "name": "nonce", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "value", - "type_info": "Numeric" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "0e91bdaef6302f57fbea7b4f55ca1f84f9555e6b55d9dcf9a5a3305d0e239126" -} diff --git a/.sqlx/query-10bd83671f30f7bc2096e9158be60023577bbbdbab7a83788204d066bdd9fec5.json b/.sqlx/query-10bd83671f30f7bc2096e9158be60023577bbbdbab7a83788204d066bdd9fec5.json deleted file mode 100644 index 58f05261d..000000000 --- a/.sqlx/query-10bd83671f30f7bc2096e9158be60023577bbbdbab7a83788204d066bdd9fec5.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n DELETE FROM tap_horizon_receipts\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [] - }, - "nullable": [] - }, - "hash": "10bd83671f30f7bc2096e9158be60023577bbbdbab7a83788204d066bdd9fec5" -} diff --git a/.sqlx/query-386e6b18da62b478ccdba5439490817f582abaec68e1ba01d55daee1e1edcbbd.json b/.sqlx/query-386e6b18da62b478ccdba5439490817f582abaec68e1ba01d55daee1e1edcbbd.json deleted file mode 100644 index 0dd3c43d1..000000000 --- a/.sqlx/query-386e6b18da62b478ccdba5439490817f582abaec68e1ba01d55daee1e1edcbbd.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n payer,\n ARRAY_AGG(DISTINCT allocation_id) FILTER (WHERE NOT last) AS allocation_ids\n FROM tap_horizon_ravs\n GROUP BY payer\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "payer", - "type_info": "Bpchar" - }, - { - "ordinal": 1, - "name": "allocation_ids", - "type_info": "BpcharArray" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - null - ] - }, - "hash": "386e6b18da62b478ccdba5439490817f582abaec68e1ba01d55daee1e1edcbbd" -} diff --git a/.sqlx/query-3d76b9e04b0c09999c5653e4176e469cd7bc10a39e7c94f2b3d57946e4a060ff.json b/.sqlx/query-3d76b9e04b0c09999c5653e4176e469cd7bc10a39e7c94f2b3d57946e4a060ff.json deleted file mode 100644 index aecfd0e24..000000000 --- a/.sqlx/query-3d76b9e04b0c09999c5653e4176e469cd7bc10a39e7c94f2b3d57946e4a060ff.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT * FROM scalar_tap_ravs WHERE last;\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "sender_address", - "type_info": "Bpchar" - }, - { - "ordinal": 1, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 2, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 3, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 4, - "name": "value_aggregate", - "type_info": "Numeric" - }, - { - "ordinal": 5, - "name": "last", - "type_info": "Bool" - }, - { - "ordinal": 6, - "name": "final", - "type_info": "Bool" - }, - { - "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 8, - "name": "updated_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true - ] - }, - "hash": "3d76b9e04b0c09999c5653e4176e469cd7bc10a39e7c94f2b3d57946e4a060ff" -} diff --git a/.sqlx/query-439265d98b8301eec00664222eccbc51b1353880d211de44325a62c2b1f94405.json b/.sqlx/query-439265d98b8301eec00664222eccbc51b1353880d211de44325a62c2b1f94405.json deleted file mode 100644 index f308aece5..000000000 --- a/.sqlx/query-439265d98b8301eec00664222eccbc51b1353880d211de44325a62c2b1f94405.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT signature, allocation_id, timestamp_ns, nonce, value\n FROM scalar_tap_receipts\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 1, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 2, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 3, - "name": "nonce", - "type_info": "Numeric" - }, - { - "ordinal": 4, - "name": "value", - "type_info": "Numeric" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false, - false, - false - ] - }, - "hash": "439265d98b8301eec00664222eccbc51b1353880d211de44325a62c2b1f94405" -} diff --git a/.sqlx/query-b94514ce9abc8be15ba3b5a67f33ead0d83e409210ce5e711932bcb32888f2bf.json b/.sqlx/query-46cc101d5149337de6e6d7f28fd523ba3e5b034fadec433945e4718032d1b023.json similarity index 88% rename from .sqlx/query-b94514ce9abc8be15ba3b5a67f33ead0d83e409210ce5e711932bcb32888f2bf.json rename to .sqlx/query-46cc101d5149337de6e6d7f28fd523ba3e5b034fadec433945e4718032d1b023.json index 08847c569..d3fda34bf 100644 --- a/.sqlx/query-b94514ce9abc8be15ba3b5a67f33ead0d83e409210ce5e711932bcb32888f2bf.json +++ b/.sqlx/query-46cc101d5149337de6e6d7f28fd523ba3e5b034fadec433945e4718032d1b023.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT \n id,\n signature,\n allocation_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n nonce,\n value\n FROM tap_horizon_receipts\n WHERE\n allocation_id = $1\n AND payer = $2\n AND service_provider = $3\n AND signer_address IN (SELECT unnest($4::text[]))\n AND $5::numrange @> timestamp_ns\n ORDER BY timestamp_ns ASC\n LIMIT $6\n ", + "query": "\n SELECT \n id,\n signature,\n collection_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n nonce,\n value\n FROM tap_horizon_receipts\n WHERE\n collection_id = $1\n AND payer = $2\n AND service_provider = $3\n AND signer_address IN (SELECT unnest($4::text[]))\n AND $5::numrange @> timestamp_ns\n ORDER BY timestamp_ns ASC\n LIMIT $6\n ", "describe": { "columns": [ { @@ -15,7 +15,7 @@ }, { "ordinal": 2, - "name": "allocation_id", + "name": "collection_id", "type_info": "Bpchar" }, { @@ -71,5 +71,5 @@ false ] }, - "hash": "b94514ce9abc8be15ba3b5a67f33ead0d83e409210ce5e711932bcb32888f2bf" + "hash": "46cc101d5149337de6e6d7f28fd523ba3e5b034fadec433945e4718032d1b023" } diff --git a/.sqlx/query-47f848e049f3ff22e65bb53edc7ddc1646e68d6db58124b6e0d780c037f73513.json b/.sqlx/query-47f848e049f3ff22e65bb53edc7ddc1646e68d6db58124b6e0d780c037f73513.json deleted file mode 100644 index 96e66a3d0..000000000 --- a/.sqlx/query-47f848e049f3ff22e65bb53edc7ddc1646e68d6db58124b6e0d780c037f73513.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT * FROM indexing_agreements WHERE id = $1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 2, - "name": "signed_payload", - "type_info": "Bytea" - }, - { - "ordinal": 3, - "name": "protocol_network", - "type_info": "Varchar" - }, - { - "ordinal": 4, - "name": "chain_id", - "type_info": "Varchar" - }, - { - "ordinal": 5, - "name": "base_price_per_epoch", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "price_per_entity", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "subgraph_deployment_id", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "service", - "type_info": "Bpchar" - }, - { - "ordinal": 9, - "name": "payee", - "type_info": "Bpchar" - }, - { - "ordinal": 10, - "name": "payer", - "type_info": "Bpchar" - }, - { - "ordinal": 11, - "name": "deadline", - "type_info": "Timestamptz" - }, - { - "ordinal": 12, - "name": "duration_epochs", - "type_info": "Int8" - }, - { - "ordinal": 13, - "name": "max_initial_amount", - "type_info": "Numeric" - }, - { - "ordinal": 14, - "name": "max_ongoing_amount_per_epoch", - "type_info": "Numeric" - }, - { - "ordinal": 15, - "name": "min_epochs_per_collection", - "type_info": "Int8" - }, - { - "ordinal": 16, - "name": "max_epochs_per_collection", - "type_info": "Int8" - }, - { - "ordinal": 17, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 18, - "name": "updated_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 19, - "name": "cancelled_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 20, - "name": "signed_cancellation_payload", - "type_info": "Bytea" - }, - { - "ordinal": 21, - "name": "current_allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 22, - "name": "last_allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 23, - "name": "last_payment_collected_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - true, - true, - true, - true - ] - }, - "hash": "47f848e049f3ff22e65bb53edc7ddc1646e68d6db58124b6e0d780c037f73513" -} diff --git a/.sqlx/query-48e85bc0089528df458970d0aeee72f26fad65b8e3cbb706bc17bb7140e47192.json b/.sqlx/query-48e85bc0089528df458970d0aeee72f26fad65b8e3cbb706bc17bb7140e47192.json deleted file mode 100644 index 77adeb108..000000000 --- a/.sqlx/query-48e85bc0089528df458970d0aeee72f26fad65b8e3cbb706bc17bb7140e47192.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO scalar_tap_denylist (sender_address)\n VALUES ($1)\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Bpchar" - ] - }, - "nullable": [] - }, - "hash": "48e85bc0089528df458970d0aeee72f26fad65b8e3cbb706bc17bb7140e47192" -} diff --git a/.sqlx/query-27a9c5a16714c8551c8921e4012bceda54664d0f41228f60b3a0f7f601cf9923.json b/.sqlx/query-4f841a3df3b3774658b7aa68e68acc0b8ef122bd08f064338d23e3061cfe402a.json similarity index 76% rename from .sqlx/query-27a9c5a16714c8551c8921e4012bceda54664d0f41228f60b3a0f7f601cf9923.json rename to .sqlx/query-4f841a3df3b3774658b7aa68e68acc0b8ef122bd08f064338d23e3061cfe402a.json index 6a5e4b13a..673b3386d 100644 --- a/.sqlx/query-27a9c5a16714c8551c8921e4012bceda54664d0f41228f60b3a0f7f601cf9923.json +++ b/.sqlx/query-4f841a3df3b3774658b7aa68e68acc0b8ef122bd08f064338d23e3061cfe402a.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT allocation_id, value_aggregate\n FROM tap_horizon_ravs\n WHERE payer = $1 AND last AND NOT final;\n ", + "query": "\n SELECT collection_id, value_aggregate\n FROM tap_horizon_ravs\n WHERE payer = $1 AND last AND NOT final;\n ", "describe": { "columns": [ { "ordinal": 0, - "name": "allocation_id", + "name": "collection_id", "type_info": "Bpchar" }, { @@ -24,5 +24,5 @@ false ] }, - "hash": "27a9c5a16714c8551c8921e4012bceda54664d0f41228f60b3a0f7f601cf9923" + "hash": "4f841a3df3b3774658b7aa68e68acc0b8ef122bd08f064338d23e3061cfe402a" } diff --git a/.sqlx/query-56c3678866ffe0ec2eed7290394d07007990cc244f598b763ec5470515efe019.json b/.sqlx/query-56c3678866ffe0ec2eed7290394d07007990cc244f598b763ec5470515efe019.json deleted file mode 100644 index 698533680..000000000 --- a/.sqlx/query-56c3678866ffe0ec2eed7290394d07007990cc244f598b763ec5470515efe019.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT * FROM scalar_tap_receipts_invalid;\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "signer_address", - "type_info": "Bpchar" - }, - { - "ordinal": 2, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 3, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 4, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 5, - "name": "nonce", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "value", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "error_log", - "type_info": "Text" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "56c3678866ffe0ec2eed7290394d07007990cc244f598b763ec5470515efe019" -} diff --git a/.sqlx/query-5f0c42c9a92a446d37b2971175df6ed0cd31da6b57918a2d600ef90adce1345d.json b/.sqlx/query-5f0c42c9a92a446d37b2971175df6ed0cd31da6b57918a2d600ef90adce1345d.json deleted file mode 100644 index a38315f93..000000000 --- a/.sqlx/query-5f0c42c9a92a446d37b2971175df6ed0cd31da6b57918a2d600ef90adce1345d.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT count(*)\n FROM tap_horizon_receipts\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "count", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - null - ] - }, - "hash": "5f0c42c9a92a446d37b2971175df6ed0cd31da6b57918a2d600ef90adce1345d" -} diff --git a/.sqlx/query-6c05fc541bf0bb2af20fbe62747456055d5ebda5cb136d9d015f101ebbfe495f.json b/.sqlx/query-6c05fc541bf0bb2af20fbe62747456055d5ebda5cb136d9d015f101ebbfe495f.json deleted file mode 100644 index bc62431d0..000000000 --- a/.sqlx/query-6c05fc541bf0bb2af20fbe62747456055d5ebda5cb136d9d015f101ebbfe495f.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT * FROM scalar_tap_receipts", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "signer_address", - "type_info": "Bpchar" - }, - { - "ordinal": 2, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 3, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 4, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 5, - "name": "nonce", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "value", - "type_info": "Numeric" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "6c05fc541bf0bb2af20fbe62747456055d5ebda5cb136d9d015f101ebbfe495f" -} diff --git a/.sqlx/query-6ce2133a20924d5098fa2e27f897e871955e9eb8a0a6f8b9f23a3f38597793f6.json b/.sqlx/query-6ce2133a20924d5098fa2e27f897e871955e9eb8a0a6f8b9f23a3f38597793f6.json deleted file mode 100644 index d3b8f8181..000000000 --- a/.sqlx/query-6ce2133a20924d5098fa2e27f897e871955e9eb8a0a6f8b9f23a3f38597793f6.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT \n signature,\n allocation_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n nonce,\n value\n FROM tap_horizon_receipts\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 1, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 2, - "name": "payer", - "type_info": "Bpchar" - }, - { - "ordinal": 3, - "name": "data_service", - "type_info": "Bpchar" - }, - { - "ordinal": 4, - "name": "service_provider", - "type_info": "Bpchar" - }, - { - "ordinal": 5, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "nonce", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "value", - "type_info": "Numeric" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "6ce2133a20924d5098fa2e27f897e871955e9eb8a0a6f8b9f23a3f38597793f6" -} diff --git a/.sqlx/query-6fc518e6b980f6dcc160d8310fc7e761625a862578b61ce925910c351edbbda8.json b/.sqlx/query-6fc518e6b980f6dcc160d8310fc7e761625a862578b61ce925910c351edbbda8.json deleted file mode 100644 index 8bbaea558..000000000 --- a/.sqlx/query-6fc518e6b980f6dcc160d8310fc7e761625a862578b61ce925910c351edbbda8.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT * FROM scalar_tap_ravs WHERE last = true AND allocation_id = $1;\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "sender_address", - "type_info": "Bpchar" - }, - { - "ordinal": 1, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 2, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 3, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 4, - "name": "value_aggregate", - "type_info": "Numeric" - }, - { - "ordinal": 5, - "name": "last", - "type_info": "Bool" - }, - { - "ordinal": 6, - "name": "final", - "type_info": "Bool" - }, - { - "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 8, - "name": "updated_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Bpchar" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true - ] - }, - "hash": "6fc518e6b980f6dcc160d8310fc7e761625a862578b61ce925910c351edbbda8" -} diff --git a/.sqlx/query-eef0d4e41d62691f9987cf4a086da379c5d5c363f378b31f226444a6b808a239.json b/.sqlx/query-7056483e39f0e03aa5797ad7382fb130e4d7414aa9038581f0ccaf079c8fc0ab.json similarity index 81% rename from .sqlx/query-eef0d4e41d62691f9987cf4a086da379c5d5c363f378b31f226444a6b808a239.json rename to .sqlx/query-7056483e39f0e03aa5797ad7382fb130e4d7414aa9038581f0ccaf079c8fc0ab.json index 9d39f1c65..8ef2ae0a9 100644 --- a/.sqlx/query-eef0d4e41d62691f9987cf4a086da379c5d5c363f378b31f226444a6b808a239.json +++ b/.sqlx/query-7056483e39f0e03aa5797ad7382fb130e4d7414aa9038581f0ccaf079c8fc0ab.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO tap_horizon_receipts (\n signer_address,\n signature,\n allocation_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n nonce,\n value\n ) SELECT * FROM UNNEST(\n $1::CHAR(40)[],\n $2::BYTEA[],\n $3::CHAR(40)[],\n $4::CHAR(40)[],\n $5::CHAR(40)[],\n $6::CHAR(40)[],\n $7::NUMERIC(20)[],\n $8::NUMERIC(20)[],\n $9::NUMERIC(40)[]\n )", + "query": "INSERT INTO tap_horizon_receipts (\n signer_address,\n signature,\n collection_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n nonce,\n value\n ) SELECT * FROM UNNEST(\n $1::CHAR(40)[],\n $2::BYTEA[],\n $3::CHAR(40)[],\n $4::CHAR(40)[],\n $5::CHAR(40)[],\n $6::CHAR(40)[],\n $7::NUMERIC(20)[],\n $8::NUMERIC(20)[],\n $9::NUMERIC(40)[]\n )", "describe": { "columns": [], "parameters": { @@ -18,5 +18,5 @@ }, "nullable": [] }, - "hash": "eef0d4e41d62691f9987cf4a086da379c5d5c363f378b31f226444a6b808a239" + "hash": "7056483e39f0e03aa5797ad7382fb130e4d7414aa9038581f0ccaf079c8fc0ab" } diff --git a/.sqlx/query-74656664f9b27c28a8726800d7e57dbf78225c58f68e5f1b581f4f13c8678268.json b/.sqlx/query-74656664f9b27c28a8726800d7e57dbf78225c58f68e5f1b581f4f13c8678268.json deleted file mode 100644 index dcea5f9b6..000000000 --- a/.sqlx/query-74656664f9b27c28a8726800d7e57dbf78225c58f68e5f1b581f4f13c8678268.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO scalar_tap_receipts (signer_address, signature, allocation_id, timestamp_ns, nonce, value)\n VALUES ($1, $2, $3, $4, $5, $6)\n RETURNING id\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [ - "Bpchar", - "Bytea", - "Bpchar", - "Numeric", - "Numeric", - "Numeric" - ] - }, - "nullable": [ - false - ] - }, - "hash": "74656664f9b27c28a8726800d7e57dbf78225c58f68e5f1b581f4f13c8678268" -} diff --git a/.sqlx/query-7bf9c412120de537eecb8efb64da5b4ace9acc032be502cd1d9fc72c5b9ed50a.json b/.sqlx/query-7bf9c412120de537eecb8efb64da5b4ace9acc032be502cd1d9fc72c5b9ed50a.json deleted file mode 100644 index ea67b93bb..000000000 --- a/.sqlx/query-7bf9c412120de537eecb8efb64da5b4ace9acc032be502cd1d9fc72c5b9ed50a.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n WITH grouped AS (\n SELECT signer_address, allocation_id\n FROM tap_horizon_receipts\n GROUP BY signer_address, allocation_id\n )\n SELECT \n signer_address,\n ARRAY_AGG(allocation_id) AS allocation_ids\n FROM grouped\n GROUP BY signer_address\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "signer_address", - "type_info": "Bpchar" - }, - { - "ordinal": 1, - "name": "allocation_ids", - "type_info": "BpcharArray" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - null - ] - }, - "hash": "7bf9c412120de537eecb8efb64da5b4ace9acc032be502cd1d9fc72c5b9ed50a" -} diff --git a/.sqlx/query-842bde7fba1c7652b7cfc2dc568edc4204bbbd32aac6f7da7e99fb501ca5cc14.json b/.sqlx/query-842bde7fba1c7652b7cfc2dc568edc4204bbbd32aac6f7da7e99fb501ca5cc14.json index 2b0cde21e..91e33b3ed 100644 --- a/.sqlx/query-842bde7fba1c7652b7cfc2dc568edc4204bbbd32aac6f7da7e99fb501ca5cc14.json +++ b/.sqlx/query-842bde7fba1c7652b7cfc2dc568edc4204bbbd32aac6f7da7e99fb501ca5cc14.json @@ -23,7 +23,7 @@ "Left": [] }, "nullable": [ - false, + true, true, true ] diff --git a/.sqlx/query-8b904cecdd8e9c5dd0cd8a0dbc2e8a19c2197f08d576e5cbf978e39432bb3d5a.json b/.sqlx/query-8b904cecdd8e9c5dd0cd8a0dbc2e8a19c2197f08d576e5cbf978e39432bb3d5a.json deleted file mode 100644 index bca31dc48..000000000 --- a/.sqlx/query-8b904cecdd8e9c5dd0cd8a0dbc2e8a19c2197f08d576e5cbf978e39432bb3d5a.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO tap_horizon_receipts (\n signer_address,\n signature,\n allocation_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n nonce,\n value\n ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)\n RETURNING id\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [ - "Bpchar", - "Bytea", - "Bpchar", - "Bpchar", - "Bpchar", - "Bpchar", - "Numeric", - "Numeric", - "Numeric" - ] - }, - "nullable": [ - false - ] - }, - "hash": "8b904cecdd8e9c5dd0cd8a0dbc2e8a19c2197f08d576e5cbf978e39432bb3d5a" -} diff --git a/.sqlx/query-8e0a94a7385212c8bd515a77671159932331aaf7fe2fd7fdbb5df04485ec91ec.json b/.sqlx/query-8e0a94a7385212c8bd515a77671159932331aaf7fe2fd7fdbb5df04485ec91ec.json deleted file mode 100644 index 6a926de12..000000000 --- a/.sqlx/query-8e0a94a7385212c8bd515a77671159932331aaf7fe2fd7fdbb5df04485ec91ec.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n DELETE FROM scalar_tap_receipts\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [] - }, - "nullable": [] - }, - "hash": "8e0a94a7385212c8bd515a77671159932331aaf7fe2fd7fdbb5df04485ec91ec" -} diff --git a/.sqlx/query-9a11e8e814e42113c91050acf54c2e847f24a2e086abcbe8e7be618f84d58f78.json b/.sqlx/query-9a11e8e814e42113c91050acf54c2e847f24a2e086abcbe8e7be618f84d58f78.json deleted file mode 100644 index 134eef5e2..000000000 --- a/.sqlx/query-9a11e8e814e42113c91050acf54c2e847f24a2e086abcbe8e7be618f84d58f78.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n UPDATE tap_horizon_ravs\n SET last = true\n WHERE \n allocation_id = $1\n AND payer = $2\n AND service_provider = $3\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Bpchar", - "Bpchar", - "Bpchar" - ] - }, - "nullable": [] - }, - "hash": "9a11e8e814e42113c91050acf54c2e847f24a2e086abcbe8e7be618f84d58f78" -} diff --git a/.sqlx/query-b467894d499541f2bca15965f38ee551ece8619860f3fbcb184ebded33898cbd.json b/.sqlx/query-b467894d499541f2bca15965f38ee551ece8619860f3fbcb184ebded33898cbd.json deleted file mode 100644 index 76efd9841..000000000 --- a/.sqlx/query-b467894d499541f2bca15965f38ee551ece8619860f3fbcb184ebded33898cbd.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n MAX(id),\n SUM(value),\n COUNT(*)\n FROM\n tap_horizon_receipts_invalid\n WHERE\n allocation_id = $1\n AND signer_address IN (SELECT unnest($2::text[]))\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "max", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "sum", - "type_info": "Numeric" - }, - { - "ordinal": 2, - "name": "count", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [ - "Bpchar", - "TextArray" - ] - }, - "nullable": [ - null, - null, - null - ] - }, - "hash": "b467894d499541f2bca15965f38ee551ece8619860f3fbcb184ebded33898cbd" -} diff --git a/.sqlx/query-b54b1069daf03a377a0e7c09c9aa1732bb3638a3a4f942a665cf1fd38eb70c2d.json b/.sqlx/query-b54b1069daf03a377a0e7c09c9aa1732bb3638a3a4f942a665cf1fd38eb70c2d.json index 7dbd08638..d25a9de5d 100644 --- a/.sqlx/query-b54b1069daf03a377a0e7c09c9aa1732bb3638a3a4f942a665cf1fd38eb70c2d.json +++ b/.sqlx/query-b54b1069daf03a377a0e7c09c9aa1732bb3638a3a4f942a665cf1fd38eb70c2d.json @@ -25,7 +25,7 @@ ] }, "nullable": [ - false, + true, true, true ] diff --git a/.sqlx/query-5ee76e76f4ace2dbab69fd58eaf7f0539d2ffab1289130555dba0f6fdc3065ff.json b/.sqlx/query-b5c7a7f7d9fc5e06ee54bc5cce913431e1a0c922742d1c7a14e828f5953713f5.json similarity index 82% rename from .sqlx/query-5ee76e76f4ace2dbab69fd58eaf7f0539d2ffab1289130555dba0f6fdc3065ff.json rename to .sqlx/query-b5c7a7f7d9fc5e06ee54bc5cce913431e1a0c922742d1c7a14e828f5953713f5.json index 5b1b624d1..87f6288b3 100644 --- a/.sqlx/query-5ee76e76f4ace2dbab69fd58eaf7f0539d2ffab1289130555dba0f6fdc3065ff.json +++ b/.sqlx/query-b5c7a7f7d9fc5e06ee54bc5cce913431e1a0c922742d1c7a14e828f5953713f5.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO tap_horizon_ravs (\n payer,\n data_service,\n service_provider,\n metadata,\n signature,\n allocation_id,\n timestamp_ns,\n value_aggregate,\n created_at,\n updated_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $9)\n ON CONFLICT (payer, data_service, service_provider, allocation_id)\n DO UPDATE SET\n signature = $5,\n timestamp_ns = $7,\n value_aggregate = $8,\n updated_at = $9,\n metadata = $4\n ", + "query": "\n INSERT INTO tap_horizon_ravs (\n payer,\n data_service,\n service_provider,\n metadata,\n signature,\n collection_id,\n timestamp_ns,\n value_aggregate,\n created_at,\n updated_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $9)\n ON CONFLICT (payer, data_service, service_provider, collection_id)\n DO UPDATE SET\n signature = $5,\n timestamp_ns = $7,\n value_aggregate = $8,\n updated_at = $9,\n metadata = $4\n ", "describe": { "columns": [], "parameters": { @@ -18,5 +18,5 @@ }, "nullable": [] }, - "hash": "5ee76e76f4ace2dbab69fd58eaf7f0539d2ffab1289130555dba0f6fdc3065ff" + "hash": "b5c7a7f7d9fc5e06ee54bc5cce913431e1a0c922742d1c7a14e828f5953713f5" } diff --git a/.sqlx/query-b5eeb6b9501c2f2ca883040d9f62cc59876e13468b43b3fb5860592918e647f0.json b/.sqlx/query-b5eeb6b9501c2f2ca883040d9f62cc59876e13468b43b3fb5860592918e647f0.json deleted file mode 100644 index e08039479..000000000 --- a/.sqlx/query-b5eeb6b9501c2f2ca883040d9f62cc59876e13468b43b3fb5860592918e647f0.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n DELETE FROM scalar_tap_denylist\n WHERE sender_address = $1\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Bpchar" - ] - }, - "nullable": [] - }, - "hash": "b5eeb6b9501c2f2ca883040d9f62cc59876e13468b43b3fb5860592918e647f0" -} diff --git a/.sqlx/query-d93dd26d7221c5e1ae15a919a2a651e43b6b9ffe9834df85a62707d3a2d051b4.json b/.sqlx/query-d93dd26d7221c5e1ae15a919a2a651e43b6b9ffe9834df85a62707d3a2d051b4.json index 6b2da69c8..c9e8b2f4e 100644 --- a/.sqlx/query-d93dd26d7221c5e1ae15a919a2a651e43b6b9ffe9834df85a62707d3a2d051b4.json +++ b/.sqlx/query-d93dd26d7221c5e1ae15a919a2a651e43b6b9ffe9834df85a62707d3a2d051b4.json @@ -25,7 +25,7 @@ ] }, "nullable": [ - false, + true, true, true ] diff --git a/.sqlx/query-dc8cea825babfaadfc1845481c1a24471d24c11c957f986144ed04694024e922.json b/.sqlx/query-dc8cea825babfaadfc1845481c1a24471d24c11c957f986144ed04694024e922.json deleted file mode 100644 index fb6987e74..000000000 --- a/.sqlx/query-dc8cea825babfaadfc1845481c1a24471d24c11c957f986144ed04694024e922.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT count(*)\n FROM scalar_tap_receipts\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "count", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - null - ] - }, - "hash": "dc8cea825babfaadfc1845481c1a24471d24c11c957f986144ed04694024e922" -} diff --git a/.sqlx/query-dcc710ebd4fa7a86f95a45ebf13bc7c298006af22134c144048b0ac7183353c0.json b/.sqlx/query-dcc710ebd4fa7a86f95a45ebf13bc7c298006af22134c144048b0ac7183353c0.json deleted file mode 100644 index 65922247c..000000000 --- a/.sqlx/query-dcc710ebd4fa7a86f95a45ebf13bc7c298006af22134c144048b0ac7183353c0.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "DELETE FROM \"CostModels\"", - "describe": { - "columns": [], - "parameters": { - "Left": [] - }, - "nullable": [] - }, - "hash": "dcc710ebd4fa7a86f95a45ebf13bc7c298006af22134c144048b0ac7183353c0" -} diff --git a/.sqlx/query-df0ec56dbd903b38581efc492c93cc7ff7349af9afcf283399ff278bec0abefa.json b/.sqlx/query-df0ec56dbd903b38581efc492c93cc7ff7349af9afcf283399ff278bec0abefa.json deleted file mode 100644 index eb7828bf4..000000000 --- a/.sqlx/query-df0ec56dbd903b38581efc492c93cc7ff7349af9afcf283399ff278bec0abefa.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO scalar_tap_ravs (sender_address, signature, allocation_id, timestamp_ns, value_aggregate, last, final)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Bpchar", - "Bytea", - "Bpchar", - "Numeric", - "Numeric", - "Bool", - "Bool" - ] - }, - "nullable": [] - }, - "hash": "df0ec56dbd903b38581efc492c93cc7ff7349af9afcf283399ff278bec0abefa" -} diff --git a/.sqlx/query-e14503b633fc673b65448e70c204651cfd94b4b82f26baf0755efa80e6045c0a.json b/.sqlx/query-e14503b633fc673b65448e70c204651cfd94b4b82f26baf0755efa80e6045c0a.json index 619967273..08c287f3f 100644 --- a/.sqlx/query-e14503b633fc673b65448e70c204651cfd94b4b82f26baf0755efa80e6045c0a.json +++ b/.sqlx/query-e14503b633fc673b65448e70c204651cfd94b4b82f26baf0755efa80e6045c0a.json @@ -25,7 +25,7 @@ ] }, "nullable": [ - false, + true, true, true ] diff --git a/.sqlx/query-ef6affb9039ad19a69f4a5116d7893b4f7209c985c367215b2eed25adc78c462.json b/.sqlx/query-ef6affb9039ad19a69f4a5116d7893b4f7209c985c367215b2eed25adc78c462.json deleted file mode 100644 index 0c8cfd917..000000000 --- a/.sqlx/query-ef6affb9039ad19a69f4a5116d7893b4f7209c985c367215b2eed25adc78c462.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO \"CostModels\" (deployment, model)\n VALUES ($1, $2);\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Varchar", - "Text" - ] - }, - "nullable": [] - }, - "hash": "ef6affb9039ad19a69f4a5116d7893b4f7209c985c367215b2eed25adc78c462" -} diff --git a/.sqlx/query-f02805d423945f35b93dde58db49872832048b338237c786727a6c9173e23b38.json b/.sqlx/query-f02805d423945f35b93dde58db49872832048b338237c786727a6c9173e23b38.json deleted file mode 100644 index b6cf1c1c6..000000000 --- a/.sqlx/query-f02805d423945f35b93dde58db49872832048b338237c786727a6c9173e23b38.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT \n signature,\n allocation_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n value_aggregate,\n metadata\n FROM tap_horizon_ravs\n WHERE \n allocation_id = $1 \n AND payer = $2\n AND service_provider = $3\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "signature", - "type_info": "Bytea" - }, - { - "ordinal": 1, - "name": "allocation_id", - "type_info": "Bpchar" - }, - { - "ordinal": 2, - "name": "payer", - "type_info": "Bpchar" - }, - { - "ordinal": 3, - "name": "data_service", - "type_info": "Bpchar" - }, - { - "ordinal": 4, - "name": "service_provider", - "type_info": "Bpchar" - }, - { - "ordinal": 5, - "name": "timestamp_ns", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "value_aggregate", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "metadata", - "type_info": "Bytea" - } - ], - "parameters": { - "Left": [ - "Bpchar", - "Bpchar", - "Bpchar" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "f02805d423945f35b93dde58db49872832048b338237c786727a6c9173e23b38" -} diff --git a/.sqlx/query-f427b53120026e6df1e41ca864866c4b7e60ca1a6c09920cd9194de913fe6307.json b/.sqlx/query-f427b53120026e6df1e41ca864866c4b7e60ca1a6c09920cd9194de913fe6307.json deleted file mode 100644 index e5699bc70..000000000 --- a/.sqlx/query-f427b53120026e6df1e41ca864866c4b7e60ca1a6c09920cd9194de913fe6307.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO scalar_tap_receipts_invalid (signer_address, signature, allocation_id, timestamp_ns, nonce, value)\n VALUES ($1, $2, $3, $4, $5, $6)\n RETURNING id\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [ - "Bpchar", - "Bytea", - "Bpchar", - "Numeric", - "Numeric", - "Numeric" - ] - }, - "nullable": [ - false - ] - }, - "hash": "f427b53120026e6df1e41ca864866c4b7e60ca1a6c09920cd9194de913fe6307" -} diff --git a/.sqlx/query-f65b5a6c2149155d69fb1f187ebb4e24c08d5763d97da4e2ec759c30d6170a68.json b/.sqlx/query-f65b5a6c2149155d69fb1f187ebb4e24c08d5763d97da4e2ec759c30d6170a68.json deleted file mode 100644 index 71f5c8e0b..000000000 --- a/.sqlx/query-f65b5a6c2149155d69fb1f187ebb4e24c08d5763d97da4e2ec759c30d6170a68.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO tap_horizon_receipts_invalid (\n signer_address,\n signature,\n allocation_id,\n payer,\n data_service,\n service_provider,\n timestamp_ns,\n nonce,\n value,\n error_log\n ) SELECT * FROM UNNEST(\n $1::CHAR(40)[],\n $2::BYTEA[],\n $3::CHAR(40)[],\n $4::CHAR(40)[],\n $5::CHAR(40)[],\n $6::CHAR(40)[],\n $7::NUMERIC(20)[],\n $8::NUMERIC(20)[],\n $9::NUMERIC(40)[],\n $10::TEXT[]\n )", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "BpcharArray", - "ByteaArray", - "BpcharArray", - "BpcharArray", - "BpcharArray", - "BpcharArray", - "NumericArray", - "NumericArray", - "NumericArray", - "TextArray" - ] - }, - "nullable": [] - }, - "hash": "f65b5a6c2149155d69fb1f187ebb4e24c08d5763d97da4e2ec759c30d6170a68" -} diff --git a/.sqlx/query-fa31900971e23fdf98dd48fcd649e04328fb1e758a0b538319c5fb132251a7ed.json b/.sqlx/query-fa31900971e23fdf98dd48fcd649e04328fb1e758a0b538319c5fb132251a7ed.json deleted file mode 100644 index e87b866a2..000000000 --- a/.sqlx/query-fa31900971e23fdf98dd48fcd649e04328fb1e758a0b538319c5fb132251a7ed.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT\n MAX(id),\n SUM(value),\n COUNT(*)\n FROM\n tap_horizon_receipts\n WHERE\n allocation_id = $1\n AND service_provider = $2\n AND id <= $3\n AND signer_address IN (SELECT unnest($4::text[]))\n AND timestamp_ns > $5\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "max", - "type_info": "Int8" - }, - { - "ordinal": 1, - "name": "sum", - "type_info": "Numeric" - }, - { - "ordinal": 2, - "name": "count", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [ - "Bpchar", - "Bpchar", - "Int8", - "TextArray", - "Numeric" - ] - }, - "nullable": [ - null, - null, - null - ] - }, - "hash": "fa31900971e23fdf98dd48fcd649e04328fb1e758a0b538319c5fb132251a7ed" -} diff --git a/Cargo.lock b/Cargo.lock index 0be7cf274..8e1285396 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2384,7 +2384,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d162beedaa69905488a8da94f5ac3edb4dd4788b732fadb7bd120b2625c1976" dependencies = [ "data-encoding", - "syn 1.0.109", + "syn 2.0.101", ] [[package]] @@ -2705,7 +2705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3808,7 +3808,7 @@ dependencies = [ "anyhow", "indexer-query", "serde", - "thegraph-core", + "thegraph-core 0.15.0", ] [[package]] @@ -3819,7 +3819,7 @@ dependencies = [ "indexer-allocation", "test-assets", "test-log", - "thegraph-core", + "thegraph-core 0.15.0", ] [[package]] @@ -3837,7 +3837,7 @@ dependencies = [ "serde_test", "serde_with", "tempfile", - "thegraph-core", + "thegraph-core 0.15.0", "toml 0.8.23", "tracing", "tracing-test", @@ -3865,7 +3865,7 @@ dependencies = [ "serde_json", "serde_yaml", "sqlx", - "thegraph-core", + "thegraph-core 0.15.0", "thiserror 1.0.69", "tokio", "tonic", @@ -3894,7 +3894,7 @@ dependencies = [ "test-assets", "test-log", "test-with", - "thegraph-core", + "thegraph-core 0.15.0", "thiserror 1.0.69", "tokio", "tracing", @@ -3908,7 +3908,7 @@ dependencies = [ "anyhow", "graphql_client", "serde", - "thegraph-core", + "thegraph-core 0.15.0", ] [[package]] @@ -3918,7 +3918,7 @@ dependencies = [ "anyhow", "tap_core", "tap_graph", - "thegraph-core", + "thegraph-core 0.15.0", ] [[package]] @@ -3969,7 +3969,7 @@ dependencies = [ "tap_graph", "test-assets", "test-log", - "thegraph-core", + "thegraph-core 0.15.0", "thegraph-graphql-http", "thiserror 1.0.69", "tokio", @@ -4029,7 +4029,7 @@ dependencies = [ "tempfile", "test-assets", "test-log", - "thegraph-core", + "thegraph-core 0.15.0", "thiserror 1.0.69", "tokio", "tonic", @@ -4120,7 +4120,7 @@ dependencies = [ "serde_json", "tap_core", "tap_graph", - "thegraph-core", + "thegraph-core 0.15.0", "tokio", ] @@ -4181,7 +4181,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" dependencies = [ "hermit-abi 0.5.1", "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5757,7 +5757,7 @@ version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "itertools 0.14.0", "log", "multimap", @@ -5956,7 +5956,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6562,7 +6562,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6650,7 +6650,7 @@ dependencies = [ "security-framework 3.2.0", "security-framework-sys", "webpki-root-certs 0.26.11", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7754,9 +7754,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tap_aggregator" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396a205d0b37082e143bacb0df2863f012efdb61030c761e4769e565a3682cac" +checksum = "a285f761794c1f27f3d744cea3adb9860b625a34f0cc4f0637128b6a2c9611ea" dependencies = [ "anyhow", "axum", @@ -7775,7 +7775,7 @@ dependencies = [ "strum 0.27.1", "tap_core", "tap_graph", - "thegraph-core", + "thegraph-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio", "tonic", "tonic-build", @@ -7795,7 +7795,7 @@ dependencies = [ "tap_eip712_message", "tap_graph", "tap_receipt", - "thegraph-core", + "thegraph-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.12", "tokio", ] @@ -7807,21 +7807,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e648d9aafebc6835d1bb50398452a82a237539a60d8cb02f3541c1e2d291fc39" dependencies = [ "serde", - "thegraph-core", + "thegraph-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.12", ] [[package]] name = "tap_graph" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef92cf034d1da570ad6c2fbb949ef6c481e973854b4123c7ae2cb6f4c35a6a8b" +checksum = "ff0f8dd640afe0d3a53a6b6ae58f628f0f99267d33f61b7a1264daa9d4307003" dependencies = [ "rand 0.9.1", "serde", "tap_eip712_message", "tap_receipt", - "thegraph-core", + "thegraph-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -7835,7 +7835,7 @@ dependencies = [ "async-trait", "serde", "tap_eip712_message", - "thegraph-core", + "thegraph-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.12", ] @@ -7849,7 +7849,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7864,7 +7864,7 @@ dependencies = [ "stdext", "tap_core", "tap_graph", - "thegraph-core", + "thegraph-core 0.15.0", "tokio", ] @@ -7913,8 +7913,6 @@ dependencies = [ [[package]] name = "thegraph-core" version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19d867e871b28e3b14e6470fefd69e1a4bbb92f2927726028a06e88f438608b" dependencies = [ "alloy", "bs58", @@ -7923,6 +7921,17 @@ dependencies = [ "thiserror 2.0.12", ] +[[package]] +name = "thegraph-core" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19d867e871b28e3b14e6470fefd69e1a4bbb92f2927726028a06e88f438608b" +dependencies = [ + "alloy", + "bs58", + "thiserror 2.0.12", +] + [[package]] name = "thegraph-graphql-http" version = "0.3.3" @@ -8931,7 +8940,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 240e0cfa0..11b0c753b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,13 +82,13 @@ sqlx = { version = "0.8.2", features = [ "uuid", ], default-features = false } stdext = "0.3.3" -tap_aggregator = { version = "0.5.5", default-features = false } +tap_aggregator = { version = "0.5.6", default-features = false } tap_core = { version = "4.1.3", default-features = false } -tap_graph = { version = "0.3.3", features = ["v2"] } +tap_graph = { version = "0.3.4", features = ["v2"] } tempfile = "3.8.0" test-log = { version = "0.2.12", default-features = false } test-with = "0.14.6" -thegraph-core = { version = "0.15.0", features = [ +thegraph-core = { path = "../toolshed/thegraph-core", features = [ "attestation", "alloy-eip712", "alloy-sol-types", diff --git a/crates/indexer-receipt/src/lib.rs b/crates/indexer-receipt/src/lib.rs index c1a79b3b7..cadc24018 100644 --- a/crates/indexer-receipt/src/lib.rs +++ b/crates/indexer-receipt/src/lib.rs @@ -9,7 +9,11 @@ use tap_core::{ }, signed_message::SignatureBytes, }; -use thegraph_core::alloy::{dyn_abi::Eip712Domain, primitives::Address, signers::Signature}; +use thegraph_core::alloy::{ + dyn_abi::Eip712Domain, + primitives::{Address, FixedBytes}, + signers::Signature, +}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum TapReceipt { @@ -70,13 +74,13 @@ impl Aggregate for tap_graph::v2::ReceiptAggregateVoucher { }) .collect::>() .map_err(AggregationError::Other)?; - let allocation_id = receipts[0].message.allocation_id; + let collection_id = receipts[0].message.collection_id; let payer = receipts[0].message.payer; let data_service = receipts[0].message.data_service; let service_provider = receipts[0].message.service_provider; tap_graph::v2::ReceiptAggregateVoucher::aggregate_receipts( - allocation_id, + collection_id, payer, data_service, service_provider, @@ -115,10 +119,17 @@ impl TapReceipt { } } - pub fn allocation_id(&self) -> Address { + pub fn allocation_id(&self) -> Option
{ match self { - TapReceipt::V1(receipt) => receipt.message.allocation_id, - TapReceipt::V2(receipt) => receipt.message.allocation_id, + TapReceipt::V1(receipt) => Some(receipt.message.allocation_id), + _ => None, + } + } + + pub fn collection_id(&self) -> Option> { + match self { + TapReceipt::V2(receipt) => Some(receipt.message.collection_id), + _ => None, } } diff --git a/crates/service/src/tap/checks/allocation_eligible.rs b/crates/service/src/tap/checks/allocation_eligible.rs index b2338e5f2..c1e450b84 100644 --- a/crates/service/src/tap/checks/allocation_eligible.rs +++ b/crates/service/src/tap/checks/allocation_eligible.rs @@ -7,6 +7,7 @@ use anyhow::anyhow; use indexer_allocation::Allocation; use tap_core::receipt::checks::{Check, CheckError, CheckResult}; use thegraph_core::alloy::primitives::Address; +use thegraph_core::CollectionId; use tokio::sync::watch::Receiver; use crate::tap::{CheckingReceipt, TapReceipt}; @@ -29,7 +30,10 @@ impl Check for AllocationEligible { _: &tap_core::receipt::Context, receipt: &CheckingReceipt, ) -> CheckResult { - let allocation_id = receipt.signed_receipt().allocation_id(); + let allocation_id = match receipt.signed_receipt() { + TapReceipt::V1(receipt) => receipt.message.allocation_id, + TapReceipt::V2(receipt) => CollectionId::from(receipt.message.collection_id).as_address(), + }; if !self .indexer_allocations .borrow() diff --git a/crates/service/src/tap/receipt_store.rs b/crates/service/src/tap/receipt_store.rs index af30d6e20..8e4ea9e60 100644 --- a/crates/service/src/tap/receipt_store.rs +++ b/crates/service/src/tap/receipt_store.rs @@ -164,7 +164,7 @@ impl InnerContext { let receipts_len = receipts.len(); let mut signers = Vec::with_capacity(receipts_len); let mut signatures = Vec::with_capacity(receipts_len); - let mut allocation_ids = Vec::with_capacity(receipts_len); + let mut collection_ids = Vec::with_capacity(receipts_len); let mut payers = Vec::with_capacity(receipts_len); let mut data_services = Vec::with_capacity(receipts_len); let mut service_providers = Vec::with_capacity(receipts_len); @@ -175,7 +175,7 @@ impl InnerContext { for receipt in receipts { signers.push(receipt.signer_address); signatures.push(receipt.signature); - allocation_ids.push(receipt.allocation_id); + collection_ids.push(receipt.collection_id); payers.push(receipt.payer); data_services.push(receipt.data_service); service_providers.push(receipt.service_provider); @@ -187,7 +187,7 @@ impl InnerContext { r#"INSERT INTO tap_horizon_receipts ( signer_address, signature, - allocation_id, + collection_id, payer, data_service, service_provider, @@ -207,7 +207,7 @@ impl InnerContext { )"#, &signers, &signatures, - &allocation_ids, + &collection_ids, &payers, &data_services, &service_providers, @@ -328,7 +328,7 @@ impl DbReceiptV1 { pub struct DbReceiptV2 { signer_address: String, signature: Vec, - allocation_id: String, + collection_id: String, payer: String, data_service: String, service_provider: String, @@ -342,7 +342,7 @@ impl DbReceiptV2 { receipt: &tap_graph::v2::SignedReceipt, separator: &Eip712Domain, ) -> anyhow::Result { - let allocation_id = receipt.message.allocation_id.encode_hex(); + let collection_id = receipt.message.collection_id.encode_hex(); let payer = receipt.message.payer.encode_hex(); let data_service = receipt.message.data_service.encode_hex(); let service_provider = receipt.message.service_provider.encode_hex(); @@ -360,7 +360,7 @@ impl DbReceiptV2 { let nonce = BigDecimal::from(receipt.message.nonce); let value = BigDecimal::from(BigInt::from(receipt.value())); Ok(Self { - allocation_id, + collection_id, payer, data_service, service_provider, diff --git a/crates/tap-agent/src/agent/sender_account.rs b/crates/tap-agent/src/agent/sender_account.rs index 659e05b09..56cb0ba92 100644 --- a/crates/tap-agent/src/agent/sender_account.rs +++ b/crates/tap-agent/src/agent/sender_account.rs @@ -30,6 +30,7 @@ use thegraph_core::alloy::{ primitives::{Address, U256}, sol_types::Eip712Domain, }; +use thegraph_core::{AllocationId as AllocationIdCore, CollectionId}; use tokio::{sync::watch::Receiver, task::JoinHandle}; use tonic::transport::{Channel, Endpoint}; use tracing::Level; @@ -144,7 +145,7 @@ impl From for RavInformation { impl From<&tap_graph::v2::SignedRav> for RavInformation { fn from(value: &tap_graph::v2::SignedRav) -> Self { RavInformation { - allocation_id: value.message.allocationId, + allocation_id: AllocationIdCore::from(CollectionId::from(value.message.collectionId)).into_inner(), value_aggregate: value.message.valueAggregate, } } @@ -815,7 +816,7 @@ impl Actor for SenderAccount { if config.horizon_enabled { sqlx::query!( r#" - SELECT allocation_id, value_aggregate + SELECT collection_id, value_aggregate FROM tap_horizon_ravs WHERE payer = $1 AND last AND NOT final; "#, @@ -825,7 +826,7 @@ impl Actor for SenderAccount { .await .expect("Should not fail to fetch from \"horizon\" scalar_tap_ravs") .into_iter() - .map(|record| (record.allocation_id, record.value_aggregate)) + .map(|record| (record.collection_id, record.value_aggregate)) .collect() } else { vec![] diff --git a/crates/tap-agent/src/agent/sender_accounts_manager.rs b/crates/tap-agent/src/agent/sender_accounts_manager.rs index c20d8df84..dc5ac2965 100644 --- a/crates/tap-agent/src/agent/sender_accounts_manager.rs +++ b/crates/tap-agent/src/agent/sender_accounts_manager.rs @@ -19,7 +19,7 @@ use ractor::{Actor, ActorCell, ActorProcessingErr, ActorRef, SupervisionEvent}; use reqwest::Url; use serde::Deserialize; use sqlx::{postgres::PgListener, PgPool}; -use thegraph_core::alloy::{primitives::Address, sol_types::Eip712Domain}; +use thegraph_core::alloy::{primitives::{Address, FixedBytes}, sol_types::Eip712Domain}; use tokio::{select, sync::watch::Receiver}; use super::sender_account::{ @@ -697,16 +697,16 @@ impl State { let mut unfinalized_sender_allocations_map: HashMap> = HashMap::new(); - let receipts_signer_allocations_in_db = sqlx::query!( + let receipts_signer_collections_in_db = sqlx::query!( r#" WITH grouped AS ( - SELECT signer_address, allocation_id + SELECT signer_address, collection_id FROM tap_horizon_receipts - GROUP BY signer_address, allocation_id + GROUP BY signer_address, collection_id ) SELECT signer_address, - ARRAY_AGG(allocation_id) AS allocation_ids + ARRAY_AGG(collection_id) AS collection_ids FROM grouped GROUP BY signer_address "# @@ -715,15 +715,15 @@ impl State { .await .expect("should be able to fetch pending V2 receipts from the database"); - for row in receipts_signer_allocations_in_db { - let allocation_ids = row - .allocation_ids - .expect("all receipts V2 should have an allocation_id") + for row in receipts_signer_collections_in_db { + let collection_ids = row + .collection_ids + .expect("all receipts V2 should have a collection_id") .iter() - .map(|allocation_id| { - AllocationId::Legacy( - Address::from_str(allocation_id) - .expect("allocation_id should be a valid address"), + .map(|collection_id| { + AllocationId::Horizon( + FixedBytes::<32>::from_str(collection_id) + .expect("collection_id should be a valid address"), ) }) .collect::>(); diff --git a/crates/tap-agent/src/agent/sender_allocation.rs b/crates/tap-agent/src/agent/sender_allocation.rs index 1611db2bd..ff938e0c1 100644 --- a/crates/tap-agent/src/agent/sender_allocation.rs +++ b/crates/tap-agent/src/agent/sender_allocation.rs @@ -818,7 +818,7 @@ where let reciepts_len = receipts.len(); let mut reciepts_signers = Vec::with_capacity(reciepts_len); let mut encoded_signatures = Vec::with_capacity(reciepts_len); - let mut allocation_ids = Vec::with_capacity(reciepts_len); + let mut collection_ids = Vec::with_capacity(reciepts_len); let mut payers = Vec::with_capacity(reciepts_len); let mut data_services = Vec::with_capacity(reciepts_len); let mut service_providers = Vec::with_capacity(reciepts_len); @@ -828,7 +828,7 @@ where let mut error_logs = Vec::with_capacity(reciepts_len); for (receipt, receipt_error) in receipts { - let allocation_id = receipt.message.allocation_id; + let collection_id = receipt.message.collection_id; let payer = receipt.message.payer; let data_service = receipt.message.data_service; let service_provider = receipt.message.service_provider; @@ -841,13 +841,13 @@ where })?; tracing::debug!( "Receipt for allocation {} and signer {} failed reason: {}", - allocation_id.encode_hex(), + collection_id.encode_hex(), receipt_signer.encode_hex(), receipt_error ); reciepts_signers.push(receipt_signer.encode_hex()); encoded_signatures.push(encoded_signature); - allocation_ids.push(allocation_id.encode_hex()); + collection_ids.push(collection_id.encode_hex()); payers.push(payer.encode_hex()); data_services.push(data_service.encode_hex()); service_providers.push(service_provider.encode_hex()); @@ -860,7 +860,7 @@ where r#"INSERT INTO tap_horizon_receipts_invalid ( signer_address, signature, - allocation_id, + collection_id, payer, data_service, service_provider, @@ -871,7 +871,7 @@ where ) SELECT * FROM UNNEST( $1::CHAR(40)[], $2::BYTEA[], - $3::CHAR(40)[], + $3::CHAR(64)[], $4::CHAR(40)[], $5::CHAR(40)[], $6::CHAR(40)[], @@ -882,7 +882,7 @@ where )"#, &reciepts_signers, &encoded_signatures, - &allocation_ids, + &collection_ids, &payers, &data_services, &service_providers, @@ -1159,10 +1159,10 @@ impl DatabaseInteractions for SenderAllocationState { FROM tap_horizon_receipts_invalid WHERE - allocation_id = $1 + collection_id = $1 AND signer_address IN (SELECT unnest($2::text[])) "#, - self.allocation_id.encode_hex(), + self.collection_id.encode_hex(), &signers ) .fetch_one(&self.pgpool) @@ -1205,13 +1205,13 @@ impl DatabaseInteractions for SenderAllocationState { FROM tap_horizon_receipts WHERE - allocation_id = $1 + collection_id = $1 AND service_provider = $2 AND id <= $3 AND signer_address IN (SELECT unnest($4::text[])) AND timestamp_ns > $5 "#, - self.allocation_id.encode_hex(), + self.collection_id.encode_hex(), self.indexer_address.encode_hex(), last_id, &signers, @@ -1258,11 +1258,11 @@ impl DatabaseInteractions for SenderAllocationState { UPDATE tap_horizon_ravs SET last = true WHERE - allocation_id = $1 + collection_id = $1 AND payer = $2 AND service_provider = $3 "#, - self.allocation_id.encode_hex(), + self.collection_id.encode_hex(), self.sender.encode_hex(), self.indexer_address.encode_hex(), ) diff --git a/crates/tap-agent/src/tap/context/checks/allocation_id.rs b/crates/tap-agent/src/tap/context/checks/allocation_id.rs index 609da5176..9c2d631cb 100644 --- a/crates/tap-agent/src/tap/context/checks/allocation_id.rs +++ b/crates/tap-agent/src/tap/context/checks/allocation_id.rs @@ -54,19 +54,20 @@ impl Check for AllocationId { _: &tap_core::receipt::Context, receipt: &CheckingReceipt, ) -> CheckResult { - let allocation_id = receipt.signed_receipt().allocation_id(); + let allocation_id = receipt.signed_receipt().allocation_id() + .ok_or_else(|| CheckError::Failed(anyhow!("Receipt does not have an allocation_id")))?; // TODO: Remove the if block below? Each TAP Monitor is specific to an allocation // ID. So the receipts that are received here should already have been filtered by // allocation ID. if allocation_id != self.allocation_id { - return Err(CheckError::Failed(anyhow!("Receipt allocation_id different from expected: allocation_id: {}, expected_allocation_id: {}", allocation_id, self.allocation_id))); + return Err(CheckError::Failed(anyhow!("Receipt allocation_id different from expected: allocation_id: {:?}, expected_allocation_id: {}", allocation_id, self.allocation_id))); }; // Check that the allocation ID is not redeemed yet for this consumer match *self.tap_allocation_redeemed.borrow() { false => Ok(()), true => Err(CheckError::Failed(anyhow!( - "Allocation {} already redeemed", + "Allocation {:?} already redeemed", allocation_id ))), } diff --git a/crates/tap-agent/src/tap/context/rav.rs b/crates/tap-agent/src/tap/context/rav.rs index bdb26b775..a9f33127b 100644 --- a/crates/tap-agent/src/tap/context/rav.rs +++ b/crates/tap-agent/src/tap/context/rav.rs @@ -14,8 +14,9 @@ use tap_graph::{ReceiptAggregateVoucher, SignedRav}; use thegraph_core::alloy::signers::Signature; use thegraph_core::alloy::{ hex::ToHexExt, - primitives::{Address, Bytes}, + primitives::{Address, Bytes, FixedBytes}, }; +use thegraph_core::{CollectionId}; use super::{error::AdapterError, Horizon, Legacy, TapAgentContext}; @@ -157,7 +158,7 @@ impl RavRead for TapAgentContext for TapAgentContext for TapAgentContext::from_str(&row.collection_id).map_err(|e| AdapterError::RavRead { error: format!( - "Error decoding allocation_id while retrieving RAV from database: {}", + "Error decoding collection_id while retrieving RAV from database: {}", e ), })?; @@ -244,7 +245,7 @@ impl RavRead for TapAgentContext for TapAgentContext for TapAgentContext for TapAgentContext { SELECT id, signature, - allocation_id, + collection_id, payer, data_service, service_provider, @@ -236,7 +237,7 @@ impl ReceiptRead for TapAgentContext { value FROM tap_horizon_receipts WHERE - allocation_id = $1 + collection_id = $1 AND payer = $2 AND service_provider = $3 AND signer_address IN (SELECT unnest($4::text[])) @@ -244,7 +245,7 @@ impl ReceiptRead for TapAgentContext { ORDER BY timestamp_ns ASC LIMIT $6 "#, - self.allocation_id.encode_hex(), + CollectionId::from(self.allocation_id).encode_hex(), self.sender.encode_hex(), self.indexer_address.encode_hex(), &signers, @@ -263,10 +264,10 @@ impl ReceiptRead for TapAgentContext { e ), })?; - let allocation_id = Address::from_str(&record.allocation_id).map_err(|e| { + let collection_id = FixedBytes::<32>::from_str(&record.collection_id).map_err(|e| { AdapterError::ReceiptRead { error: format!( - "Error decoding allocation_id while retrieving receipt from database: {}", + "Error decoding collection_id while retrieving receipt from database: {}", e ), } @@ -319,7 +320,7 @@ impl ReceiptRead for TapAgentContext { payer, data_service, service_provider, - allocation_id, + collection_id, timestamp_ns, nonce, value, @@ -361,13 +362,13 @@ impl ReceiptDelete for TapAgentContext { r#" DELETE FROM tap_horizon_receipts WHERE - allocation_id = $1 + collection_id = $1 AND signer_address IN (SELECT unnest($2::text[])) AND $3::numrange @> timestamp_ns AND payer = $4 AND service_provider = $5 "#, - self.allocation_id.encode_hex(), + CollectionId::from(self.allocation_id).encode_hex(), &signers, rangebounds_to_pgrange(timestamp_ns), self.sender.encode_hex(), @@ -602,7 +603,7 @@ mod test { r#" SELECT signature, - allocation_id, + collection_id, payer, data_service, service_provider, @@ -623,7 +624,7 @@ mod test { .into_iter() .map(|record| { let signature = record.signature.as_slice().try_into().unwrap(); - let allocation_id = Address::from_str(&record.allocation_id).unwrap(); + let collection_id = FixedBytes::<32>::from_str(&record.collection_id).unwrap(); let payer = Address::from_str(&record.payer).unwrap(); let data_service = Address::from_str(&record.data_service).unwrap(); let service_provider = Address::from_str(&record.service_provider).unwrap(); @@ -640,7 +641,7 @@ mod test { let signed_receipt = tap_graph::v2::SignedReceipt { message: tap_graph::v2::Receipt { - allocation_id, + collection_id, payer, data_service, service_provider, diff --git a/crates/test-assets/src/lib.rs b/crates/test-assets/src/lib.rs index 729569170..e4bf65e7c 100644 --- a/crates/test-assets/src/lib.rs +++ b/crates/test-assets/src/lib.rs @@ -17,11 +17,8 @@ use tap_core::{signed_message::Eip712SignedMessage, tap_eip712_domain}; use tap_graph::{Receipt, SignedReceipt}; use thegraph_core::{ alloy::{ - primitives::{address, Address, U256}, - signers::local::{coins_bip39::English, MnemonicBuilder, PrivateKeySigner}, - sol_types::Eip712Domain, - }, - deployment_id, DeploymentId, + primitives::{address, Address, U256}, signers::local::{coins_bip39::English, MnemonicBuilder, PrivateKeySigner}, sol_types::Eip712Domain + }, collection_id, deployment_id, CollectionId, DeploymentId }; use tokio::sync::mpsc; @@ -124,6 +121,7 @@ pub const INDEXER_ADDRESS: Address = address!("d75c4dbcb215a6cf9097cfbcc70aab259 pub const DISPUTE_MANAGER_ADDRESS: Address = address!("deadbeefcafebabedeadbeefcafebabedeadbeef"); pub const ALLOCATION_ID_0: Address = address!("fa44c72b753a66591f241c7dc04e8178c30e13af"); +pub const COLLECTION_ID_0: CollectionId = collection_id!("000000000000000000000000fa44c72b753a66591f241c7dc04e8178c30e13af"); pub const ALLOCATION_ID_1: Address = address!("dd975e30aafebb143e54d215db8a3e8fd916a701"); @@ -369,7 +367,7 @@ pub async fn create_signed_receipt( /// Function to generate a signed receipt using the TAP_SIGNER wallet. #[bon::builder] pub async fn create_signed_receipt_v2( - #[builder(default = ALLOCATION_ID_0)] allocation_id: Address, + #[builder(default = COLLECTION_ID_0)] collection_id: CollectionId, #[builder(default)] nonce: u64, #[builder(default = SystemTime::now() .duration_since(UNIX_EPOCH) @@ -386,7 +384,7 @@ pub async fn create_signed_receipt_v2( payer: TAP_SENDER.1, service_provider: INDEXER_ADDRESS, data_service: Address::ZERO, - allocation_id, + collection_id: collection_id.into_inner(), nonce, timestamp_ns, value,