cerc-io / watcher-ts

GNU Affero General Public License v3.0
12 stars 3 forks source link

codegen: Error retrieving binary #422

Open zramsay opened 1 year ago

zramsay commented 1 year ago

To reproduce:

using this example.config.yaml:

contracts:
    # Contract name:
  - name: RewardCollector
    # Contract file path or an url:
    path: ./liquid-staking/contracts/RewardCollector.sol
    # Contract kind (should match name of dataSource in {subgraphPath}/subgraph.yaml if subgraphPath provided)
    #kind: Example1

# Output folder path (logs output using `stdout` if not provided).
outputFolder: ../coll/reward-collector

# Code generation mode [eth_call | storage | all | none] (default: none).
mode: none

# Kind of watcher [lazy | active] (default: active).
kind: lazy

# Watcher server port (default: 3008).
port: 3008

# Solc version to use (optional)
# If not defined, uses solc version listed in dependencies
solc: v0.8.21+commit.d9974be

# Flatten the input contract file(s) [true | false] (default: true).
flatten: true

# Path to the subgraph build (optional).
# Can set empty contracts array when using subgraphPath.
# subgraphPath: ../graph-node/test/subgraph/example1/build

# NOTE: When passed an *URL* as contract path, it is assumed that it points to an already flattened contract file.

The error:

# yarn codegen -c example.config.yaml 
yarn run v1.22.19
$ ts-node src/generate-code.ts -c example.config.yaml
Error: Error retrieving binary: Not Found
    at RedirectableRequest.<anonymous> (/root/watcher-ts/node_modules/solc/wrapper.js:337:24)
    at RedirectableRequest.emit (node:events:514:28)
    at RedirectableRequest.emit (node:domain:489:12)
    at RedirectableRequest._processResponse (/root/watcher-ts/node_modules/follow-redirects/index.js:356:10)
    at ClientRequest.RedirectableRequest._onNativeResponse (/root/watcher-ts/node_modules/follow-redirects/index.js:62:10)
    at Object.onceWrapper (node:events:629:26)
    at ClientRequest.emit (node:events:514:28)
    at ClientRequest.emit (node:domain:489:12)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:693:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
Done in 628.25s.

same error for any contract

nikugogoi commented 1 year ago

The solc version specified in example.config.yaml is incorrect. It should be v0.8.21+commit.d9974bed The list of solc versions is available in https://etherscan.io/solcversions

zramsay commented 1 year ago

ah, trying now. My mistake was copying the GitHub short commit. If the pragma version is not correct, the error is different:

Error: ParserError: Source file requires different compiler version (current compiler is 0.8.13+commit.abaa5c0e.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
 --> Resolver.sol:2:1:
  |
2 | pragma solidity ^0.8.17;
  | ^^^^^^^^^^^^^^^^^^^^^^^^

    at /root/watcher-ts/packages/codegen/src/artifacts.ts:40:15
    at Array.forEach (<anonymous>)
    at /root/watcher-ts/packages/codegen/src/artifacts.ts:38:29
    at step (/root/watcher-ts/packages/codegen/src/artifacts.ts:36:23)
    at Object.next (/root/watcher-ts/packages/codegen/src/artifacts.ts:17:53)
    at /root/watcher-ts/packages/codegen/src/artifacts.ts:11:71
    at new Promise (<anonymous>)
    at __awaiter (/root/watcher-ts/packages/codegen/src/artifacts.ts:7:12)
    at generateArtifacts (/root/watcher-ts/packages/codegen/src/artifacts.ts:55:12)
    at /root/watcher-ts/packages/codegen/src/generate-code.ts:104:61
Done in 424.26s.
zramsay commented 1 year ago

on a fresh DO droplet with 2vCPUs, 16GB ram and 50 GB disk, I get:

<--- Last few GCs --->

[3724:0x769ff10]   332046 ms: Scavenge (reduce) 4072.1 (4142.9) -> 4071.8 (4143.2) MB, 7.2 / 0.0 ms  (average mu = 0.100, current mu = 0.002) allocation failure; 
[3724:0x769ff10]   343244 ms: Mark-sweep (reduce) 4072.4 (4143.2) -> 4071.7 (4143.4) MB, 11194.7 / 0.0 ms  (average mu = 0.061, current mu = 0.017) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb87bc0 node::Abort() [/root/.nvm/versions/node/v18.18.0/bin/node]
 2: 0xa96834  [/root/.nvm/versions/node/v18.18.0/bin/node]
 3: 0xd687f0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/root/.nvm/versions/node/v18.18.0/bin/node]
 4: 0xd68b97 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/root/.nvm/versions/node/v18.18.0/bin/node]
 5: 0xf462a5  [/root/.nvm/versions/node/v18.18.0/bin/node]
 6: 0xf471a8 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/root/.nvm/versions/node/v18.18.0/bin/node]
 7: 0xf576b3  [/root/.nvm/versions/node/v18.18.0/bin/node]
 8: 0xf58528 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/root/.nvm/versions/node/v18.18.0/bin/node]
 9: 0xf32e8e v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v18.18.0/bin/node]
10: 0xf34257 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v18.18.0/bin/node]
11: 0xf1542a v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/root/.nvm/versions/node/v18.18.0/bin/node]
12: 0x12da78f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/root/.nvm/versions/node/v18.18.0/bin/node]
13: 0x170a079  [/root/.nvm/versions/node/v18.18.0/bin/node]
Aborted (core dumped)