Skip to content

[Bug] Fail to serialize custom structs with i128 when using TypedData::from_struct #625

Closed as not planned
@JNP777

Description

@JNP777

Component

primitives

What version of Alloy are you on?

alloy-core 0.7.2

Operating System

Linux

Describe the bug

Having this custom sol struct with i128 numbers, i find that snippet 1 works and it results in a correct hash, but snippet 2 doesnt, showing a "number out of range" error. i think this is cause snippet2 function will use serde::json serialization while first 1 wont

struct Order {
    bytes32 sender;  
    int128 priceX18;  
    int128 amount;
    uint64 expiration;
    uint64 nonce;                
}

Snippet 1

    let sig: FixedBytes<32> = msg.eip712_signing_hash(&(domain.clone()));
    info!("sig 1 {:?}", sig);

Snippet 2

    info!("st {:?} {:?}", TypedData::from_struct(&msg, Some(domain)).eip712_signing_hash(), sig);
    info!("sig 2 {:?}", sig);   

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions