Skip to content

/v2/contracts/{chainId} endpoint hangs beyond certain matchId #2111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
marcocastignoli opened this issue Apr 24, 2025 · 0 comments
Open

/v2/contracts/{chainId} endpoint hangs beyond certain matchId #2111

marcocastignoli opened this issue Apr 24, 2025 · 0 comments

Comments

@marcocastignoli
Copy link
Member

A user in our public chat reported an issue where the /v2/contracts/{chainId} endpoint hangs after reaching a certain matchId.

I investigated and found that running the query below takes a long time, but if you set LIMIT 1, it returns quickly. This slowdown happens because there’s a large gap of non-137 chain contracts before matchId 4403388, causing a delay before returning results.

SELECT
      sourcify_matches.id, sourcify_matches.creation_match, sourcify_matches.runtime_match, nullif(concat('0x', encode(contract_deployments.address, 'hex')), '0x') as address, to_char(sourcify_matches.created_at, 'YYYY-MM-DD"T"HH24:MI:SS"Z"') as verified_at
    FROM public.sourcify_matches
    JOIN public.verified_contracts ON verified_contracts.id = sourcify_matches.verified_contract_id
    JOIN public.contract_deployments ON 
        contract_deployments.id = verified_contracts.deployment_id
    WHERE sourcify_matches.id < 4403388 and contract_deployments.chain_id = 137
    ORDER BY sourcify_matches.id DESC
    LIMIT 2;

The user later identified the exact gap:

seems like the issue is fixed now. 
After '1152336', it jumped to '4403507' (quite a big jump), but its working now.⁦

@marcocastignoli marcocastignoli moved this from Triage to Backlog in Sourcify Public Apr 24, 2025
@kuzdogan kuzdogan moved this from Backlog to Sprint - Candidates in Sourcify Public Apr 28, 2025
@manuelwedler manuelwedler moved this from Sprint - Candidates to Backlog in Sourcify Public May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants