Skip to content

fix: Validate Log topics are 32-byte hex strings#168

Closed
roninjin10 wants to merge 1 commit intomainfrom
fix/issue-91-log-topic-validation
Closed

fix: Validate Log topics are 32-byte hex strings#168
roninjin10 wants to merge 1 commit intomainfrom
fix/issue-91-log-topic-validation

Conversation

@roninjin10
Copy link
Contributor

Summary

Test plan

  • Added tests for valid 32-byte Uint8Array topics
  • Added tests for valid 64-character hex string topics
  • Added tests for hex strings without 0x prefix
  • Added tests for topics that are too short (hex string)
  • Added tests for topics that are too long (hex string)
  • Added tests for topics that are too short (Uint8Array)
  • Added tests for topics that are too long (Uint8Array)
  • Added tests for invalid hex characters
  • Added tests for non-string/non-Uint8Array topics
  • Added tests for null topics
  • Added tests verifying all topics in array are validated
  • Added tests verifying topic index is included in error message
  • Ran Log tests - all 73 pass

🤖 Generated with Claude Code

Fixes #91. Log.from() now validates that each topic is either:
- A Uint8Array of exactly 32 bytes
- A valid 64-character hex string (with optional 0x prefix)

Throws InvalidLengthError for wrong length topics and
InvalidFormatError for invalid hex or type.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dist Error Error Jan 2, 2026 10:42am
voltaire Error Error Jan 2, 2026 10:42am

Copy link
Contributor Author

@roninjin10 roninjin10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review summary for PR #168 — fix: Validate Log topics are 32-byte hex strings\n\nTouched areas: EventLog | Files changed: 2 (+243/-1)\n\n- Tests: yes\n- Types & API: yes\n- Docs: ensure behavior is documented where user-facing.\n- Performance: consider micro-allocations in tight loops.\n\nOutcome: Comment-only review; no blocking issues spotted. Please consider the above suggestions.\n

@roninjin10
Copy link
Contributor Author

Duplicate of merged PR #277 (EventLog topic validation)

@roninjin10 roninjin10 closed this Jan 4, 2026
@roninjin10 roninjin10 deleted the fix/issue-91-log-topic-validation branch January 4, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Log.from() doesn't validate topic format

1 participant