argotorg / argotorg/sourcify

Contracts with onchain creation code but no creation transaction hash in the database

Open
#2,298 2 comments 0 reactions 0 assignees View on GitHub
🪲 bug
Dominant language
TypeScript
Stars
949
Forks
542
Avg merge
2d 19h
Merged PRs (30d)
18

Description

While fixing #2208, I encountered contracts that don't have a creation transaction hash in the database but do have a `contracts.creation_code_hash` set.

```
SELECT
count(*)
FROM verified_contracts vc
JOIN contract_deployments cd ON vc.deployment_id = cd.id
JOIN contracts c ON cd.contract_id = c.id
JOIN code creation_code ON c.creation_code_hash = creation_code.code_hash
JOIN compiled_contracts cc ON vc.compilation_id = cc.id
JOIN code recompiled_creation_code ON cc.creation_code_hash = recompiled_creation_code.code_hash
INNER JOIN sourcify_matches sm ON sm.verified_contract_id = vc.id
WHERE cd.transaction_hash is null and c.creation_code_hash is not null;
```
-> 653,549 contracts

Out of these, 653,528 contracts have `vc.creation_match = true`.

We should check why we don't store the creation tx hash for these contracts.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the supplied SQL query and trace how contract_deployments.transaction_hash and contracts.creation_code_hash are populated for verified contracts. Compare the 653,549 affected records with the creation_match path and identify why creation transaction hashes are absent. Done means the cause is documented and the required data or code correction is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
blockchain, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.