Skip to content
This repository has been 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

Open
SeekTheError opened this issue Apr 9, 2018 · 1 comment

Comments

@SeekTheError
Copy link

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?

@SeekTheError
Copy link
Author

SeekTheError commented Apr 9, 2018

Turned out I was mistaken, my issue is with the invoices.infos(an hex string) param. No idea why this would break the signature method for now.

@SeekTheError SeekTheError reopened this Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant