You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using sol! macro to generate enum to use it for eip712 signing but when see the hash struct it is wrong. After investigate, I found that the as_u8 is wrong as i tested on rust playground
#[derive(Clone, Copy)]
#[repr(u8)]
enum Color {
Red = 0,
Green = 1,
Blue = 2,
}
impl Color {
fn as_u8(&self) -> &u8 {
unsafe { &*::core::ptr::addr_of!(self).cast::<u8>() }
}
}
fn main() {
let color = Color::Red;
let u8_value = color.as_u8();
println!("The u8 value of the color is: {}", u8_value);
}
For this code it will print something like "The u8 value of the color is: 159"
The text was updated successfully, but these errors were encountered:
Component
sol-types, sol! macro
What version of Alloy are you on?
0.4.2
Operating System
macOS (Apple Silicon)
Describe the bug
I am using sol! macro to generate enum to use it for eip712 signing but when see the hash struct it is wrong. After investigate, I found that the as_u8 is wrong as i tested on rust playground
For this code it will print something like "The u8 value of the color is: 159"
The text was updated successfully, but these errors were encountered: