clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Clarinet Console invalid signature error when using traits

Open SaadTahir7 opened this issue 4 years ago • 2 comments

I ran into a problem where clarinet console didn't helped out much in explaining where the error was. I had a function in trait

(set-user-info (uint {name: (string-ascii 20), age: uint}) (response uint uint))

where the function return is expecting a response (uint uint). I used this triat in my contract and wrote a function called

(define-public (set-user-info (user-id uint) (new-user-info {name: (string-ascii 20), age: uint}))

So the clarinet check gave me an error

Error: Analysis error: invalid signature for method 'set-user-info' regarding trait's specification <data-trait>

The error is not well explained since it is not stating where the error is. I thought the error was in my parameters and kept on changing them. Finally I was able to understand that my function was returning response bool uint instead of response uint uint. So the problem was in my trait function signature.

It would be better for clarinet check to give me some more information where the problem is and in which contract it is.

SaadTahir7 avatar Aug 03 '21 10:08 SaadTahir7

Hi @SaadTahir7, thank you for raising this obscure error. Moving this issue to the REPL repo.

lgalabru avatar Aug 16 '21 10:08 lgalabru

This is related to hirosystems/clarinet#457.

obycode avatar May 04 '22 13:05 obycode