@secondlayer/shared 11.21.0 → 11.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/archive/range-digest.d.ts +29 -0
- package/dist/src/archive/semantic-digest-builder.d.ts +29 -0
- package/dist/src/coverage/index.d.ts +29 -0
- package/dist/src/db/index.d.ts +29 -0
- package/dist/src/db/queries/chain-reorgs.d.ts +29 -0
- package/dist/src/db/queries/contracts.d.ts +29 -0
- package/dist/src/db/queries/instance.d.ts +29 -0
- package/dist/src/db/queries/integrity.d.ts +29 -0
- package/dist/src/db/queries/subgraph-gaps.d.ts +29 -0
- package/dist/src/db/queries/subgraph-operations.d.ts +29 -0
- package/dist/src/db/queries/subgraphs.d.ts +35 -0
- package/dist/src/db/queries/subgraphs.js +13 -2
- package/dist/src/db/queries/subgraphs.js.map +4 -4
- package/dist/src/db/queries/sync-scope.d.ts +29 -0
- package/dist/src/db/queries/webhooks.d.ts +29 -0
- package/dist/src/db/schema.d.ts +29 -0
- package/dist/src/index-http.d.ts +22 -1
- package/dist/src/index-http.js +11 -1
- package/dist/src/index-http.js.map +3 -3
- package/dist/src/index.d.ts +246 -208
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +4 -4
- package/dist/src/node/local-client.d.ts +29 -0
- package/dist/src/node/tx-summary.d.ts +22 -0
- package/dist/src/node/tx-summary.js +194 -0
- package/dist/src/node/tx-summary.js.map +12 -0
- package/dist/src/schemas/index.d.ts +30 -1
- package/dist/src/schemas/index.js.map +2 -2
- package/dist/src/schemas/subgraphs.d.ts +30 -1
- package/dist/src/schemas/subgraphs.js.map +2 -2
- package/dist/src/subgraphs/spec.d.ts +27 -0
- package/dist/src/subgraphs/spec.js +4 -1
- package/dist/src/subgraphs/spec.js.map +3 -3
- package/migrations/0157_subgraph_pin_verification.ts +35 -0
- package/migrations/0158_subgraph_pin_preimage.ts +25 -0
- package/package.json +6 -2
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -336,6 +336,27 @@ declare function cursorIsBeforeBlock(cursor: StreamsCursor, height: number): boo
|
|
|
336
336
|
declare function planDecoderReceipts(input: DecoderClockInput): DecoderClockResult;
|
|
337
337
|
import { Kysely } from "kysely";
|
|
338
338
|
import { ColumnType, Generated } from "kysely";
|
|
339
|
+
/**
|
|
340
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
341
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
342
|
+
*
|
|
343
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
344
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
345
|
+
* verifiable: one with any reason is refused at deploy.
|
|
346
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
347
|
+
* re-execution proofs, which are not served yet.
|
|
348
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
349
|
+
* backfill).
|
|
350
|
+
*/
|
|
351
|
+
interface SubgraphVerification {
|
|
352
|
+
level: "state" | "events" | "none";
|
|
353
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
354
|
+
* `print_event source "swaps" needs event proofs` or
|
|
355
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
356
|
+
reasons: string[];
|
|
357
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
358
|
+
unproven: string[];
|
|
359
|
+
}
|
|
339
360
|
interface BlocksTable {
|
|
340
361
|
height: number;
|
|
341
362
|
hash: string;
|
|
@@ -496,6 +517,14 @@ interface SubgraphsTable {
|
|
|
496
517
|
expires_at: Date | null;
|
|
497
518
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
498
519
|
sparse_probe_targets: unknown | null;
|
|
520
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
521
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
522
|
+
pin: string | null;
|
|
523
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
524
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
525
|
+
pin_preimage: string | null;
|
|
526
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
527
|
+
verification: SubgraphVerification | null;
|
|
499
528
|
created_at: Generated<Date>;
|
|
500
529
|
updated_at: Generated<Date>;
|
|
501
530
|
}
|
package/dist/src/db/index.d.ts
CHANGED
|
@@ -20,6 +20,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
20
20
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
21
21
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
22
22
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
23
|
+
/**
|
|
24
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
25
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
26
|
+
*
|
|
27
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
28
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
29
|
+
* verifiable: one with any reason is refused at deploy.
|
|
30
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
31
|
+
* re-execution proofs, which are not served yet.
|
|
32
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
33
|
+
* backfill).
|
|
34
|
+
*/
|
|
35
|
+
interface SubgraphVerification {
|
|
36
|
+
level: "state" | "events" | "none";
|
|
37
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
38
|
+
* `print_event source "swaps" needs event proofs` or
|
|
39
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
40
|
+
reasons: string[];
|
|
41
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
42
|
+
unproven: string[];
|
|
43
|
+
}
|
|
23
44
|
interface BlocksTable {
|
|
24
45
|
height: number;
|
|
25
46
|
hash: string;
|
|
@@ -180,6 +201,14 @@ interface SubgraphsTable {
|
|
|
180
201
|
expires_at: Date | null;
|
|
181
202
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
182
203
|
sparse_probe_targets: unknown | null;
|
|
204
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
205
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
206
|
+
pin: string | null;
|
|
207
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
208
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
209
|
+
pin_preimage: string | null;
|
|
210
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
211
|
+
verification: SubgraphVerification | null;
|
|
183
212
|
created_at: Generated<Date>;
|
|
184
213
|
updated_at: Generated<Date>;
|
|
185
214
|
}
|
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -19,6 +19,27 @@ type FailureClass = (typeof FAILURE_CLASSES)[number];
|
|
|
19
19
|
declare const RETRY_STATES: readonly ["open", "retrying", "halted", "resolved"];
|
|
20
20
|
type RetryState = (typeof RETRY_STATES)[number];
|
|
21
21
|
type BootstrapSource = "archive" | "genesis" | "import";
|
|
22
|
+
/**
|
|
23
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
24
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
25
|
+
*
|
|
26
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
27
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
28
|
+
* verifiable: one with any reason is refused at deploy.
|
|
29
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
30
|
+
* re-execution proofs, which are not served yet.
|
|
31
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
32
|
+
* backfill).
|
|
33
|
+
*/
|
|
34
|
+
interface SubgraphVerification {
|
|
35
|
+
level: "state" | "events" | "none";
|
|
36
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
37
|
+
* `print_event source "swaps" needs event proofs` or
|
|
38
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
39
|
+
reasons: string[];
|
|
40
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
41
|
+
unproven: string[];
|
|
42
|
+
}
|
|
22
43
|
interface BlocksTable {
|
|
23
44
|
height: number;
|
|
24
45
|
hash: string;
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import { Kysely } from "kysely";
|
|
2
|
+
/**
|
|
3
|
+
* How far a subgraph's rows can be checked without trusting the server,
|
|
4
|
+
* derived from its sources and a scan of its handler. Never configured.
|
|
5
|
+
*
|
|
6
|
+
* - `state`: every input is a named state write, provable from block headers.
|
|
7
|
+
* Handlers run in the deterministic realm. A deployed `state` subgraph is
|
|
8
|
+
* verifiable: one with any reason is refused at deploy.
|
|
9
|
+
* - `events`: an input (events, prints, tx results, `ctx.client`) needs
|
|
10
|
+
* re-execution proofs, which are not served yet.
|
|
11
|
+
* - `none`: a source can never be proven as written (trait scope, tip-first
|
|
12
|
+
* backfill).
|
|
13
|
+
*/
|
|
14
|
+
interface SubgraphVerification {
|
|
15
|
+
level: "state" | "events" | "none";
|
|
16
|
+
/** What stands between the subgraph and checkable rows, e.g.
|
|
17
|
+
* `print_event source "swaps" needs event proofs` or
|
|
18
|
+
* `subgraph.ts:41:12 Date: wall-clock time differs per run`. */
|
|
19
|
+
reasons: string[];
|
|
20
|
+
/** What stays unproven even at this level, e.g. tx attribution of writes. */
|
|
21
|
+
unproven: string[];
|
|
22
|
+
}
|
|
2
23
|
import { ColumnType, Generated, Selectable } from "kysely";
|
|
3
24
|
/**
|
|
4
25
|
* Coverage-kernel constraints. SQL CHECKs in migration 0116 must stay
|
|
@@ -179,6 +200,14 @@ interface SubgraphsTable {
|
|
|
179
200
|
expires_at: Date | null;
|
|
180
201
|
/** (event type, contract) probe pairs persisted at deploy for weight classification. */
|
|
181
202
|
sparse_probe_targets: unknown | null;
|
|
203
|
+
/** sha256 over everything that shapes rows (schema, handler bundle,
|
|
204
|
+
* startBlock, network, runtime). NULL for unbundled or older deploys. */
|
|
205
|
+
pin: string | null;
|
|
206
|
+
/** The canonical JSON `pin` hashes, so a client can recompute it. NULL
|
|
207
|
+
* wherever `pin` is, and for deploys before migration 0158. */
|
|
208
|
+
pin_preimage: string | null;
|
|
209
|
+
/** Level derived at deploy. NULL (older deploys) = not verifiable. */
|
|
210
|
+
verification: SubgraphVerification | null;
|
|
182
211
|
created_at: Generated<Date>;
|
|
183
212
|
updated_at: Generated<Date>;
|
|
184
213
|
}
|
|
@@ -1110,6 +1139,9 @@ declare function registerSubgraph(db: Kysely<Database>, data: {
|
|
|
1110
1139
|
startBlock?: number
|
|
1111
1140
|
handlerCode?: string
|
|
1112
1141
|
sourceCode?: string
|
|
1142
|
+
pin?: string | null
|
|
1143
|
+
pinPreimage?: string | null
|
|
1144
|
+
verification?: SubgraphVerification | null
|
|
1113
1145
|
}): Promise<Subgraph>;
|
|
1114
1146
|
declare function getSubgraph(db: Kysely<Database>, name: string, accountId?: string): Promise<Subgraph | null>;
|
|
1115
1147
|
declare function listSubgraphs(db: Kysely<Database>, accountId?: string): Promise<Subgraph[]>;
|
|
@@ -1140,6 +1172,9 @@ declare function clearSubgraphBillingPaused(db: Kysely<Database>, name: string):
|
|
|
1140
1172
|
declare function updateSubgraphHandlerPath(db: Kysely<Database>, name: string, handlerPath: string, opts?: {
|
|
1141
1173
|
handlerCode?: string
|
|
1142
1174
|
sourceCode?: string
|
|
1175
|
+
pin?: string | null
|
|
1176
|
+
pinPreimage?: string | null
|
|
1177
|
+
verification?: SubgraphVerification | null
|
|
1143
1178
|
}): Promise<void>;
|
|
1144
1179
|
declare function deleteSubgraph(db: Kysely<Database>, name: string, accountId?: string): Promise<Subgraph | null>;
|
|
1145
1180
|
/** Set or clear a paid subgraph's expiry (NULL = no expiry, e.g. on claim). */
|
|
@@ -92,7 +92,10 @@ async function registerSubgraph(db, data) {
|
|
|
92
92
|
handler_code: data.handlerCode ?? null,
|
|
93
93
|
source_code: data.sourceCode ?? null,
|
|
94
94
|
schema_name: data.schemaName ?? null,
|
|
95
|
-
start_block: data.startBlock ?? 0
|
|
95
|
+
start_block: data.startBlock ?? 0,
|
|
96
|
+
pin: data.pin ?? null,
|
|
97
|
+
pin_preimage: data.pinPreimage ?? null,
|
|
98
|
+
verification: data.verification ? jsonb(data.verification) : null
|
|
96
99
|
};
|
|
97
100
|
const updateSet = {
|
|
98
101
|
version: data.version,
|
|
@@ -103,6 +106,9 @@ async function registerSubgraph(db, data) {
|
|
|
103
106
|
source_code: data.sourceCode ?? null,
|
|
104
107
|
schema_name: data.schemaName ?? null,
|
|
105
108
|
start_block: data.startBlock ?? 0,
|
|
109
|
+
pin: values.pin,
|
|
110
|
+
pin_preimage: values.pin_preimage,
|
|
111
|
+
verification: values.verification,
|
|
106
112
|
updated_at: new Date
|
|
107
113
|
};
|
|
108
114
|
if (!isPlatformMode()) {
|
|
@@ -166,6 +172,11 @@ async function updateSubgraphHandlerPath(db, name, handlerPath, opts) {
|
|
|
166
172
|
handler_path: handlerPath,
|
|
167
173
|
...opts?.handlerCode != null ? { handler_code: opts.handlerCode } : {},
|
|
168
174
|
...opts?.sourceCode != null ? { source_code: opts.sourceCode } : {},
|
|
175
|
+
...opts?.pin !== undefined ? { pin: opts.pin } : {},
|
|
176
|
+
...opts?.pinPreimage !== undefined ? { pin_preimage: opts.pinPreimage } : {},
|
|
177
|
+
...opts?.verification !== undefined ? {
|
|
178
|
+
verification: opts.verification ? jsonb(opts.verification) : null
|
|
179
|
+
} : {},
|
|
169
180
|
updated_at: new Date
|
|
170
181
|
}).where("name", "=", name).execute();
|
|
171
182
|
}
|
|
@@ -220,5 +231,5 @@ export {
|
|
|
220
231
|
updateSubgraphStatus
|
|
221
232
|
};
|
|
222
233
|
|
|
223
|
-
//# debugId=
|
|
234
|
+
//# debugId=3407FD67D654BD8464756E2164756E21
|
|
224
235
|
//# sourceMappingURL=subgraphs.js.map
|