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
- [#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

@ -35,11 +35,23 @@ defmodule EthereumJSONRPC.DecodeError do
%EthereumJSONRPC.DecodeError{request: request, response: response}
end
@request_body_limit 700
@impl Exception
def message(%EthereumJSONRPC.DecodeError{
request: %EthereumJSONRPC.DecodeError.Request{url: request_url, body: request_body},
response: %EthereumJSONRPC.DecodeError.Response{status_code: response_status_code, body: response_body}
}) 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:
@ -47,7 +59,7 @@ defmodule EthereumJSONRPC.DecodeError do
url: #{request_url}
body: #{IO.iodata_to_binary(request_body)}
body: #{truncated_request_body}
response:

Loading…
Cancel
Save