Skip to content

AgentKeys live ABI acceptance gaps: op_kind filter, root path, and envelope proof #42

@YoshiyukiSakura

Description

@YoshiyukiSakura

Context

Follow-up for #12 and merged PR #13.

#12 now uses the Heima mainnet CredentialAudit ABI that is actually deployed and emitting today as the acceptance target:

  • Contract: 0x63c4545ac01c77cc74044f25b8edea3880224577
  • Chain ID: 212013
  • Live event path: AuditAppended(bytes32,bytes32,bytes32,uint8,uint256,bytes32)
  • Production API host used for verification: https://explorer-api.heima.network

PR #13 merged useful base support for live AuditAppended rows, but production validation still shows acceptance gaps. This issue tracks the remaining work needed to close the live-ABI AgentKeys audit path end to end.

Production validation snapshot

Verified on 2026-05-26 against production:

  • GET https://explorer-api.heima.network/agentkeys/audit/<operator>?limit=50 returns 200 with live AuditAppended rows.
  • Returned rows are current live ABI rows with event_name="AuditAppended" and op_kind=0.
  • Returned rows currently have envelope_available=false, hash_verified=false, and envelope_fetch_error="agentkeys audit envelope not found".
  • GET https://explorer-api.heima.network/agentkeys/audit/<operator>?limit=5&op_kind=0 returns 200 but events=[], even though unfiltered rows have op_kind=0.
  • GET https://explorer-api.heima.network/agentkeys/audit/root/0x32301a0bd7c9c1d064f0d3891c78ad00a6d9fa758ebb14a1a0ff64eb4f4ca3aa returns 404 {"error":"not_found"}.
  • GET https://audit.litentry.org/v1/audit/envelope/<live_hash> returns HTTP 404 for sampled live hashes.
  • Heima RPC over the captured range has 13 current AuditAppended(...) logs and 0 AuditAppendedV2 / AuditRootAppendedV2 logs.

Sample operator:

0x941cb1c3260518bbf40eac7d02663517fc7cff304d9b03e80d2cc54126c6bef2

Sample actor:

0x82a0609ae28527453e7c7654ec11d57f1b66a442e39a2ec5e3b3f76178c87268

Sample live hashes returning worker 404:

  • 0xdb927ad4467c02867819a1379c7c0b9a35103452c789badeae6e531b5d2f8e1c
  • 0x3d67f9734a38829d9e2289cd9551caa7f50ba66bd521981fb8504be4ab23a223

Required fixes

  • Fix op_kind filtering for the current live ABI. ?op_kind=0 must return the same CredStore rows that appear in the unfiltered live-ABI response.
  • Implement the current deployed root/batch event path for /agentkeys/audit/root/<merkle_root>. The handler must not be V2-topic-only when live acceptance is based on the deployed current ABI.
  • Keep the chain-only row behavior for worker 404s, but make the response explicit and stable: envelope_available=false, hash_verified=false, raw chain identity, op_kind, sequence/index key, block/log/tx fields.
  • If the worker later serves a live hash, verify keccak256(canonical_cbor_bytes) == envelope_hash and return envelope_available=true, hash_verified=true, and typed body fields.
  • Add production-oriented regression coverage for current AuditAppended(...) logs, including op_kind filtering, pagination/cursor behavior, and chain-only worker-404 rows.
  • Add regression coverage for the current root/batch path once the deployed event shape is implemented.

Acceptance checklist

  • GET /agentkeys/audit/<operator_omni>?limit=50 returns non-empty live AuditAppended rows on production.
  • GET /agentkeys/audit/<operator_omni>?op_kind=0&limit=5 returns non-empty rows matching op_kind=0.
  • GET /agentkeys/audit/<operator_omni>?actor_omni=<actor>&limit=5 returns matching actor-filtered rows.
  • GET /agentkeys/audit/root/<known_root> returns root metadata and associated row/leaf data for the current deployed root/batch path.
  • GET /agentkeys/audit/envelope/<live_hash> returns either canonical CBOR with verified hash, or a documented 404 response while the row API still preserves the chain-only event.
  • Production verification evidence is posted with exact curl/API results for rows, op_kind filter, root path, and envelope path.
  • PR evidence clearly separates live production proof from fixture-only or hand-crafted proof.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions