135 On-Chain Audit Log for Group Events#162
Open
Chigybillionz wants to merge 1 commit into
Open
Conversation
|
@Chigybillionz Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Collaborator
|
@Chigybillionz resolve all the merge conflicts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #135
Summary of the issue
Group creation and membership changes were not consistently recorded as immutable on-chain audit events. Existing Stellar integration anchored some group metadata, but there was no audit-event table, no event-to-transaction hash mapping, and no endpoint/UI for users or admins to inspect group history.
Root cause
The codebase lacked a reusable audit logging layer. Membership flows wrote only to Supabase (
room_members, removal votes), while group creation stored blockchain metadata directly on the room record. This left no normalized audit trail for group lifecycle events.Solution implemented
Implemented a Stellar-backed audit logging system for group events. Each audit event is persisted in Supabase, submitted to Stellar with a compact memo containing event metadata, then updated with the resulting transaction hash or failure state.
Key changes made
group_audit_eventsmigration with RLS, indexes, event status, metadata hash, Stellar memo, and transaction hash fields.recordGroupAuditEventhelper for DB-first audit recording and Stellar submission.GET /api/groups/[id]/auditwith pagination and filtering.DELETE /api/rooms/[roomId]/members.Trade-offs / considerations
failedstatus and an error message.Testing steps
scripts/012_group_audit_events.sql.member_joinedappears.DELETE /api/rooms/:roomId/membersand confirmmember_left.member_removed.Audit, and verify the audit trail renders with explorer links.npm run lint.