Skip to content

Blockscout project:/ source-path prefix breaks GitHub source lookup #179

Description

@tamtamchik

When sources are fetched from a Blockscout explorer, multi-file verified contracts return source paths prefixed with project:/ (Blockscout's marker for the contract's own project sources). diffyscan passes these paths to the GitHub contents API unchanged, so the lookup 404s and verification aborts.

Repro

config.yaml:

contracts:
  "0x2b33CF282f867A7FF693A66e11B0FcC5552e4425": Kernel
explorer_hostname: eth.blockscout.com
explorer_chain_id: 1
github_repo:
  url: https://github.com/aragon/aragonOS
  commit: f3ae59b00f73984e562df00129c925339cd069ff
  relative_root: ""
diffyscan config.yaml

Set ETHERSCAN_EXPLORER_TOKEN to any value — Blockscout ignores it, but diffyscan still requires the env var to be present.

Actual

HTTP error: 404 Not Found for url:
https://api.github.com/repos/aragon/aragonOS/contents/project:/contracts/kernel/Kernel.sol?ref=f3ae59b00f73984e562df00129c925339cd069ff

Expected

Path resolved as contracts/kernel/Kernel.sol (prefix stripped).

Root cause

Blockscout returns file_path / additional_sources[].file_path as project:/<repo-relative-path>; diffyscan does not normalize this before the GitHub lookup. Etherscan returns the same sources as plain contracts/..., which works. Confirmed via the Blockscout API for 0x2b33CF28… (main project:/contracts/kernel/Kernel.sol, 26 additional sources, all project:/…).

Suggested fix

Strip a leading project:/ from Blockscout source paths before mapping to GitHub (and before applying relative_root).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions