Skip to content

perf(sol-types): avoid allocating event signature errors - #1109

Merged
DaniPopes merged 3 commits into
mainfrom
mattsse/invalid-event-signature-error
May 23, 2026
Merged

DaniPopes merged 3 commits into
mainfrom
mattsse/invalid-event-signature-error

Conversation

@mattsse

@mattsse mattsse commented May 23, 2026

Copy link
Copy Markdown
Member

Summary

Adds a dedicated Error::InvalidEventSignatureHash variant that stores the event signature name plus the received and expected hashes directly.

Why

Error::invalid_event_signature_hash previously built an owned formatted string immediately, forcing an allocation even when callers only propagate the error. The new variant keeps construction allocation-free and defers formatting to Display.

Impact

Event signature validation errors now retain structured mismatch data and preserve the existing display message without allocating during error construction.

Comment thread crates/sol-types/src/errors.rs Outdated
}

#[cfg(test)]
mod tests {

@DaniPopes DaniPopes May 23, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we dont need a slop test for this please

@github-project-automation github-project-automation Bot moved this to Reviewed in Alloy May 23, 2026
@DaniPopes
DaniPopes enabled auto-merge (squash) May 23, 2026 14:28
@DaniPopes
DaniPopes merged commit 7753b0c into main May 23, 2026
31 checks passed
@DaniPopes
DaniPopes deleted the mattsse/invalid-event-signature-error branch May 23, 2026 14:34
@github-project-automation github-project-automation Bot moved this from Reviewed to Done in Alloy May 23, 2026
Thegreatsura pushed a commit to Thegreatsura/tempo that referenced this pull request May 24, 2026
Dispatches `TempoPoolUpdates` log parsing on `topic0` with small local
event enums before decoding generated event structs. This avoids the
allocating invalid-signature error path for unrelated logs while
preserving the same update extraction behavior.

The previous implementation would always end up allocating an error on
mismatch
alloy-rs/core#1109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants