@antseed/node 0.2.164 → 0.2.166
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/health/self-health-error.d.ts +8 -0
- package/dist/health/self-health-error.d.ts.map +1 -1
- package/dist/health/self-health-error.js +22 -0
- package/dist/health/self-health-error.js.map +1 -1
- package/dist/health/upstream-credit.d.ts.map +1 -1
- package/dist/health/upstream-credit.js +3 -2
- package/dist/health/upstream-credit.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +3 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +7 -1
- package/dist/node.js.map +1 -1
- package/dist/payments/channel-store.d.ts +2 -0
- package/dist/payments/channel-store.d.ts.map +1 -1
- package/dist/payments/channel-store.js +6 -0
- package/dist/payments/channel-store.js.map +1 -1
- package/dist/payments/evm/verification-signals-client.d.ts +7 -7
- package/dist/payments/evm/verification-signals-client.d.ts.map +1 -1
- package/dist/payments/evm/verification-signals-client.js +7 -10
- package/dist/payments/evm/verification-signals-client.js.map +1 -1
- package/dist/payments/evm/verifier-client.d.ts +27 -22
- package/dist/payments/evm/verifier-client.d.ts.map +1 -1
- package/dist/payments/evm/verifier-client.js +65 -69
- package/dist/payments/evm/verifier-client.js.map +1 -1
- package/dist/payments/generated-contract-addresses.d.ts +3 -3
- package/dist/payments/generated-contract-addresses.js +3 -3
- package/dist/payments/index.d.ts +2 -0
- package/dist/payments/index.d.ts.map +1 -1
- package/dist/payments/index.js +1 -0
- package/dist/payments/index.js.map +1 -1
- package/dist/payments/seller-buyer-limiter.d.ts +85 -0
- package/dist/payments/seller-buyer-limiter.d.ts.map +1 -0
- package/dist/payments/seller-buyer-limiter.js +218 -0
- package/dist/payments/seller-buyer-limiter.js.map +1 -0
- package/dist/proxy/buyer-response-headers.d.ts +2 -0
- package/dist/proxy/buyer-response-headers.d.ts.map +1 -0
- package/dist/proxy/buyer-response-headers.js +31 -0
- package/dist/proxy/buyer-response-headers.js.map +1 -0
- package/dist/seller-request-handler.d.ts +11 -0
- package/dist/seller-request-handler.d.ts.map +1 -1
- package/dist/seller-request-handler.js +77 -10
- package/dist/seller-request-handler.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,12 +2,12 @@ import { type AbstractProvider } from 'ethers';
|
|
|
2
2
|
/**
|
|
3
3
|
* Reads which advertised services of a batch of sellers have a live DIFF
|
|
4
4
|
* verdict on `AntseedVerificationResults`, the verification results layer,
|
|
5
|
-
* whatever verification method (
|
|
5
|
+
* whatever verification method (audit) recorded it. Two Multicall3 round
|
|
6
6
|
* trips per read, plus one on the first read when the results address has to
|
|
7
7
|
* be discovered from the KBF audits contract (`kbf.results()`, cached):
|
|
8
8
|
*
|
|
9
|
-
* round 1: results.
|
|
10
|
-
*
|
|
9
|
+
* round 1: results.emissionsGate (first read only; it is immutable), and per
|
|
10
|
+
* (agentId, service) results.serviceStatus
|
|
11
11
|
* round 2: emissionsGate.currentEpoch
|
|
12
12
|
*
|
|
13
13
|
* `serviceStatus` holds only recorded results. KBF records a DIFF once
|
|
@@ -17,8 +17,8 @@ import { type AbstractProvider } from 'ethers';
|
|
|
17
17
|
* previous result, so it never cuts reputation here.
|
|
18
18
|
*
|
|
19
19
|
* A recorded verdict is live exactly as the contract counts it:
|
|
20
|
-
* `currentEpoch < verdict.
|
|
21
|
-
* and expired verdicts are not DIFF.
|
|
20
|
+
* `currentEpoch < verdict.validUntilEpoch`, the expiry the recording audit
|
|
21
|
+
* chose. SAME, UNDETERMINED, NONE and expired verdicts are not DIFF.
|
|
22
22
|
*/
|
|
23
23
|
export interface VerificationServiceQuery {
|
|
24
24
|
agentId: number;
|
|
@@ -41,8 +41,8 @@ export declare class VerificationSignalsClient {
|
|
|
41
41
|
* Live DIFF services per agent id, as verification keys (trimmed,
|
|
42
42
|
* lowercased service names). An agent is missing from the result when any
|
|
43
43
|
* of its reads failed, so a caller can keep its previous answer instead of
|
|
44
|
-
* clearing a penalty on an RPC hiccup. Throws when the epoch
|
|
45
|
-
*
|
|
44
|
+
* clearing a penalty on an RPC hiccup. Throws when the current epoch
|
|
45
|
+
* cannot be read at all.
|
|
46
46
|
*/
|
|
47
47
|
readDiffServices(queries: readonly VerificationServiceQuery[]): Promise<Map<number, string[]>>;
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-signals-client.d.ts","sourceRoot":"","sources":["../../../src/payments/evm/verification-signals-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAKtE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAYD,qBAAa,yBAAyB;IAWlC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAVvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqE;IAC3F,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,eAAe,CAAqB;IAE5C;;;OAGG;gBAED,QAAQ,EAAE,gBAAgB,EACT,oBAAoB,EAAE,MAAM,EAC7C,cAAc,CAAC,EAAE,MAAM;IAMzB,4FAA4F;YAC9E,QAAQ;IAStB;;;;;;OAMG;IACG,gBAAgB,CAAC,OAAO,EAAE,SAAS,wBAAwB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"verification-signals-client.d.ts","sourceRoot":"","sources":["../../../src/payments/evm/verification-signals-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAKtE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAYD,qBAAa,yBAAyB;IAWlC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IAVvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqE;IAC3F,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,eAAe,CAAqB;IAE5C;;;OAGG;gBAED,QAAQ,EAAE,gBAAgB,EACT,oBAAoB,EAAE,MAAM,EAC7C,cAAc,CAAC,EAAE,MAAM;IAMzB,4FAA4F;YAC9E,QAAQ;IAStB;;;;;;OAMG;IACG,gBAAgB,CAAC,OAAO,EAAE,SAAS,wBAAwB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAuDrG"}
|
|
@@ -39,8 +39,8 @@ export class VerificationSignalsClient {
|
|
|
39
39
|
* Live DIFF services per agent id, as verification keys (trimmed,
|
|
40
40
|
* lowercased service names). An agent is missing from the result when any
|
|
41
41
|
* of its reads failed, so a caller can keep its previous answer instead of
|
|
42
|
-
* clearing a penalty on an RPC hiccup. Throws when the epoch
|
|
43
|
-
*
|
|
42
|
+
* clearing a penalty on an RPC hiccup. Throws when the current epoch
|
|
43
|
+
* cannot be read at all.
|
|
44
44
|
*/
|
|
45
45
|
async readDiffServices(queries) {
|
|
46
46
|
const out = new Map();
|
|
@@ -59,7 +59,7 @@ export class VerificationSignalsClient {
|
|
|
59
59
|
if (agents.size === 0)
|
|
60
60
|
return out;
|
|
61
61
|
const target = await this._results();
|
|
62
|
-
const requests = [
|
|
62
|
+
const requests = [];
|
|
63
63
|
const needsGate = this._emissionsGate === undefined;
|
|
64
64
|
if (needsGate)
|
|
65
65
|
requests.push({ target, iface: RESULTS_IFACE, method: 'emissionsGate' });
|
|
@@ -71,11 +71,8 @@ export class VerificationSignalsClient {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
const results = await this._read(requests);
|
|
74
|
-
const validity = first(results[0]);
|
|
75
|
-
if (typeof validity !== 'bigint')
|
|
76
|
-
throw new Error('verification validityEpochs read failed');
|
|
77
74
|
if (needsGate) {
|
|
78
|
-
const gate = first(results[
|
|
75
|
+
const gate = first(results[0]);
|
|
79
76
|
if (typeof gate !== 'string')
|
|
80
77
|
throw new Error('verification emissionsGate read failed');
|
|
81
78
|
this._emissionsGate = getAddress(gate);
|
|
@@ -94,12 +91,12 @@ export class VerificationSignalsClient {
|
|
|
94
91
|
continue;
|
|
95
92
|
}
|
|
96
93
|
const verdict = status.verdict ?? status[1];
|
|
97
|
-
const
|
|
98
|
-
if (typeof verdict !== 'bigint' || typeof
|
|
94
|
+
const validUntil = status.validUntilEpoch ?? status[5];
|
|
95
|
+
if (typeof verdict !== 'bigint' || typeof validUntil !== 'bigint') {
|
|
99
96
|
failed.add(call.agentId);
|
|
100
97
|
continue;
|
|
101
98
|
}
|
|
102
|
-
if (verdict === VERDICT_DIFF && currentEpoch <
|
|
99
|
+
if (verdict === VERDICT_DIFF && currentEpoch < validUntil)
|
|
103
100
|
out.get(call.agentId).push(call.key);
|
|
104
101
|
}
|
|
105
102
|
for (const agentId of failed)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-signals-client.js","sourceRoot":"","sources":["../../../src/payments/evm/verification-signals-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAyB,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAyB,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AA8B9E,MAAM,YAAY,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAEnD,MAA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9B,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAA4C;QACjE,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoB,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;QAC3C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC;gBAAE,SAAS;YACzE,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAC7C,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACrC,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;gBAC5C,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;oBAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5D,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,GAAG,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAuB,
|
|
1
|
+
{"version":3,"file":"verification-signals-client.js","sourceRoot":"","sources":["../../../src/payments/evm/verification-signals-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAyB,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAyB,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAA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7
|
+
* The `AntseedKbfAudits` contract: the KBF audit auditors submit audits to, which also holds the
|
|
8
8
|
* approved auditors. The results layer is discovered from it (`results()`) unless given below.
|
|
9
9
|
*/
|
|
10
10
|
contractAddress: string;
|
|
@@ -49,7 +49,7 @@ export interface ServiceAuditedEvent {
|
|
|
49
49
|
auditor: string;
|
|
50
50
|
modelHash: string;
|
|
51
51
|
verdict: VerifierVerdict;
|
|
52
|
-
/** The service's report round: it moves on whenever any
|
|
52
|
+
/** The service's report round: it moves on whenever any audit moves the service's verdict into or out of DIFF, an auditor is revoked, or the results owner clears the service; only reports of the current round count. */
|
|
53
53
|
round: number;
|
|
54
54
|
/** Distinct auditors reporting `verdict` for this service and model in the epoch and round, this report included. */
|
|
55
55
|
reports: number;
|
|
@@ -100,14 +100,14 @@ export interface AuditorProfile {
|
|
|
100
100
|
/** AntseedKbfAudits profile limits. */
|
|
101
101
|
export declare const MAX_AUDITOR_PROFILE_NAME_BYTES = 64;
|
|
102
102
|
export declare const MAX_AUDITOR_PROFILE_URI_BYTES = 256;
|
|
103
|
-
/** `AntseedVerificationResults.REWARDS_OFF`:
|
|
103
|
+
/** `AntseedVerificationResults.REWARDS_OFF`: an audit's rewards start epoch while its rewards are off. */
|
|
104
104
|
export declare const VERIFICATION_REWARDS_OFF: bigint;
|
|
105
105
|
/** Throws when `profile` would be rejected by `setAuditorProfile`, with the reason. */
|
|
106
106
|
export declare function validateAuditorProfile(profile: AuditorProfile): void;
|
|
107
|
-
/** `AntseedKbfAudits`: the KBF
|
|
108
|
-
export declare const KBF_AUDITS_ABI: readonly ["function submitModelAudit(uint256 expectedEpoch,bytes32 modelHash,bytes32 evidenceHash,string evidenceUri,(uint256 agentId,bytes32 serviceHash,uint8 verdict)[] results) external", "function requiredReports(uint8 verdict) external view returns (uint8)", "function reportRound(uint256 agentId,bytes32 serviceHash) external view returns (uint256)", "function reportKey(uint256 epoch,uint256 agentId,bytes32 serviceHash,bytes32 modelHash,uint256 round) external pure returns (bytes32)", "function reportOf(bytes32 key,address auditor) external view returns (uint8)", "function reportCount(bytes32 key,uint8 verdict) external view returns (uint256)", "function
|
|
109
|
-
/** `AntseedVerificationResults`: verdicts and verification rewards, for every
|
|
110
|
-
export declare const VERIFICATION_RESULTS_ABI: readonly ["function serviceStatus(uint256 agentId,bytes32 serviceHash) external view returns ((bytes32 modelHash,uint8 verdict,uint64 updatedAt,uint64 epoch,address
|
|
107
|
+
/** `AntseedKbfAudits`: the KBF audit auditors submit to. */
|
|
108
|
+
export declare const KBF_AUDITS_ABI: readonly ["function submitModelAudit(uint256 expectedEpoch,bytes32 modelHash,bytes32 evidenceHash,string evidenceUri,(uint256 agentId,bytes32 serviceHash,uint8 verdict)[] results) external", "function requiredReports(uint8 verdict) external view returns (uint8)", "function reportRound(uint256 agentId,bytes32 serviceHash) external view returns (uint256)", "function reportKey(uint256 epoch,uint256 agentId,bytes32 serviceHash,bytes32 modelHash,uint256 round) external pure returns (bytes32)", "function reportOf(bytes32 key,address auditor) external view returns (uint8)", "function reportCount(bytes32 key,uint8 verdict) external view returns (uint256)", "function creditedAudits(uint256 epoch,address auditor,bytes32 modelHash) external view returns (uint256)", "function maxCreditsPerModelPerEpoch() external view returns (uint32)", "function creditsPerAudit() external view returns (uint32)", "function modelCreditsPerAudit(bytes32 modelHash) external view returns (uint32)", "function creditsFor(bytes32 modelHash) external view returns (uint256)", "function validityEpochs() external view returns (uint8)", "function diffReplacementReports() external view returns (uint8)", "function results() external view returns (address)", "function sellerPools() external view returns (address)", "function identityRegistry() external view returns (address)", "function approvedAuditors(address auditor) external view returns (bool)", "function auditorRevocations() external view returns (uint256)", "function agentOwner(uint256 agentId) external view returns (bool known,address owner)", "function auditorProfile(address auditor) external view returns ((string name,string iconUri,string url))", "function setAuditorProfile(string name,string iconUri,string url) external", "event AuditorSet(address indexed auditor,bool approved,uint256 revocations)", "event AuditorProfileSet(address indexed auditor,string name,string iconUri,string url)", "event ModelAudited(bytes32 indexed modelHash,address indexed auditor,uint256 indexed epoch,bytes32 evidenceHash,string evidenceUri,uint256 resultCount)", "event ServiceAudited(uint256 indexed agentId,bytes32 indexed serviceHash,address indexed auditor,bytes32 modelHash,uint8 verdict,uint256 round,uint256 reports,uint256 required)", "event AuditCredited(uint256 indexed epoch,address indexed auditor,bytes32 indexed modelHash,uint256 credits)", "event UnknownAgentSkipped(uint256 indexed agentId,bytes32 indexed modelHash)", "event ValidityEpochsSet(uint8 validityEpochs)", "event CreditsPerAuditSet(uint32 credits)", "event ModelCreditsPerAuditSet(bytes32 indexed modelHash,uint32 credits)"];
|
|
109
|
+
/** `AntseedVerificationResults`: verdicts and verification rewards, for every audit. */
|
|
110
|
+
export declare const VERIFICATION_RESULTS_ABI: readonly ["function serviceStatus(uint256 agentId,bytes32 serviceHash) external view returns ((bytes32 modelHash,uint8 verdict,uint64 updatedAt,uint64 epoch,address audit,uint64 validUntilEpoch))", "function agentStatus(uint256 agentId) external view returns ((uint16 verifiedCount,uint16 diffCount))", "function isVerified(uint256 agentId) external view returns (bool)", "function liveVerdict(uint256 agentId,bytes32 serviceHash) external view returns (uint8)", "function serviceClears(uint256 agentId,bytes32 serviceHash) external view returns (uint256)", "function diffChanges(uint256 agentId,bytes32 serviceHash) external view returns (uint256)", "function emissionsGate() external view returns (address)", "function currentEpoch() external view returns (uint256)", "function isAudit(address audit) external view returns (bool)", "function auditShareBps(address audit) external view returns (uint16)", "function auditShareBpsAt(address audit,uint256 epoch) external view returns (uint16)", "function auditBudget(address audit,uint256 epoch) external view returns (uint256)", "function rewardsStartEpoch(address audit) external view returns (uint64)", "function maxCreditsPerAuditorPerEpoch(address audit) external view returns (uint32)", "function maxAuditorShareBps(address audit) external view returns (uint16)", "function epochCredits(address audit,uint256 epoch) external view returns (uint256)", "function auditorEpochCredits(address audit,uint256 epoch,address auditor) external view returns (uint256)", "function auditorEpochClaimed(address audit,uint256 epoch,address auditor) external view returns (bool)", "function claimAuditorReward(address audit,uint256 epoch) external", "function pendingAuditorReward(address audit,address auditor,uint256 epoch) external view returns (uint256)", "function paused() external view returns (bool)", "event ServiceStatusChanged(uint256 indexed agentId,bytes32 indexed serviceHash,bytes32 modelHash,uint8 previous,uint8 current,address audit,uint256 epoch,uint256 validUntilEpoch)", "event ServiceCleared(uint256 indexed agentId,bytes32 indexed serviceHash,uint256 epoch,uint256 clears)", "event AgentStatusChanged(uint256 indexed agentId,uint16 verifiedCount,uint16 diffCount)", "event Credited(address indexed audit,uint256 indexed epoch,address indexed auditor,uint256 credits)", "event AuditorRewardClaimed(address indexed audit,uint256 indexed epoch,address indexed auditor,uint256 credits,uint256 totalCredits,uint256 grossAmount,uint256 claimableAmount,uint256 reserveAmount)"];
|
|
111
111
|
export declare function serviceHash(service: string): string;
|
|
112
112
|
/** Identifies the model a service was audited as. */
|
|
113
113
|
export declare function modelHash(model: string): string;
|
|
@@ -118,10 +118,12 @@ export interface VerifierServiceStatus {
|
|
|
118
118
|
/** Latest result (SAME, DIFF, or UNDETERMINED); only SAME and DIFF count in the agent's status. */
|
|
119
119
|
verdict: VerifierVerdict;
|
|
120
120
|
updatedAt: bigint;
|
|
121
|
-
/** Emissions epoch the verdict was given in;
|
|
121
|
+
/** Emissions epoch the verdict was given in; 0 when there is none. */
|
|
122
122
|
epoch: bigint;
|
|
123
|
-
/**
|
|
124
|
-
|
|
123
|
+
/** First epoch the verdict no longer counts in, chosen by the audit that recorded it; 0 when there is none. */
|
|
124
|
+
validUntilEpoch: bigint;
|
|
125
|
+
/** Audit contract that recorded the verdict (e.g. the KBF audits contract); the zero address when there is none. */
|
|
126
|
+
audit: string;
|
|
125
127
|
}
|
|
126
128
|
/**
|
|
127
129
|
* Reads and writes the split verification contracts on behalf of a KBF verifier:
|
|
@@ -129,7 +131,7 @@ export interface VerifierServiceStatus {
|
|
|
129
131
|
* - `AntseedKbfAudits` (`contractAddress`): approved auditors (`AuditorSet` events), audits, report
|
|
130
132
|
* tallies, per-model credits;
|
|
131
133
|
* - `AntseedVerificationResults` (`kbf.results()`): verdicts, epochs, credits and reward claims,
|
|
132
|
-
* keyed by the KBF contract as the
|
|
134
|
+
* keyed by the KBF contract as the audit.
|
|
133
135
|
*
|
|
134
136
|
* The results address is discovered from the KBF contract on first use and cached.
|
|
135
137
|
*/
|
|
@@ -150,14 +152,20 @@ export declare class VerifierClient extends BaseEvmClient {
|
|
|
150
152
|
resultsAddress(): Promise<string>;
|
|
151
153
|
/** Records one auditor's results for every seller audited as one model, on the KBF contract. */
|
|
152
154
|
submitModelAudit(signer: AbstractSigner, input: SubmitModelAuditInput): Promise<string>;
|
|
153
|
-
/**
|
|
154
|
-
|
|
155
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Claims KBF rewards on the results contract, one transaction per epoch as the contract takes
|
|
157
|
+
* them: `results.claimAuditorReward(kbf, epoch)`. Returns the transaction hashes in order.
|
|
158
|
+
*/
|
|
159
|
+
claimAuditorRewards(signer: AbstractSigner, epochs: readonly (number | bigint)[]): Promise<string[]>;
|
|
160
|
+
/** Claimable KBF reward of a finalized epoch: `results.pendingAuditorReward(kbf, auditor, epoch)`. */
|
|
156
161
|
pendingAuditorReward(auditor: string, epoch: number | bigint): Promise<bigint>;
|
|
157
162
|
/** KBF credits the auditor earned in `epoch`, and the epoch's KBF total, from the results contract. */
|
|
158
163
|
auditCredits(auditor: string, epoch: number | bigint): Promise<AuditorCredits>;
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
/** Audits of `model` (a model hash) by `auditor` in `epoch` that earned credits; at most `perModel` of `creditLimits`. */
|
|
165
|
+
creditedAudits(epoch: number | bigint, auditor: string, model: string): Promise<bigint>;
|
|
166
|
+
/** Credits one audit of `model` (a model hash) earns now: its own amount on the KBF contract, else the default. */
|
|
167
|
+
creditsFor(model: string): Promise<bigint>;
|
|
168
|
+
/** Per-auditor credit cap (results layer, for the KBF audit, per epoch) and per-model cap on credited audits (KBF contract). */
|
|
161
169
|
creditLimits(): Promise<{
|
|
162
170
|
perAuditor: bigint;
|
|
163
171
|
perModel: bigint;
|
|
@@ -176,12 +184,9 @@ export declare class VerifierClient extends BaseEvmClient {
|
|
|
176
184
|
auditorProfile(auditor: string): Promise<AuditorProfile>;
|
|
177
185
|
/** Sets the signer's display profile on the KBF contract (approved auditors only). */
|
|
178
186
|
setAuditorProfile(signer: AbstractSigner, profile: AuditorProfile): Promise<string>;
|
|
179
|
-
/** What `settleEpochRemainder(epoch)` would sweep now (burn, then reserve); 0 for the current epoch. */
|
|
180
|
-
unclaimableRemainder(epoch: number | bigint): Promise<bigint>;
|
|
181
|
-
/** Sweeps a finalized epoch's unclaimable verification budget; anyone may send it. */
|
|
182
|
-
settleEpochRemainder(signer: AbstractSigner, epoch: number | bigint): Promise<string>;
|
|
183
187
|
/** The emissions gate the results contract pinned at deployment; `expectedEpoch` is checked against it. */
|
|
184
188
|
emissionsGate(): Promise<string>;
|
|
189
|
+
/** Epochs a KBF verdict counts for (KBF contract), including the one it was given in. */
|
|
185
190
|
validityEpochs(): Promise<number>;
|
|
186
191
|
/** The current epoch exactly as `submitModelAudit` checks it. */
|
|
187
192
|
currentEpochWindow(): Promise<{
|
|
@@ -190,7 +195,7 @@ export declare class VerifierClient extends BaseEvmClient {
|
|
|
190
195
|
endsAt: number;
|
|
191
196
|
}>;
|
|
192
197
|
isVerified(agentId: number | bigint): Promise<boolean>;
|
|
193
|
-
/** SAME and DIFF services whose verdicts
|
|
198
|
+
/** SAME and DIFF services whose verdicts still count (`currentEpoch < validUntilEpoch`). */
|
|
194
199
|
agentStatus(agentId: number | bigint): Promise<{
|
|
195
200
|
verifiedCount: number;
|
|
196
201
|
diffCount: number;
|
|
@@ -199,7 +204,7 @@ export declare class VerifierClient extends BaseEvmClient {
|
|
|
199
204
|
serviceStatusByHash(agentId: number | bigint, hash: string): Promise<VerifierServiceStatus>;
|
|
200
205
|
/** Whether `auditor` is approved on the KBF contract. */
|
|
201
206
|
approvedAuditor(auditor: string): Promise<boolean>;
|
|
202
|
-
registry
|
|
207
|
+
/** The identity registry the KBF contract resolves agent owners with. */
|
|
203
208
|
identityRegistry(): Promise<string>;
|
|
204
209
|
agentOwner(agentId: number | bigint): Promise<string>;
|
|
205
210
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier-client.d.ts","sourceRoot":"","sources":["../../../src/payments/evm/verifier-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,cAAc,EAEpB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,mDAAmD;AACnD,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,OAAO,gBAAgB,EAAE,MAAM,CAAC,CAAC;AACjF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAEvF,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CAE1E;AAED,8CAA8C;AAC9C,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,Y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|
/** AntseedKbfAudits profile limits. */
|
|
17
17
|
export const MAX_AUDITOR_PROFILE_NAME_BYTES = 64;
|
|
18
18
|
export const MAX_AUDITOR_PROFILE_URI_BYTES = 256;
|
|
19
|
-
/** `AntseedVerificationResults.REWARDS_OFF`:
|
|
19
|
+
/** `AntseedVerificationResults.REWARDS_OFF`: an audit's rewards start epoch while its rewards are off. */
|
|
20
20
|
export const VERIFICATION_REWARDS_OFF = 2n ** 64n - 1n;
|
|
21
21
|
/** Throws when `profile` would be rejected by `setAuditorProfile`, with the reason. */
|
|
22
22
|
export function validateAuditorProfile(profile) {
|
|
@@ -41,7 +41,7 @@ export function validateAuditorProfile(profile) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
/** `AntseedKbfAudits`: the KBF
|
|
44
|
+
/** `AntseedKbfAudits`: the KBF audit auditors submit to. */
|
|
45
45
|
export const KBF_AUDITS_ABI = [
|
|
46
46
|
'function submitModelAudit(uint256 expectedEpoch,bytes32 modelHash,bytes32 evidenceHash,string evidenceUri,(uint256 agentId,bytes32 serviceHash,uint8 verdict)[] results) external',
|
|
47
47
|
'function requiredReports(uint8 verdict) external view returns (uint8)',
|
|
@@ -49,10 +49,16 @@ export const KBF_AUDITS_ABI = [
|
|
|
49
49
|
'function reportKey(uint256 epoch,uint256 agentId,bytes32 serviceHash,bytes32 modelHash,uint256 round) external pure returns (bytes32)',
|
|
50
50
|
'function reportOf(bytes32 key,address auditor) external view returns (uint8)',
|
|
51
51
|
'function reportCount(bytes32 key,uint8 verdict) external view returns (uint256)',
|
|
52
|
-
'function
|
|
52
|
+
'function creditedAudits(uint256 epoch,address auditor,bytes32 modelHash) external view returns (uint256)',
|
|
53
53
|
'function maxCreditsPerModelPerEpoch() external view returns (uint32)',
|
|
54
|
+
'function creditsPerAudit() external view returns (uint32)',
|
|
55
|
+
'function modelCreditsPerAudit(bytes32 modelHash) external view returns (uint32)',
|
|
56
|
+
'function creditsFor(bytes32 modelHash) external view returns (uint256)',
|
|
57
|
+
'function validityEpochs() external view returns (uint8)',
|
|
58
|
+
'function diffReplacementReports() external view returns (uint8)',
|
|
54
59
|
'function results() external view returns (address)',
|
|
55
60
|
'function sellerPools() external view returns (address)',
|
|
61
|
+
'function identityRegistry() external view returns (address)',
|
|
56
62
|
'function approvedAuditors(address auditor) external view returns (bool)',
|
|
57
63
|
'function auditorRevocations() external view returns (uint256)',
|
|
58
64
|
'function agentOwner(uint256 agentId) external view returns (bool known,address owner)',
|
|
@@ -62,55 +68,46 @@ export const KBF_AUDITS_ABI = [
|
|
|
62
68
|
'event AuditorProfileSet(address indexed auditor,string name,string iconUri,string url)',
|
|
63
69
|
'event ModelAudited(bytes32 indexed modelHash,address indexed auditor,uint256 indexed epoch,bytes32 evidenceHash,string evidenceUri,uint256 resultCount)',
|
|
64
70
|
'event ServiceAudited(uint256 indexed agentId,bytes32 indexed serviceHash,address indexed auditor,bytes32 modelHash,uint8 verdict,uint256 round,uint256 reports,uint256 required)',
|
|
65
|
-
'event AuditCredited(uint256 indexed epoch,address indexed auditor,bytes32 indexed modelHash)',
|
|
71
|
+
'event AuditCredited(uint256 indexed epoch,address indexed auditor,bytes32 indexed modelHash,uint256 credits)',
|
|
66
72
|
'event UnknownAgentSkipped(uint256 indexed agentId,bytes32 indexed modelHash)',
|
|
73
|
+
'event ValidityEpochsSet(uint8 validityEpochs)',
|
|
74
|
+
'event CreditsPerAuditSet(uint32 credits)',
|
|
75
|
+
'event ModelCreditsPerAuditSet(bytes32 indexed modelHash,uint32 credits)',
|
|
67
76
|
];
|
|
68
|
-
/** `AntseedVerificationResults`: verdicts and verification rewards, for every
|
|
77
|
+
/** `AntseedVerificationResults`: verdicts and verification rewards, for every audit. */
|
|
69
78
|
export const VERIFICATION_RESULTS_ABI = [
|
|
70
|
-
'function serviceStatus(uint256 agentId,bytes32 serviceHash) external view returns ((bytes32 modelHash,uint8 verdict,uint64 updatedAt,uint64 epoch,address
|
|
79
|
+
'function serviceStatus(uint256 agentId,bytes32 serviceHash) external view returns ((bytes32 modelHash,uint8 verdict,uint64 updatedAt,uint64 epoch,address audit,uint64 validUntilEpoch))',
|
|
71
80
|
'function agentStatus(uint256 agentId) external view returns ((uint16 verifiedCount,uint16 diffCount))',
|
|
72
81
|
'function isVerified(uint256 agentId) external view returns (bool)',
|
|
73
82
|
'function liveVerdict(uint256 agentId,bytes32 serviceHash) external view returns (uint8)',
|
|
74
83
|
'function serviceClears(uint256 agentId,bytes32 serviceHash) external view returns (uint256)',
|
|
75
84
|
'function diffChanges(uint256 agentId,bytes32 serviceHash) external view returns (uint256)',
|
|
76
|
-
'function validityEpochs() external view returns (uint8)',
|
|
77
85
|
'function emissionsGate() external view returns (address)',
|
|
78
|
-
'function registry() external view returns (address)',
|
|
79
86
|
'function currentEpoch() external view returns (uint256)',
|
|
80
|
-
'function
|
|
81
|
-
'function
|
|
82
|
-
'function
|
|
83
|
-
'function
|
|
84
|
-
'function rewardsStartEpoch(address
|
|
85
|
-
'function maxCreditsPerAuditorPerEpoch(address
|
|
86
|
-
'function maxAuditorShareBps(address
|
|
87
|
-
'function epochCredits(address
|
|
88
|
-
'function auditorEpochCredits(address
|
|
89
|
-
'function auditorEpochClaimed(address
|
|
90
|
-
'function
|
|
91
|
-
'function
|
|
92
|
-
'function
|
|
93
|
-
'
|
|
94
|
-
'function claimRewards(address source,uint256[] epochs) external returns (uint256)',
|
|
95
|
-
'function pendingReward(address source,address auditor,uint256 epoch) external view returns (uint256)',
|
|
96
|
-
'function settleEpochRemainder(uint256 epoch) external returns (uint256 burnedAmount,uint256 reserveAmount)',
|
|
97
|
-
'event ServiceStatusChanged(uint256 indexed agentId,bytes32 indexed serviceHash,bytes32 modelHash,uint8 previous,uint8 current,address source,uint256 epoch)',
|
|
87
|
+
'function isAudit(address audit) external view returns (bool)',
|
|
88
|
+
'function auditShareBps(address audit) external view returns (uint16)',
|
|
89
|
+
'function auditShareBpsAt(address audit,uint256 epoch) external view returns (uint16)',
|
|
90
|
+
'function auditBudget(address audit,uint256 epoch) external view returns (uint256)',
|
|
91
|
+
'function rewardsStartEpoch(address audit) external view returns (uint64)',
|
|
92
|
+
'function maxCreditsPerAuditorPerEpoch(address audit) external view returns (uint32)',
|
|
93
|
+
'function maxAuditorShareBps(address audit) external view returns (uint16)',
|
|
94
|
+
'function epochCredits(address audit,uint256 epoch) external view returns (uint256)',
|
|
95
|
+
'function auditorEpochCredits(address audit,uint256 epoch,address auditor) external view returns (uint256)',
|
|
96
|
+
'function auditorEpochClaimed(address audit,uint256 epoch,address auditor) external view returns (bool)',
|
|
97
|
+
'function claimAuditorReward(address audit,uint256 epoch) external',
|
|
98
|
+
'function pendingAuditorReward(address audit,address auditor,uint256 epoch) external view returns (uint256)',
|
|
99
|
+
'function paused() external view returns (bool)',
|
|
100
|
+
'event ServiceStatusChanged(uint256 indexed agentId,bytes32 indexed serviceHash,bytes32 modelHash,uint8 previous,uint8 current,address audit,uint256 epoch,uint256 validUntilEpoch)',
|
|
98
101
|
'event ServiceCleared(uint256 indexed agentId,bytes32 indexed serviceHash,uint256 epoch,uint256 clears)',
|
|
99
102
|
'event AgentStatusChanged(uint256 indexed agentId,uint16 verifiedCount,uint16 diffCount)',
|
|
100
|
-
'event Credited(address indexed
|
|
101
|
-
'event
|
|
102
|
-
'event RewardClaimed(address indexed source,uint256 indexed epoch,address indexed auditor,uint256 amount,uint256 reserveAmount)',
|
|
103
|
-
'event EpochRemainderSettled(uint256 indexed epoch,uint256 amount,uint256 burnedAmount,uint256 reserveAmount)',
|
|
103
|
+
'event Credited(address indexed audit,uint256 indexed epoch,address indexed auditor,uint256 credits)',
|
|
104
|
+
'event AuditorRewardClaimed(address indexed audit,uint256 indexed epoch,address indexed auditor,uint256 credits,uint256 totalCredits,uint256 grossAmount,uint256 claimableAmount,uint256 reserveAmount)',
|
|
104
105
|
];
|
|
105
106
|
const EMISSIONS_GATE_EPOCH_ABI = [
|
|
106
107
|
'function currentEpoch() external view returns (uint256)',
|
|
107
108
|
'function genesis() external view returns (uint256)',
|
|
108
109
|
'function epochDuration() external view returns (uint256)',
|
|
109
110
|
];
|
|
110
|
-
const ANTSEED_REGISTRY_ABI = [
|
|
111
|
-
'function identityRegistry() external view returns (address)',
|
|
112
|
-
'function emissions() external view returns (address)',
|
|
113
|
-
];
|
|
114
111
|
const IDENTITY_REGISTRY_ABI = [
|
|
115
112
|
'function ownerOf(uint256 agentId) external view returns (address)',
|
|
116
113
|
];
|
|
@@ -137,7 +134,7 @@ export function sortServiceResults(results) {
|
|
|
137
134
|
* - `AntseedKbfAudits` (`contractAddress`): approved auditors (`AuditorSet` events), audits, report
|
|
138
135
|
* tallies, per-model credits;
|
|
139
136
|
* - `AntseedVerificationResults` (`kbf.results()`): verdicts, epochs, credits and reward claims,
|
|
140
|
-
* keyed by the KBF contract as the
|
|
137
|
+
* keyed by the KBF contract as the audit.
|
|
141
138
|
*
|
|
142
139
|
* The results address is discovered from the KBF contract on first use and cached.
|
|
143
140
|
*/
|
|
@@ -180,15 +177,22 @@ export class VerifierClient extends BaseEvmClient {
|
|
|
180
177
|
async submitModelAudit(signer, input) {
|
|
181
178
|
return this._execWrite(signer, KBF_AUDITS_ABI, 'submitModelAudit', input.expectedEpoch, input.modelHash, input.evidenceHash, input.evidenceUri, sortServiceResults(input.results).map((result) => [result.agentId, result.serviceHash, result.verdict]));
|
|
182
179
|
}
|
|
183
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* Claims KBF rewards on the results contract, one transaction per epoch as the contract takes
|
|
182
|
+
* them: `results.claimAuditorReward(kbf, epoch)`. Returns the transaction hashes in order.
|
|
183
|
+
*/
|
|
184
184
|
async claimAuditorRewards(signer, epochs) {
|
|
185
185
|
const writer = new ResultsWriter(this._config, await this.resultsAddress()).withProvider(this._provider);
|
|
186
|
-
|
|
186
|
+
const audit = getAddress(this._contractAddress);
|
|
187
|
+
const hashes = [];
|
|
188
|
+
for (const epoch of epochs)
|
|
189
|
+
hashes.push(await writer.claimAuditorReward(signer, audit, BigInt(epoch)));
|
|
190
|
+
return hashes;
|
|
187
191
|
}
|
|
188
|
-
/** Claimable KBF reward of a finalized epoch: `results.
|
|
192
|
+
/** Claimable KBF reward of a finalized epoch: `results.pendingAuditorReward(kbf, auditor, epoch)`. */
|
|
189
193
|
async pendingAuditorReward(auditor, epoch) {
|
|
190
194
|
const results = await this._results();
|
|
191
|
-
return BigInt(await results.getFunction('
|
|
195
|
+
return BigInt(await results.getFunction('pendingAuditorReward')(this._contractAddress, getAddress(auditor), BigInt(epoch)));
|
|
192
196
|
}
|
|
193
197
|
/** KBF credits the auditor earned in `epoch`, and the epoch's KBF total, from the results contract. */
|
|
194
198
|
async auditCredits(auditor, epoch) {
|
|
@@ -199,10 +203,15 @@ export class VerifierClient extends BaseEvmClient {
|
|
|
199
203
|
]);
|
|
200
204
|
return { auditor: BigInt(auditorCredits), total: BigInt(total) };
|
|
201
205
|
}
|
|
202
|
-
|
|
203
|
-
|
|
206
|
+
/** Audits of `model` (a model hash) by `auditor` in `epoch` that earned credits; at most `perModel` of `creditLimits`. */
|
|
207
|
+
async creditedAudits(epoch, auditor, model) {
|
|
208
|
+
return BigInt(await this._contract().getFunction('creditedAudits')(BigInt(epoch), getAddress(auditor), model));
|
|
204
209
|
}
|
|
205
|
-
/**
|
|
210
|
+
/** Credits one audit of `model` (a model hash) earns now: its own amount on the KBF contract, else the default. */
|
|
211
|
+
async creditsFor(model) {
|
|
212
|
+
return BigInt(await this._contract().getFunction('creditsFor')(model));
|
|
213
|
+
}
|
|
214
|
+
/** Per-auditor credit cap (results layer, for the KBF audit, per epoch) and per-model cap on credited audits (KBF contract). */
|
|
206
215
|
async creditLimits() {
|
|
207
216
|
const results = await this._results();
|
|
208
217
|
const [perAuditor, perModel] = await Promise.all([
|
|
@@ -218,13 +227,13 @@ export class VerifierClient extends BaseEvmClient {
|
|
|
218
227
|
*/
|
|
219
228
|
async rewardSettings(epoch) {
|
|
220
229
|
const results = await this._results();
|
|
221
|
-
const
|
|
230
|
+
const audit = this._contractAddress;
|
|
222
231
|
const [start, share, cap] = await Promise.all([
|
|
223
|
-
results.getFunction('rewardsStartEpoch')(
|
|
232
|
+
results.getFunction('rewardsStartEpoch')(audit),
|
|
224
233
|
epoch === undefined
|
|
225
|
-
? results.getFunction('
|
|
226
|
-
: results.getFunction('
|
|
227
|
-
results.getFunction('maxAuditorShareBps')(
|
|
234
|
+
? results.getFunction('auditShareBps')(audit)
|
|
235
|
+
: results.getFunction('auditShareBpsAt')(audit, BigInt(epoch)),
|
|
236
|
+
results.getFunction('maxAuditorShareBps')(audit),
|
|
228
237
|
]);
|
|
229
238
|
return { rewardsStartEpoch: BigInt(start), shareBps: Number(share), maxAuditorShareBps: Number(cap) };
|
|
230
239
|
}
|
|
@@ -242,21 +251,13 @@ export class VerifierClient extends BaseEvmClient {
|
|
|
242
251
|
validateAuditorProfile(profile);
|
|
243
252
|
return this._execWrite(signer, KBF_AUDITS_ABI, 'setAuditorProfile', profile.name, profile.iconUri, profile.url);
|
|
244
253
|
}
|
|
245
|
-
/** What `settleEpochRemainder(epoch)` would sweep now (burn, then reserve); 0 for the current epoch. */
|
|
246
|
-
async unclaimableRemainder(epoch) {
|
|
247
|
-
return BigInt(await (await this._results()).getFunction('unclaimableRemainder')(BigInt(epoch)));
|
|
248
|
-
}
|
|
249
|
-
/** Sweeps a finalized epoch's unclaimable verification budget; anyone may send it. */
|
|
250
|
-
async settleEpochRemainder(signer, epoch) {
|
|
251
|
-
const writer = new ResultsWriter(this._config, await this.resultsAddress()).withProvider(this._provider);
|
|
252
|
-
return writer.settleEpochRemainder(signer, BigInt(epoch));
|
|
253
|
-
}
|
|
254
254
|
/** The emissions gate the results contract pinned at deployment; `expectedEpoch` is checked against it. */
|
|
255
255
|
async emissionsGate() {
|
|
256
256
|
return getAddress(String(await (await this._results()).getFunction('emissionsGate')()));
|
|
257
257
|
}
|
|
258
|
+
/** Epochs a KBF verdict counts for (KBF contract), including the one it was given in. */
|
|
258
259
|
async validityEpochs() {
|
|
259
|
-
return Number(await
|
|
260
|
+
return Number(await this._contract().getFunction('validityEpochs')());
|
|
260
261
|
}
|
|
261
262
|
/** The current epoch exactly as `submitModelAudit` checks it. */
|
|
262
263
|
async currentEpochWindow() {
|
|
@@ -272,7 +273,7 @@ export class VerifierClient extends BaseEvmClient {
|
|
|
272
273
|
async isVerified(agentId) {
|
|
273
274
|
return Boolean(await (await this._results()).getFunction('isVerified')(BigInt(agentId)));
|
|
274
275
|
}
|
|
275
|
-
/** SAME and DIFF services whose verdicts
|
|
276
|
+
/** SAME and DIFF services whose verdicts still count (`currentEpoch < validUntilEpoch`). */
|
|
276
277
|
async agentStatus(agentId) {
|
|
277
278
|
const status = await (await this._results()).getFunction('agentStatus')(BigInt(agentId));
|
|
278
279
|
return {
|
|
@@ -290,19 +291,17 @@ export class VerifierClient extends BaseEvmClient {
|
|
|
290
291
|
verdict: Number(status.verdict ?? status[1]),
|
|
291
292
|
updatedAt: BigInt(status.updatedAt ?? status[2]),
|
|
292
293
|
epoch: BigInt(status.epoch ?? status[3]),
|
|
293
|
-
|
|
294
|
+
audit: getAddress(String(status.audit ?? status[4])),
|
|
295
|
+
validUntilEpoch: BigInt(status.validUntilEpoch ?? status[5]),
|
|
294
296
|
};
|
|
295
297
|
}
|
|
296
298
|
/** Whether `auditor` is approved on the KBF contract. */
|
|
297
299
|
async approvedAuditor(auditor) {
|
|
298
300
|
return Boolean(await this._contract().getFunction('approvedAuditors')(getAddress(auditor)));
|
|
299
301
|
}
|
|
300
|
-
|
|
301
|
-
return getAddress(String(await (await this._results()).getFunction('registry')()));
|
|
302
|
-
}
|
|
302
|
+
/** The identity registry the KBF contract resolves agent owners with. */
|
|
303
303
|
async identityRegistry() {
|
|
304
|
-
|
|
305
|
-
return getAddress(String(await registry.getFunction('identityRegistry')()));
|
|
304
|
+
return getAddress(String(await this._contract().getFunction('identityRegistry')()));
|
|
306
305
|
}
|
|
307
306
|
async agentOwner(agentId) {
|
|
308
307
|
const identityRegistry = new Contract(await this.identityRegistry(), IDENTITY_REGISTRY_ABI, this._provider);
|
|
@@ -449,11 +448,8 @@ class ResultsWriter extends BaseEvmClient {
|
|
|
449
448
|
constructor(config, resultsAddress) {
|
|
450
449
|
super(config.rpcUrl, resultsAddress, config.fallbackRpcUrls, config.evmChainId);
|
|
451
450
|
}
|
|
452
|
-
|
|
453
|
-
return this._execWrite(signer, VERIFICATION_RESULTS_ABI, '
|
|
454
|
-
}
|
|
455
|
-
settleEpochRemainder(signer, epoch) {
|
|
456
|
-
return this._execWrite(signer, VERIFICATION_RESULTS_ABI, 'settleEpochRemainder', epoch);
|
|
451
|
+
claimAuditorReward(signer, audit, epoch) {
|
|
452
|
+
return this._execWrite(signer, VERIFICATION_RESULTS_ABI, 'claimAuditorReward', audit, epoch);
|
|
457
453
|
}
|
|
458
454
|
}
|
|
459
455
|
//# sourceMappingURL=verifier-client.js.map
|