Skip to content

[PERF] Compress Multi-Parameter Event Payloads into Packed Topics #659

Description

@mijinummi

Labels: medium-difficulty, solidity, events, gasguard
Difficulty: Medium
Module: contracts/events/


🧠 Concept

Compress multiple discrete operational parameters into bit-packed bytes32 values before emitting event logs.

⚠️ Problem

Emitting events with many un-indexed data parameters increases calldata encoding gas and event logging costs ($375\text{ gas}$ per topic + $8\text{ gas}$ per byte of data).

📁 Implementation Scope

  • contracts/events/CompressedLogger.sol
  • test/events/CompressedLogger.test.ts

🛠️ Requirements

  1. Pack uint64 timestamp, uint32 categoryId, address user, and uint64 amount into a single 256-bit word.
  2. Emit custom single-topic log event containing packed word data.
  3. Provide off-chain TypeScript parsing utilities to unpack emitted logs.

🎯 Acceptance Criteria

  • Event emission gas drops by over 30% compared to uncompressed logging.
  • TypeScript helper correctly decodes all packed fields.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions