Skip to content

Conversation

@GarmashAlex
Copy link

Removed unnecessary allocations and repeated ABI parsing in the hot path that processes deposit logs. Previously, UnpackDepositLogData converted the constant ABI string to a []byte, wrapped it in a bytes.Reader, and reparsed the ABI JSON on every call before unpacking into a []interface{}, incurring repeated allocations and type assertions. We now cache a parsed abi.ABI at package level using strings.NewReader and use UnpackIntoInterface to populate the generated DepositContractDepositEvent struct directly, eliminating the interface slice and assertions. The ABI is immutable and abi.ABI is safe for concurrent read-only reuse, so the cached instance is thread-safe. Behavior remains identical while reducing CPU and GC pressure during log processing.

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.

1 participant