Skip to content

Current census download logic is too dumb #286

@p4u

Description

@p4u

Retries should only happen when it makes sense. If the URI has an invalid or unsupported prefix for instance, it should just be discarded. The URI must be checked an sanitized.

The logic should detect the kind of error and perform one action or another depending on it (not just retry whatever the reason is).

It should not try to download "at start" every time. Improve the logic to decide when to try to download and when not to.

2025-12-22T10:50:27.943Z INF service/census_service.go:129 > starting census download origin=merkle_tree_offchain_dynamic_v1 root=0x1a61be898c1e82713053877208fdcf82790f2db0163b93b60411df0fd6a0f234 uri=ipfs://census-1766398420483-v2
2025-12-22T10:50:27.943Z WRN service/census_service.go:140 > census import attempt failed error="failed to import census from JSON dump: failed to download JSON dump from ipfs://census-1766398420483-v2: failed to download JSON dump from ipfs://census-1766398420483-v2: Get \"ipfs://census-1766398420483-v2\": unsupported protocol scheme \"ipfs\"" attempt=1 origin=merkle_tree_offchain_dynamic_v1 root=0x1a61be898c1e82713053877208fdcf82790f2db0163b93b60411df0fd6a0f234 uri=ipfs://census-1766398420483-v2
2025-12-22T10:50:27.943Z WRN service/census_service.go:140 > census import attempt failed error="failed to import census from JSON dump: failed to download JSON dump from ipfs://census-1766398420483-v2: failed to download JSON dump from ipfs://census-1766398420483-v2: Get \"ipfs://census-1766398420483-v2\": unsupported protocol scheme \"ipfs\"" attempt=2 origin=merkle_tree_offchain_dynamic_v1 root=0x1a61be898c1e82713053877208fdcf82790f2db0163b93b60411df0fd6a0f234 uri=ipfs://census-1766398420483-v2
2025-12-22T10:50:27.943Z WRN service/census_service.go:140 > census import attempt failed error="failed to import census from JSON dump: failed to download JSON dump from ipfs://census-1766398420483-v2: failed to download JSON dump from ipfs://census-1766398420483-v2: Get \"ipfs://census-1766398420483-v2\": unsupported protocol scheme \"ipfs\"" attempt=3 origin=merkle_tree_offchain_dynamic_v1 root=0x1a61be898c1e82713053877208fdcf82790f2db0163b93b60411df0fd6a0f234 uri=ipfs://census-1766398420483-v2
2025-12-22T10:50:27.943Z WRN service/census_service.go:140 > census import attempt failed error="failed to import census from JSON dump: failed to download JSON dump from ipfs://census-1766398420483-v2: failed to download JSON dump from ipfs://census-1766398420483-v2: Get \"ipfs://census-1766398420483-v2\": unsupported protocol scheme \"ipfs\"" attempt=4 origin=merkle_tree_offchain_dynamic_v1 root=0x1a61be898c1e82713053877208fdcf82790f2db0163b93b60411df0fd6a0f234 uri=ipfs://census-1766398420483-v2
2025-12-22T10:50:27.943Z WRN service/census_service.go:140 > census import attempt failed error="failed to import census from JSON dump: failed to download JSON dump from ipfs://census-1766398420483-v2: failed to download JSON dump from ipfs://census-1766398420483-v2: Get \"ipfs://census-1766398420483-v2\": unsupported protocol scheme \"ipfs\"" attempt=5 origin=merkle_tree_offchain_dynamic_v1 root=0x1a61be898c1e82713053877208fdcf82790f2db0163b93b60411df0fd6a0f234 uri=ipfs://census-1766398420483-v2
2025-12-22T10:50:27.943Z WRN service/census_service.go:140 > census import attempt failed error="failed to import census from JSON dump: failed to download JSON dump from ipfs://census-1766398420483-v2: failed to download JSON dump from ipfs://census-1766398420483-v2: Get \"ipfs://census-1766398420483-v2\": unsupported protocol scheme \"ipfs\"" attempt=6 origin=merkle_tree_offchain_dynamic_v1 root=0x1a61be898c1e82713053877208fdcf82790f2db0163b93b60411df0fd6a0f234 uri=ipfs://census-1766398420483-v2
``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions