Skip to content

[CT-39] Wire event.rs into the crate as a real audit module #944

Description

@mftee

Overview

event.rs defines a fully-implemented Event struct (with new(), with_metadata(), to_json(), from_json()) and has its own passing unit tests — but lib.rs's module declarations (pub mod cache; pub mod config; pub mod hash_validator; pub mod metrics; pub mod rate_limit; pub mod stellar;) never include pub mod event;, so this file is not part of the compiled crate at all. It also references crate::error::Result and crate::error::AuditError, but no error.rs file exists anywhere in contract/src — so even if declared, it would not compile as-is.

Files

  • contract/src/lib.rs
  • contract/src/event.rs
  • contract/src/error.rs (new)

Acceptance Criteria

  • Create contract/src/error.rs defining AuditError (at minimum a SerializationError variant, matching event.rs's usage) and a crate-level Result<T> alias
  • Add pub mod error; and pub mod event; to lib.rs
  • Wire Event::new() into at least the verify/submit/revoke/transfer handlers to emit an audit event per request, persisted via the existing CacheBackend (or a dedicated append-only store)
  • cargo build and cargo test pass with event.rs included in the compiled crate
  • Add an admin-facing GET /audit endpoint to read back emitted events, or explicitly note it as a follow-up if out of scope for this issue

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