Merge branch 'master' into ab-update-fork-for-absinthe-phoenix

pull/2590/head
Victor Baranov 5 years ago committed by GitHub
commit 269fb27a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 14
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/decode_error.ex

@ -16,6 +16,7 @@
### Chore ### Chore
- [#2590](https://github.com/poanetwork/blockscout/pull/2590) - restore backward compatablity with old releases - [#2590](https://github.com/poanetwork/blockscout/pull/2590) - restore backward compatablity with old releases
- [#2574](https://github.com/poanetwork/blockscout/pull/2574) - limit request body in json rpc error
- [#2566](https://github.com/poanetwork/blockscout/pull/2566) - upgrade absinthe phoenix - [#2566](https://github.com/poanetwork/blockscout/pull/2566) - upgrade absinthe phoenix

@ -35,11 +35,23 @@ defmodule EthereumJSONRPC.DecodeError do
%EthereumJSONRPC.DecodeError{request: request, response: response} %EthereumJSONRPC.DecodeError{request: request, response: response}
end end
@request_body_limit 700
@impl Exception @impl Exception
def message(%EthereumJSONRPC.DecodeError{ def message(%EthereumJSONRPC.DecodeError{
request: %EthereumJSONRPC.DecodeError.Request{url: request_url, body: request_body}, request: %EthereumJSONRPC.DecodeError.Request{url: request_url, body: request_body},
response: %EthereumJSONRPC.DecodeError.Response{status_code: response_status_code, body: response_body} response: %EthereumJSONRPC.DecodeError.Response{status_code: response_status_code, body: response_body}
}) do }) do
request_body_binary = IO.iodata_to_binary(request_body)
truncated_request_body =
if byte_size(request_body_binary) < @request_body_limit do
request_body_binary
else
<<result::binary-size(@request_body_limit), _::binary>> = request_body_binary
result
end
""" """
Failed to decode Ethereum JSONRPC response: Failed to decode Ethereum JSONRPC response:
@ -47,7 +59,7 @@ defmodule EthereumJSONRPC.DecodeError do
url: #{request_url} url: #{request_url}
body: #{IO.iodata_to_binary(request_body)} body: #{truncated_request_body}
response: response:

Loading…
Cancel
Save