Clarinet Console invalid signature error when using traits
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.
Hi @SaadTahir7, thank you for raising this obscure error. Moving this issue to the REPL repo.
This is related to hirosystems/clarinet#457.