blockscout / blockscout-rs

Microservices for blockscout indexer
MIT License
162 stars 115 forks source link

Fail to verify SC via upload std json: OverflowKnownLength #307

Closed SaigyoujiYuyuko233 closed 1 year ago

SaigyoujiYuyuko233 commented 1 year ago

When I upload a 2MB+ json file for sc verification, there is an error JSON payload (4152195 bytes) is larger than allowed (limit: 2097152 bytes).

With backend log:

smart-contract-verifier    | 2022-12-22T05:32:47.117254Z  WARN HTTP request{http.method=POST
http.route=/api/v1/solidity/verify/standard-json http.flavor=1.1
http.scheme=http http.host=host.docker.internal:8043
http.client_ip=172.19.0.1 http.user_agent=hackney/1.18.1 
http.target=/api/v1/solidity/verify/standard-json 
otel.name=HTTP POST /api/v1/solidity/verify/standard-json 
otel.kind="server" 
request_id=c69c1e33-ae5e-4870-8ffd-15ce3cdacd47 
exception.message=JSON payload (4152211 bytes) is larger than allowed (limit: 2097152 bytes).
exception.details=OverflowKnownLength { length: 4152211, limit: 2097152 } 
http.status_code=413 
otel.status_code="OK"}:
tracing_actix_web::middleware: Error encountered while processing the incoming HTTP request: OverflowKnownLength { length: 4152211, limit: 2097152 }

Environment

Steps to reproduce

  1. prepare a json file that is more than 2MB
  2. go to smart contract verification page and choose via Standard Input Json
  3. upload the json file and click "verify & publish"

Expected behaviour

The smart contract will be verified.

Actual behaviour

image

Is there any way to set this limit via env variable?

Any help willbe appreciated!

rimrakhimov commented 1 year ago

Fixed in https://github.com/blockscout/blockscout-rs/pull/332. Now the maximum payload size may be specified via configuration variables. Adapted in smart-contract-verifier-v1.0.0 release