From f2d4fa6412decce8cccbb8386e18249b428f36cc Mon Sep 17 00:00:00 2001 From: Viktor Baranov Date: Wed, 13 Apr 2022 16:24:27 +0300 Subject: [PATCH] Ignore arbitrary block details fields for custom Ethereum clients --- CHANGELOG.md | 1 + .../lib/ethereum_jsonrpc/block.ex | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64c327ff14..6fd4549adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - [#5239](https://github.com/blockscout/blockscout/pull/5239) - Add accounting for block rewards in `getblockreward` api method ### Chore +- [#5456](https://github.com/blockscout/blockscout/pull/5456) - Ignore arbitrary block details fields for custom Ethereum clients - [#5450](https://github.com/blockscout/blockscout/pull/5450) - Logging error in publishing of smart-contract - [#5433](https://github.com/blockscout/blockscout/pull/5433) - Caching modules refactoring - [#5419](https://github.com/blockscout/blockscout/pull/5419) - Add check if address exists for some api methods diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex index f36c5cc742..7c4de364b9 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/block.ex @@ -585,13 +585,9 @@ defmodule EthereumJSONRPC.Block do # double check that no new keys are being missed by requiring explicit match for passthrough # `t:EthereumJSONRPC.address/0` and `t:EthereumJSONRPC.hash/0` pass through as `Explorer.Chain` can verify correct # hash format - # bitcoinMergedMiningCoinbaseTransaction bitcoinMergedMiningHeader bitcoinMergedMiningMerkleProof hashForMergedMining - RSK https://github.com/blockscout/blockscout/pull/2934 - # committedSeals committee pastCommittedSeals proposerSeal round - Autonity network https://github.com/blockscout/blockscout/pull/3480 - # blockGasCost extDataGasUsed - sgb/ava https://github.com/blockscout/blockscout/pull/5301 - # blockExtraData extDataHash - Avalanche https://github.com/blockscout/blockscout/pull/5348 defp entry_to_elixir({key, _} = entry) when key in ~w(author extraData hash logsBloom miner mixHash nonce parentHash receiptsRoot sealFields sha3Uncles - signature stateRoot step transactionsRoot uncles bitcoinMergedMiningCoinbaseTransaction bitcoinMergedMiningHeader bitcoinMergedMiningMerkleProof hashForMergedMining committedSeals committee pastCommittedSeals proposerSeal round blockGasCost extDataGasUsed blockExtraData extDataHash), + signature stateRoot step transactionsRoot uncles), do: entry defp entry_to_elixir({"timestamp" = key, timestamp}) do @@ -606,4 +602,14 @@ defmodule EthereumJSONRPC.Block do defp entry_to_elixir({"l1BlockNumber", _}) do {:ignore, :ignore} end + + # bitcoinMergedMiningCoinbaseTransaction bitcoinMergedMiningHeader bitcoinMergedMiningMerkleProof hashForMergedMining - RSK https://github.com/blockscout/blockscout/pull/2934 + # committedSeals committee pastCommittedSeals proposerSeal round - Autonity network https://github.com/blockscout/blockscout/pull/3480 + # blockGasCost extDataGasUsed - sgb/ava https://github.com/blockscout/blockscout/pull/5301 + # blockExtraData extDataHash - Avalanche https://github.com/blockscout/blockscout/pull/5348 + # vrf vrfProof - Harmony + # ... + defp entry_to_elixir({_, _}) do + {:ignore, :ignore} + end end