Flatten: Throws error due to end-of-file in api response
plotchy opened this issue · 4 comments
plotchy commented
Hello,
I have been using flatten to look at the Resonate protocol's contracts and found a runtime error that feels out of place.
Reproducible command
sol2uml flatten --network fantom 0x1a5c2ee3fb7fe4a2c2e42474a3657c71f6c775cf
A few affected contracts
https://ftmscan.com/address/0x062B3aB17dFac433F9E211F95e6a7A0C627c9a62
https://optimistic.etherscan.io/address/0x22031BE61b10d2C6cC9648f251E1284Be5AFa3f9
https://ftmscan.com/address/0x8e20A69aF81eaeDD74589C9d0684557fd54b0DdA
https://ftmscan.com/address/0xdB84260bE05054b42a71D4a287fF17a199C1c8FF
https://ftmscan.com/address/0x1A5C2ee3FB7fe4A2C2e42474a3657C71f6C775CF
https://ftmscan.com/address/0xA6273F603985D13Ea7405B1B497C3b2F7D798Fd2
https://ftmscan.com/address/0xeF1ffCa755216941874Bd2ab28C9CfC2F3f652bC
Error dump
AxiosError: unexpected end of file
at AxiosError.from (/home/plotchy/.nvm/versions/node/v18.2.0/lib/node_modules/sol2uml/node_modules/axios/dist/node/axios.cjs:785:14)
at BrotliDecompress.handleStreamError (/home/plotchy/.nvm/versions/node/v18.2.0/lib/node_modules/sol2uml/node_modules/axios/dist/node/axios.cjs:2696:29)
at BrotliDecompress.emit (node:events:539:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'Z_BUF_ERROR',
errno: -5,
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: { FormData: [Function], Blob: [class Blob] },
validateStatus: [Function: validateStatus],
headers: AxiosHeaders {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/1.2.1',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
params: {
module: 'contract',
action: 'getsourcecode',
address: '0x22031BE61b10d2C6cC9648f251E1284Be5AFa3f9',
apikey: 'FEXS1HXVA4Y2RNTMEA8V1UTK21S4JWHH9U'
},
method: 'get',
url: 'https://api-optimistic.etherscan.io/api',
data: undefined
},
request: <ref *1> ClientRequest {
_events: [Object: null prototype] {
abort: [Function (anonymous)],
aborted: [Function (anonymous)],
connect: [Function (anonymous)],
error: [Function (anonymous)],
socket: [Function (anonymous)],
timeout: [Function (anonymous)],
prefinish: [Function: requestOnPrefinish]
},
_eventsCount: 7,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
_closed: false,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: false,
_SNICallback: null,
servername: 'api-optimistic.etherscan.io',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 10,
connecting: false,
_hadError: false,
_parent: null,
_host: 'api-optimistic.etherscan.io',
_readableState: [ReadableState],
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: [TLSWrap],
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage: [Circular *1],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(async_id_symbol)]: 7,
[Symbol(kHandle)]: [TLSWrap],
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kSetNoDelay)]: false,
[Symbol(kSetKeepAlive)]: true,
[Symbol(kSetKeepAliveInitialDelay)]: 60,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0,
[Symbol(connect-options)]: [Object]
},
_header: 'GET /api?module=contract&action=getsourcecode&address=0x22031BE61b10d2C6cC9648f251E1284Be5AFa3f9&apikey=FEXS1HXVA4Y2RNTMEA8V1UTK21S4JWHH9U HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'User-Agent: axios/1.2.1\r\n' +
'Accept-Encoding: gzip, compress, deflate, br\r\n' +
'Host: api-optimistic.etherscan.io\r\n' +
'Connection: close\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object: null prototype],
requests: [Object: null prototype] {},
sockets: [Object: null prototype],
freeSockets: [Object: null prototype] {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
scheduling: 'lifo',
maxTotalSockets: Infinity,
totalSocketCount: 1,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'GET',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api?module=contract&action=getsourcecode&address=0x22031BE61b10d2C6cC9648f251E1284Be5AFa3f9&apikey=FEXS1HXVA4Y2RNTMEA8V1UTK21S4JWHH9U',
_ended: true,
res: IncomingMessage {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
socket: [TLSSocket],
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: true,
rawHeaders: [Array],
rawTrailers: [],
aborted: false,
upgrade: false,
url: '',
method: null,
statusCode: 200,
statusMessage: 'OK',
client: [TLSSocket],
_consuming: true,
_dumped: false,
req: [Circular *1],
responseUrl: 'https://api-optimistic.etherscan.io/api?module=contract&action=getsourcecode&address=0x22031BE61b10d2C6cC9648f251E1284Be5AFa3f9&apikey=FEXS1HXVA4Y2RNTMEA8V1UTK21S4JWHH9U',
redirects: [],
[Symbol(kCapture)]: false,
[Symbol(kHeaders)]: [Object],
[Symbol(kHeadersCount)]: 30,
[Symbol(kTrailers)]: null,
[Symbol(kTrailersCount)]: 0
},
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'api-optimistic.etherscan.io',
protocol: 'https:',
_redirectable: Writable {
_writableState: [WritableState],
_events: [Object: null prototype],
_eventsCount: 3,
_maxListeners: undefined,
_options: [Object],
_ended: true,
_ending: true,
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function (anonymous)],
_currentRequest: [Circular *1],
_currentUrl: 'https://api-optimistic.etherscan.io/api?module=contract&action=getsourcecode&address=0x22031BE61b10d2C6cC9648f251E1284Be5AFa3f9&apikey=FEXS1HXVA4Y2RNTMEA8V1UTK21S4JWHH9U',
[Symbol(kCapture)]: false
},
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'user-agent': [Array],
'accept-encoding': [Array],
host: [Array]
}
},
cause: Error: unexpected end of file
at BrotliDecoder.zlibOnError [as onerror] (node:zlib:189:17) {
errno: -5,
code: 'Z_BUF_ERROR'
}
}
naddison36 commented
Looks like an issue with the latest axios release axios/axios#5346.
It works if I downgrade to v1.1.3
naddison36 commented
Fixed with release https://github.com/naddison36/sol2uml/releases/tag/v2.4.1
plotchy commented
On a fresh uninstall->reinstall, the package-lock.json still contains axios v1.2.1
Does the ^
in the semver versioning of ^1.1.3
cause this to default to v1.2.1
?
naddison36 commented
you are correct. Pls try https://github.com/naddison36/sol2uml/releases/tag/v2.4.2