Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] sol! macro event signature mismatch #640

Closed
barraguda opened this issue Jun 4, 2024 · 0 comments · Fixed by #642
Closed

[Bug] sol! macro event signature mismatch #640

barraguda opened this issue Jun 4, 2024 · 0 comments · Fixed by #642
Labels
bug Something isn't working

Comments

@barraguda
Copy link

Component

sol! macro

What version of Alloy are you on?

├── alloy-primitives v0.7.4 │ ├── alloy-rlp v0.3.5 │ │ ├── alloy-rlp-derive v0.3.5 (proc-macro) │ │ ├── alloy-rlp v0.3.5 () ├── alloy-sol-types v0.7.4 │ ├── alloy-primitives v0.7.4 () │ ├── alloy-sol-macro v0.7.4 (proc-macro) │ │ ├── alloy-sol-macro-expander v0.7.4 │ │ │ ├── alloy-sol-macro-input v0.7.4 │ │ ├── alloy-sol-macro-input v0.7.4 () │ ├── alloy-json-rpc v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) │ │ ├── alloy-primitives v0.7.4 () │ ├── alloy-primitives v0.7.4 () │ ├── alloy-rpc-types v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) │ │ ├── alloy-consensus v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) │ │ │ ├── alloy-eips v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) │ │ │ │ ├── alloy-primitives v0.7.4 () │ │ │ │ ├── alloy-rlp v0.3.5 () │ │ │ │ ├── alloy-serde v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) │ │ │ │ │ ├── alloy-primitives v0.7.4 () │ │ │ ├── alloy-primitives v0.7.4 () │ │ │ ├── alloy-rlp v0.3.5 () │ │ │ ├── alloy-serde v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) () │ │ ├── alloy-eips v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) () │ │ ├── alloy-genesis v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) │ │ │ ├── alloy-primitives v0.7.4 () │ │ │ ├── alloy-serde v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) () │ │ ├── alloy-primitives v0.7.4 () │ │ ├── alloy-rlp v0.3.5 () │ │ ├── alloy-serde v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) () │ │ ├── alloy-sol-types v0.7.4 () │ ├── alloy-transport v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) │ │ ├── alloy-json-rpc v0.1.0 (https://github.com/alloy-rs/alloy.git?rev=cad7935#cad7935d) (*)

Operating System

macOS (Apple Silicon)

Describe the bug

I'm trying to use the sol! macro to get signature hashes for events, but it seems having the same name for 2 different events messes with the hashes of both:

sol! {
    event TestEvent(bytes32 indexed one);
    event TestEvent(bytes32 indexed one, bytes32 indexed two);
}

main() {
    println!("test1: {:?}", TestEvent_0::SIGNATURE_HASH);
    println!("test2: {:?}", TestEvent_0::SIGNATURE_HASH);
}

this leads to
0x4126a29fd17029d376521f62e26c90187da40445c02353770fc7f104fdcf4aad
and
0x5605e19697b8c6a8f1030e73a4c1ee8f95910ba367148f89949f77cb79d3d5ce

whereas removing the second TestEvent and taking the first's signature yields the correct one: 0x2d87364d1542bf89b684ede9ddff45aed45971c6f05deaca687bd3d1b6caf1c3

@barraguda barraguda added the bug Something isn't working label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant