Feature Requests

Feature requests related to Blockscout - open source block explorer. If you face any issues with your txs, contact the chain team directly.
add ETH Swarm support for token metadata
PR: https://github.com/blockscout/blockscout/pull/14290 ## Summary Adds first-class support for ETH Swarm hashes in the token metadata pipeline, mirroring the existing Arweave integration. The implementation works with any content stored on Swarm , not just /bzz uploads — because the entry point is the 64-character keccak-256 hash (content address), which is shared by: /bzz/<hash> — regular chunk uploads SOC (Single Owner Chunks) references Feed manifests (which resolve to a content-address under the hood) A 200 response from the Swarm gateway is therefore sufficient proof that the content exists, regardless of how it was originally uploaded. --- ## Changes ### apps/explorer/lib/explorer/token/metadata_retriever.ex | Addition | Purpose | |---|---| | @invalid_swarm_path | Error constant (mirrors @invalid_ipfs_path ) | | swarm_link/1 | Builds <gateway>/bzz/<hash>/ ; defaults to https://gateway.ethswarm.org ; overridable via config :indexer, :swarm, gateway_url: | | swarm_headers/0 | Returns Authorization: Bearer <token> when config :indexer, :swarm, bearer_token: is set — supports private / paid gateway nodes | | valid_swarm_hash?/1 | Validates 64-char lowercase hex Swarm hash | | bzz:// clause in fetch_from_ipfs_or_ar?/5 | Routes bzz://<hash>[/path] URIs | | /bzz/<hash> clause in fetch_from_ipfs_or_ar?/5 | Routes plain HTTPS Swarm gateway URLs | | fetch_from_swarm/2 + fetch_from_swarm_if_valid_hash/2 | Fetcher (mirrors fetch_from_arweave/2 ) | | swarm?/1 predicate | Threaded through host-filtering bypass, header selection, and process_result/3 | ### apps/explorer/test/explorer/token/metadata_retriever_test.exs New describe blocks: swarm_link/1 — default gateway, custom gateway, trailing-slash stripping swarm_headers/0 — no token, bearer token configured valid_swarm_hash?/1 — valid, embedded path, uppercase, too short/long, empty, non-binary ETH Swarm URI routing — bzz:// scheme, plain HTTPS /bzz/ , invalid hash error --- ## Configuration (optional) ```elixir config/runtime.exs (or config.exs) config :indexer, :swarm, gateway_url: System.get_env("INDEXER_SWARM_GATEWAY_URL", " https://gateway.ethswarm.org "), bearer_token: System.get_env("INDEXER_SWARM_GATEWAY_BEARER_TOKEN") ``` Both keys are optional — the module works with zero configuration using the public Swarm gateway. --- ## Related Closes #<issue> (if any) Follows the same pattern as the Arweave integration introduced in this commit . <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * New Features * Added Swarm network support for token metadata retrieval * Support for bzz:// URI scheme and HTTP gateway-style paths * Automatic metadata validation and fetching from Swarm storage * Tests * Added comprehensive test coverage for Swarm metadata retrieval and URL handling <!-- end of auto-generated comment: release notes by coderabbit.ai -->
0
Docker container running as non-root
I am trying to run the blockscout-stack in Kubernetes. For security reasons, I am providing it a specific uid/gid (non-root user/group) but the 'blockscout' pod (backend?) is logging these errors: {"time":"2024-05-13T14:52:25.694Z","severity":"error","message":"GenServer :tzdata_release_updater terminating\n** (File.Error) could not write to file \"/app/lib/tzdata-1.1.1/priv/latest_remote_poll.txt\": permission denied\n (elixir 1.14.5) lib/file.ex:1104: File.write!/3\n (tzdata 1.1.1) lib/tzdata/data_loader.ex:43: Tzdata.DataLoader.last_modified_of_latest_available/1\n (tzdata 1.1.1) lib/tzdata/release_updater.ex:81: Tzdata.ReleaseUpdater.loaded_tzdata_matches_remote_last_modified?/0\n (tzdata 1.1.1) lib/tzdata/release_updater.ex:42: Tzdata.ReleaseUpdater.poll_for_update/0\n (tzdata 1.1.1) lib/tzdata/release_updater.ex:19: Tzdata.ReleaseUpdater.handle_info/2\n (stdlib 3.17) gen_server.erl:695: :gen_server.try_dispatch/4\n (stdlib 3.17) gen_server.erl:771: :gen_server.handle_msg/6\n (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3\nLast message: :check_if_time_to_update\nState: []","metadata":{"error":{"initial_call":null,"reason":"** (File.Error) could not write to file \"/app/lib/tzdata-1.1.1/priv/latest_remote_poll.txt\": permission denied\n (elixir 1.14.5) lib/file.ex:1104: File.write!/3\n (tzdata 1.1.1) lib/tzdata/data_loader.ex:43: Tzdata.DataLoader.last_modified_of_latest_available/1\n (tzdata 1.1.1) lib/tzdata/release_updater.ex:81: Tzdata.ReleaseUpdater.loaded_tzdata_matches_remote_last_modified?/0\n (tzdata 1.1.1) lib/tzdata/release_updater.ex:42: Tzdata.ReleaseUpdater.poll_for_update/0\n (tzdata 1.1.1) lib/tzdata/release_updater.ex:19: Tzdata.ReleaseUpdater.handle_info/2\n (stdlib 3.17) gen_server.erl:695: :gen_server.try_dispatch/4\n (stdlib 3.17) gen_server.erl:771: :gen_server.handle_msg/6\n (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3\n"}}} I'd like to update the Dockerfile to create a user and group with a specific UID/GID (maybe as args?) and modify the /app directory to be owned by this user/group. Would you be open to such a change? I believe it's generally a best practice to run containers as non-root. If so, I'll create a PR. If there's a concern for compatibility, I could create a separate nonroot.Dockerfile (for example) but your CI/CD would need to build/publish that with the current Dockerfile -- perhaps with a nonroot tag. I haven't looked at your CI/CD but I'm happy to take that on too if you'd like.
1
Load More