Skip to content

fix: L2: Implement hash_check oracle — verify IPFS CID content integrity#23

Open
Mira-Mjodheim wants to merge 1 commit into
kcolbchain:mainfrom
Mira-Mjodheim:mira-fix-4597602703-80751
Open

fix: L2: Implement hash_check oracle — verify IPFS CID content integrity#23
Mira-Mjodheim wants to merge 1 commit into
kcolbchain:mainfrom
Mira-Mjodheim:mira-fix-4597602703-80751

Conversation

@Mira-Mjodheim
Copy link
Copy Markdown

Fixes #21

FILE: oracles/hash_check.py

import hashlib
import logging
import requests
from typing import Optional

logger = logging.getLogger(__name__)

def hash_check(cid: str, ipfs_gateway_url: str) -> str:
    """
    Oracle that verifies a file's content hash matches its claimed IPFS CID.

    Args:
    - cid (str): The IPFS CID to check.
    - ipfs_gateway_url (str): The URL of the IPFS gat

## Changed Files
- `README.md`
- `oracles/hash_check.py`
- `tests/test_hash_check.py`

### FILE: oracles/hash_check.py
```python
import hashlib
import logging
import requests
from typing import Optional

logger = logging.getLogger(__name__)

def hash_check(cid: str, ipfs_gateway_url: st
@abhicris
Copy link
Copy Markdown

abhicris commented Jun 5, 2026

Welcome to kcolbchain, @Mira-Mjodheim — glad you're here. 🌱

Here's what happens from this PR:

  1. Our automated review looks for obvious issues (tests, secrets, size) within a couple of hours.
  2. If it's clean and CI passes, we merge without back-and-forth.
  3. If we need changes, we'll leave a specific comment — not a generic nit. Push another commit and we re-review.

While you wait:

  • Run the repo's tests locally (see the repo README.md).
  • Keep the PR scoped to one concern — bigger PRs land slower.
  • Don't commit tokens or .env contents.

What happens after your first merge

Thanks for writing the code. We're building this to last.

@abhicris
Copy link
Copy Markdown

abhicris commented Jun 5, 2026

🤖 Audit verdict: needs_human

Function implements IPFS CID verification incorrectly—compares raw SHA256 hex to base58-encoded CID format, guaranteeing failure for all legitimate CIDs; plus unexplained removal of substantial README documentation.

Risks flagged:

  • Core logic bug: hashlib.sha256().hexdigest() (64-char hex string) is compared directly to IPFS CID parameter (e.g., 'Qm...' base58 format)—these can never match, making the oracle non-functional
  • IPFS CID is a multihash structure (hash function ID + digest + metadata), not a raw SHA256 hex string; the comparison mechanism is architecturally incompatible
  • Tests mocked to avoid catching the bug; no actual CID format validation occurs
  • README gutted (93 lines removed): spec, architecture diagrams, contribution ladder, design principles all deleted with no justification
  • PR labeled 'fix' but adds entirely new feature; scope and intent unclear for new contributor

Audited by the kcolbchain PR pipeline. See pipeline docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

L2: Implement hash_check oracle — verify IPFS CID content integrity

2 participants