Skip to content

Parser skips fully qualified #[soroban_sdk::contracterror] #2

Description

@eleven-smg

The gap

src/parse.js matches the literal string #[contracterror]. A contract that writes the attribute in fully qualified form is silently skipped, so its codes never enter the registry and a collision with it is never reported.

#[soroban_sdk::contracterror]
#[repr(u32)]
pub enum RouterError {
    PairNotFound = 300,
}

This is the worst class of bug for this tool: a false negative in a check people gate merges on.

Where

  • const ATTRIBUTE = "#[contracterror]" in src/parse.js
  • the fast path if (!source.includes("#[contracterror]")) continue in bin/codepact.js must be relaxed at the same time, or the file is dropped before the parser ever sees it

Expected behaviour

Recognise #[contracterror] and any path-qualified form ending in contracterror, with arbitrary whitespace inside the brackets.

Definition of done

  • a parser test covering the qualified form and one covering #[ contracterror ]
  • the CLI fast path updated in the same PR
  • no change to the reported line numbers for the unqualified form

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions