Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

b.callSignature not compatible with trufflib/Sig.col:recover when using addresses #12

Description

@SeekTheError

If an address is used as part of the signature like so( invoice.buyer is an address):

let sig = b.callSignature('createInvoice', invoice.buyer ,invoice.ref, invoice.amount, invoice.infos)

It won't recover the correct address on the contract side(using trufflib):

    Sig.t memory sig;
    sig.param("createInvoice");
    sig.param(_buyer);
    sig.param_string(_ref);
    sig.param(_amount);
    sig.param_string(_info);

    bool success;
    address supplier_address;
    (success, supplier_address) = sig.recover(_remote_sig);

To fix it you need to slice the 0x part of the address like so:

let sig = b.callSignature('createInvoice', invoice.buyer.slice(2) ,invoice.ref, invoice.amount, invoice.infos)

Is it the normal behavior or should b-privacy detect that the param is an address and strip the "0x" part?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions