stacks-network / stacks-network/stacks-core

[VM] Invalid trait implementation type-checking errors

Open
#6,348 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.1k
Forks
762
Avg merge
4d 6h
Merged PRs (30d)
76

Description

Context

The type signature errors for trait implementation are reported on line 0, character 0. This example outputs invalid signature for method 'transfer' regarding trait's specification <sip-010-trait>, instead of something like amount must be uint [...] at the right span.

(impl-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)

;; `amount` should be uint
(define-public (transfer
    (amount int)
    (sender principal)
    (recipient principal)
    (memo (optional (buff 34)))
  )
  (ok true)
)

;; rest of the contract

Expected behavior

The error should be reported on the function implementing the trait

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the trait implementation example and trace the VM's impl-trait type-checking entry point; done means the invalid amount type is reported on the implementing function at the correct span instead of line 0, character 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.