Skip to content

Implement Soroban contract audit trail with query and export capabilities #516

Description

@Just-Bamford

Description

Problem

There is no standardized audit trail for contract invocation activity. Applications cannot easily reconstruct which account invoked a contract method, when the invocation occurred, which parameters were supplied, or whether the call succeeded.

This limits debugging, security investigations, and compliance workflows.

Solution

Create a structured contract audit subsystem that records invocation metadata without exposing sensitive values.

Audit entries should include caller identity, contract ID, function name, transaction ID, timestamp, execution status, duration, and sanitized argument metadata.

Provide filtering, pagination, and export capabilities.

Acceptance Criteria

  • Contract invocations generate structured audit records.
  • Records include caller, contract, function, transaction ID, timestamp, duration, and result status.
  • Sensitive arguments can be redacted or excluded.
  • queryContractAuditLog(filters) supports filtering.
  • Queries support pagination and chronological ordering.
  • Audit records can be exported as JSON and CSV.
  • Failed and successful invocations are distinguishable.
  • Tests cover logging, filtering, pagination, redaction, and export.
  • Exported through src/soroban/index.ts and src/index.ts.

Note for Contributors

Audit logging should not materially change contract invocation latency. Avoid logging private keys, secrets, or complete sensitive payloads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions