Skip to content

Normalize relay URIs before allowlist matching#132

Draft
Copilot wants to merge 1 commit intomateu/normalize-relays-URIsfrom
copilot/sub-pr-131
Draft

Normalize relay URIs before allowlist matching#132
Copilot wants to merge 1 commit intomateu/normalize-relays-URIsfrom
copilot/sub-pr-131

Conversation

Copy link

Copilot AI commented Mar 5, 2026

Lido allowlisted relay URIs may include trailing /, while relays observed from clients may not. This mismatch can incorrectly classify valid relays as blacklisted and undercount mandatory relay usage.

  • What changed

    • Added URI normalization in relay comparison flow to strip trailing slashes before matching.
    • Applied normalization consistently to both:
      • allowlisted relays from the contract
      • relays reported as used by the node
  • Behavioral impact

    • Equivalent relay URIs now match regardless of trailing /.
    • Blacklist detection and mandatory-relay counting are based on canonicalized URI values, reducing false negatives/positives from formatting differences.
  • Test coverage updates

    • Added focused normalization test cases (single and repeated trailing slashes).
    • Updated relay analysis tests to cover mixed normalized/non-normalized URI inputs.
func normalizeRelayURI(uri string) string {
    return strings.TrimRight(uri, "/")
}

// comparison path
allowedMap[normalizeRelayURI(relay.Uri)] = relay
normalizedUsed := normalizeRelayURI(used)

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Mar 5, 2026
Copilot AI changed the title [WIP] Normalize relays URIs to remove trailing slashes Normalize relay URIs before allowlist matching Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants