Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

local dev env #1

Merged
merged 29 commits into from
Oct 27, 2023
Merged

local dev env #1

merged 29 commits into from
Oct 27, 2023

Conversation

gravityblast
Copy link

@gravityblast gravityblast commented Oct 9, 2023

This PR allows to run a local chain using a docker container with scripts to deploy contracts and populate them with test data.

The population part is just a test, and for now it adds only one project. In the next PR we will create more data including rounds, applications, etc...

The current work includes

  • Dockerfile with projects deps + anvil
  • Makefile with common tasks
  • Scripts to deploy contracts to local containerized chain
  • dev network configuration with deterministic contract addresses
  • Base script to populate with test data

@gravityblast gravityblast marked this pull request as draft October 9, 2023 23:15
@gravityblast gravityblast marked this pull request as ready for review October 10, 2023 08:54
@bard
Copy link

bard commented Oct 11, 2023

Getting an error during docker build:

#12 11.93 .../node_modules/core-js-pure postinstall$ node -e "try{require('./postinstall')}catch(e){}"
#12 11.93 .../node_modules/cpu-features install$ node buildcheck.js > buildcheck.gypi && node-gyp rebuild
#12 11.93 .../[email protected]/node_modules/core-js postinstall$ node -e "try{require('./postinstall')}catch(e){}"
#12 11.95 .../node_modules/bufferutil install$ node-gyp-build
#12 11.95 .../node_modules/classic-level install$ node-gyp-build
#12 11.97 .../node_modules/core-js-pure postinstall: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
#12 11.97 .../node_modules/core-js-pure postinstall: The project needs your help! Please consider supporting of core-js:
#12 11.97 .../node_modules/core-js-pure postinstall: > https://opencollective.com/core-js
#12 11.97 .../node_modules/core-js-pure postinstall: > https://patreon.com/zloirock
#12 11.97 .../node_modules/core-js-pure postinstall: > https://boosty.to/zloirock
#12 11.97 .../node_modules/core-js-pure postinstall: > bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz
#12 11.97 .../node_modules/core-js-pure postinstall: I highly recommend reading this: https://github.com/zloirock/core-js/blob/master/docs/2023-02-14-so-whats-next.md
#12 11.97 .../node_modules/core-js-pure postinstall: Done
#12 11.97 .../[email protected]/node_modules/core-js postinstall: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
#12 11.97 .../[email protected]/node_modules/core-js postinstall: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
#12 11.97 .../[email protected]/node_modules/core-js postinstall: > https://opencollective.com/core-js
#12 11.97 .../[email protected]/node_modules/core-js postinstall: > https://www.patreon.com/zloirock
#12 11.97 .../[email protected]/node_modules/core-js postinstall: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
#12 11.97 .../[email protected]/node_modules/core-js postinstall: Done
#12 12.02 .../node_modules/classic-level install: Done
#12 12.02 .../node_modules/bufferutil install: Done
#12 12.03 .../[email protected]/node_modules/es5-ext postinstall$  node -e "try{require('./_postinstall')}catch(e){}" || exit 0
#12 12.07 .../[email protected]/node_modules/es5-ext postinstall: Done
#12 12.09 .../[email protected]/node_modules/node-hid install$ prebuild-install || node-gyp rebuild
#12 12.09 .../[email protected]/node_modules/keccak install$ node-gyp-build || exit 0
#12 12.13 .../[email protected]/node_modules/node-hid install$ prebuild-install --runtime napi || node-gyp rebuild
#12 12.14 .../node_modules/cpu-features install: gyp info it worked if it ends with ok
#12 12.14 .../node_modules/cpu-features install: gyp info using [email protected]
#12 12.14 .../node_modules/cpu-features install: gyp info using [email protected] | linux | x64
#12 12.16 .../[email protected]/node_modules/keccak install: Done
#12 12.18 .../[email protected]/node_modules/node-hid install$ prebuild-install --runtime napi || node-gyp rebuild
#12 12.20 .../node_modules/cpu-features install: gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
#12 12.23 .../node_modules/postinstall-postinstall postinstall$ node ./run.js
#12 12.25 .../node_modules/cpu-features install: gyp http GET https://nodejs.org/download/release/v20.8.0/node-v20.8.0-headers.tar.gz
#12 12.26 .../node_modules/postinstall-postinstall postinstall: Done
#12 12.28 .../node_modules/secp256k1 install$ node-gyp-build || exit 0
#12 12.33 .../node_modules/secp256k1 install: Done
#12 12.36 .../.pnpm/[email protected]/node_modules/usb install$ node-gyp-build
#12 12.39 .../node_modules/cpu-features install: gyp http 200 https://nodejs.org/download/release/v20.8.0/node-v20.8.0-headers.tar.gz
#12 12.41 .../.pnpm/[email protected]/node_modules/usb install: Done
#12 12.46 .../node_modules/utf-8-validate install$ node-gyp-build
#12 12.51 .../[email protected]/node_modules/node-hid install: prebuild-install WARN install No prebuilt binaries found (target=20.8.0 runtime=node arch=x64 libc= platform=linux)
#12 12.52 .../node_modules/utf-8-validate install: Done
#12 12.53 .../[email protected]/node_modules/web3-bzz postinstall$ echo "WARNING: the web3-bzz api will be deprecated in the next version"
#12 12.54 .../[email protected]/node_modules/web3-bzz postinstall: WARNING: the web3-bzz api will be deprecated in the next version
#12 12.54 .../[email protected]/node_modules/web3-bzz postinstall: Done
#12 12.54 .../[email protected]/node_modules/web3-bzz postinstall$ echo "WARNING: the web3-bzz api will be deprecated in the next version"
#12 12.55 .../[email protected]/node_modules/web3-bzz postinstall: WARNING: the web3-bzz api will be deprecated in the next version
#12 12.55 .../[email protected]/node_modules/web3-bzz postinstall: Done
#12 12.56 .../[email protected]/node_modules/web3-shh postinstall$ echo "WARNING: the web3-shh api will be deprecated in the next version"
#12 12.56 .../[email protected]/node_modules/node-hid install: gyp info it worked if it ends with ok
#12 12.56 .../[email protected]/node_modules/node-hid install: gyp info using [email protected]
#12 12.56 .../[email protected]/node_modules/node-hid install: gyp info using [email protected] | linux | x64
#12 12.56 .../[email protected]/node_modules/web3-shh postinstall: WARNING: the web3-shh api will be deprecated in the next version
#12 12.56 .../[email protected]/node_modules/web3-shh postinstall: Done
#12 12.57 .../[email protected]/node_modules/web3-shh postinstall$ echo "WARNING: the web3-shh api will be deprecated in the next version"
#12 12.58 .../[email protected]/node_modules/web3-shh postinstall: WARNING: the web3-shh api will be deprecated in the next version
#12 12.58 .../[email protected]/node_modules/web3-shh postinstall: Done
#12 12.59 .../.pnpm/[email protected]/node_modules/web3 postinstall$ node angular-patch.js
#12 12.61 .../[email protected]/node_modules/node-hid install: gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
#12 12.62 .../.pnpm/[email protected]/node_modules/web3 postinstall: Done
#12 12.67 .../[email protected]/node_modules/node-hid install: gyp http GET https://nodejs.org/download/release/v20.8.0/node-v20.8.0-headers.tar.gz
#12 12.80 .../[email protected]/node_modules/node-hid install: gyp http 200 https://nodejs.org/download/release/v20.8.0/node-v20.8.0-headers.tar.gz
#12 12.82 .../[email protected]/node_modules/node-hid install: Done
#12 12.88 .../[email protected]/node_modules/node-hid install: Done
#12 13.04 .../node_modules/cpu-features install: gyp http GET https://nodejs.org/download/release/v20.8.0/SHASUMS256.txt
#12 13.08 .../node_modules/cpu-features install: gyp http 200 https://nodejs.org/download/release/v20.8.0/SHASUMS256.txt
#12 13.09 .../node_modules/cpu-features install: gyp info spawn /usr/bin/python3
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args [
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/gyp/gyp_main.py',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   'binding.gyp',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-f',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   'make',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-I',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '/app/node_modules/.pnpm/[email protected]/node_modules/cpu-features/build/config.gypi',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-I',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/addon.gypi',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-I',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '/root/.cache/node-gyp/20.8.0/include/node/common.gypi',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Dlibrary=shared_library',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Dvisibility=default',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/20.8.0',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Dnode_gyp_dir=/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/20.8.0/<(target_arch)/node.lib',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Dmodule_root_dir=/app/node_modules/.pnpm/[email protected]/node_modules/cpu-features',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Dnode_engine=v8',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '--depth=.',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '--no-parallel',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '--generator-output',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   'build',
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args   '-Goutput_dir=.'
#12 13.09 .../node_modules/cpu-features install: gyp info spawn args ]
#12 13.21 .../node_modules/cpu-features install: gyp info spawn make
#12 13.21 .../node_modules/cpu-features install: gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#12 13.21 .../node_modules/cpu-features install: make: Entering directory '/app/node_modules/.pnpm/[email protected]/node_modules/cpu-features/build'
#12 13.21 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o
#12 13.23 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_macos_or_iphone.o
#12 13.24 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o
#12 13.26 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o
#12 13.27 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o
#12 13.29 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o
#12 13.30 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o
#12 13.43 .../[email protected]/node_modules/node-hid install: gyp http GET https://nodejs.org/download/release/v20.8.0/SHASUMS256.txt
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp http 200 https://nodejs.org/download/release/v20.8.0/SHASUMS256.txt
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn /usr/bin/python3
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args [
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/gyp/gyp_main.py',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   'binding.gyp',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-f',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   'make',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-I',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '/app/node_modules/.pnpm/[email protected]/node_modules/node-hid/build/config.gypi',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-I',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/addon.gypi',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-I',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '/root/.cache/node-gyp/20.8.0/include/node/common.gypi',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Dlibrary=shared_library',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Dvisibility=default',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/20.8.0',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Dnode_gyp_dir=/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/20.8.0/<(target_arch)/node.lib',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Dmodule_root_dir=/app/node_modules/.pnpm/[email protected]/node_modules/node-hid',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Dnode_engine=v8',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '--depth=.',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '--no-parallel',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '--generator-output',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   'build',
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args   '-Goutput_dir=.'
#12 13.46 .../[email protected]/node_modules/node-hid install: gyp info spawn args ]
#12 13.51 .../[email protected]/node_modules/node-hid install: /bin/sh: 1: pkg-config: not found
#12 13.53 .../[email protected]/node_modules/node-hid install: gyp info spawn make
#12 13.53 .../[email protected]/node_modules/node-hid install: gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
#12 13.53 .../[email protected]/node_modules/node-hid install: make: Entering directory '/app/node_modules/.pnpm/[email protected]/node_modules/node-hid/build'
#12 13.53 .../[email protected]/node_modules/node-hid install:   CC(target) Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o
#12 13.55 .../[email protected]/node_modules/node-hid install: ../hidapi/linux/hid.c:44:10: fatal error: libudev.h: No such file or directory
#12 13.55 .../[email protected]/node_modules/node-hid install:    44 | #include <libudev.h>
#12 13.55 .../[email protected]/node_modules/node-hid install:       |          ^~~~~~~~~~~
#12 13.55 .../[email protected]/node_modules/node-hid install: compilation terminated.
#12 13.55 .../[email protected]/node_modules/node-hid install: make: *** [hidapi-linux-hidraw.target.mk:113: Release/obj.target/hidapi-linux-hidraw/hidapi/linux/hid.o] Error 1
#12 13.55 .../[email protected]/node_modules/node-hid install: make: Leaving directory '/app/node_modules/.pnpm/[email protected]/node_modules/node-hid/build'
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! build error
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! stack Error: `make` failed with exit code: 2
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! stack     at ChildProcess.onExit (/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/lib/build.js:203:23)
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! System Linux 6.5.3-zen1-1-zen
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! command "/usr/local/bin/node" "/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! cwd /app/node_modules/.pnpm/[email protected]/node_modules/node-hid
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! node -v v20.8.0
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! node-gyp -v v9.4.0
#12 13.55 .../[email protected]/node_modules/node-hid install: gyp ERR! not ok
#12 13.55 .../[email protected]/node_modules/node-hid install: Failed
#12 13.58 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o
#12 13.59 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o
#12 13.60 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o
#12 13.63 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o
#12 13.66 .../node_modules/cpu-features install:   CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o
#12 13.72 .../node_modules/cpu-features install: rm -f Release/obj.target/deps/cpu_features/cpu_features.a Release/obj.target/deps/cpu_features/cpu_features.a.ar-file-list; mkdir -p `dirname Release/obj.target/deps/cpu_features/cpu_features.a`
#12 13.73 .../node_modules/cpu-features install: ar crs Release/obj.target/deps/cpu_features/cpu_features.a @Release/obj.target/deps/cpu_features/cpu_features.a.ar-file-list
#12 13.73 .../node_modules/cpu-features install:   COPY Release/cpu_features.a
#12 13.73 .../node_modules/cpu-features install:   CXX(target) Release/obj.target/cpufeatures/src/binding.o
#12 14.19 .../node_modules/cpu-features install: In file included from ../src/binding.cc:3:
#12 14.19 .../node_modules/cpu-features install: ../../../../[email protected]/node_modules/nan/nan.h: In function 'bool Nan::IdleNotification(int)':
#12 14.19 .../node_modules/cpu-features install: ../../../../[email protected]/node_modules/nan/nan.h:686:63: warning: 'bool v8::Isolate::IdleNotificationDeadline(double)' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
#12 14.19 .../node_modules/cpu-features install:   686 |     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
#12 14.19 .../node_modules/cpu-features install:       |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
#12 14.19 .../node_modules/cpu-features install:   687 |         idle_time_in_ms * 0.001);
#12 14.19 .../node_modules/cpu-features install:       |         ~~~~~~~~~~~~~~~~~~~~~~~~
#12 14.19 .../node_modules/cpu-features install: In file included from /root/.cache/node-gyp/20.8.0/include/node/v8-initialization.h:13,
#12 14.19 .../node_modules/cpu-features install:                  from /root/.cache/node-gyp/20.8.0/include/node/v8.h:34,
#12 14.19 .../node_modules/cpu-features install:                  from /root/.cache/node-gyp/20.8.0/include/node/node.h:73,
#12 14.19 .../node_modules/cpu-features install:                  from ../src/binding.cc:1:
#12 14.19 .../node_modules/cpu-features install: /root/.cache/node-gyp/20.8.0/include/node/v8-isolate.h:1293:8: note: declared here
#12 14.19 .../node_modules/cpu-features install:  1293 |   bool IdleNotificationDeadline(double deadline_in_seconds);
#12 14.19 .../node_modules/cpu-features install:       |        ^~~~~~~~~~~~~~~~~~~~~~~~
#12 14.20 .../node_modules/cpu-features install: ../src/binding.cc: At global scope:
#12 14.20 .../node_modules/cpu-features install: /root/.cache/node-gyp/20.8.0/include/node/node.h:1170:7: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
#12 14.20 .../node_modules/cpu-features install:  1170 |       (node::addon_register_func) (regfunc),                          \
#12 14.20 .../node_modules/cpu-features install:       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#12 14.20 .../node_modules/cpu-features install: /root/.cache/node-gyp/20.8.0/include/node/node.h:1204:3: note: in expansion of macro 'NODE_MODULE_X'
#12 14.20 .../node_modules/cpu-features install:  1204 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
#12 14.20 .../node_modules/cpu-features install:       |   ^~~~~~~~~~~~~
#12 14.20 .../node_modules/cpu-features install: ../src/binding.cc:151:1: note: in expansion of macro 'NODE_MODULE'
#12 14.20 .../node_modules/cpu-features install:   151 | NODE_MODULE(cpufeatures, init)
#12 14.20 .../node_modules/cpu-features install:       | ^~~~~~~~~~~
#12 14.38 .../node_modules/cpu-features install:   SOLINK_MODULE(target) Release/obj.target/cpufeatures.node
#12 14.41 .../node_modules/cpu-features install:   COPY Release/cpufeatures.node
#12 14.41 .../node_modules/cpu-features install: make: Leaving directory '/app/node_modules/.pnpm/[email protected]/node_modules/cpu-features/build'
#12 14.41 .../node_modules/cpu-features install: gyp info ok
#12 14.42 .../node_modules/cpu-features install: Done

@boudra
Copy link

boudra commented Oct 11, 2023

We're using a very recent version of Node (20), but the packages we use are built for previous versions (<14), so we don't have precompiled binaries and the Node ABI is different to compile them, we should upgrade those packages or downgrade Node.

https://github.com/node-hid/node-hid/releases/tag/v1.3.0

@bard
Copy link

bard commented Oct 11, 2023

We're using a very recent version of Node (20), but the packages we use are built for previous versions (<14), so we don't have precompiled binaries and the Node ABI is different to compile them, we should upgrade those packages or downgrade Node.

https://github.com/node-hid/node-hid/releases/tag/v1.3.0

This one could be fixed by installing the right headers (going to try that) but the thing I'm confused about is @gravityblast is not getting the same error despite also building in Docker.

@bard
Copy link

bard commented Oct 11, 2023

Installing the dependency did fix that particular error but only to expose the next one, which looks of the sort that @boudra mentioned:

#12 15.68 .../[email protected]/node_modules/node-hid install: In file included from ../src/HID.cc:31:
#12 15.68 .../[email protected]/node_modules/node-hid install: ../../../../[email protected]/node_modules/nan/nan.h: In function 'bool Nan::IdleNotification(int)':
#12 15.68 .../[email protected]/node_modules/node-hid install: ../../../../[email protected]/node_modules/nan/nan.h:686:63: warning: 'bool v8::Isolate::IdleNotificationDeadline(double)' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
#12 15.68 .../[email protected]/node_modules/node-hid install:   686 |     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
#12 15.68 .../[email protected]/node_modules/node-hid install:       |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
#12 15.68 .../[email protected]/node_modules/node-hid install:   687 |         idle_time_in_ms * 0.001);
#12 15.68 .../[email protected]/node_modules/node-hid install:       |         ~~~~~~~~~~~~~~~~~~~~~~~~
#12 15.68 .../[email protected]/node_modules/node-hid install: In file included from /root/.cache/node-gyp/20.8.0/include/node/v8-initialization.h:13,
#12 15.68 .../[email protected]/node_modules/node-hid install:                  from /root/.cache/node-gyp/20.8.0/include/node/v8.h:34,
#12 15.68 .../[email protected]/node_modules/node-hid install:                  from /root/.cache/node-gyp/20.8.0/include/node/node.h:73,
#12 15.68 .../[email protected]/node_modules/node-hid install:                  from ../src/HID.cc:30:
#12 15.68 .../[email protected]/node_modules/node-hid install: /root/.cache/node-gyp/20.8.0/include/node/v8-isolate.h:1293:8: note: declared here
#12 15.68 .../[email protected]/node_modules/node-hid install:  1293 |   bool IdleNotificationDeadline(double deadline_in_seconds);
#12 15.68 .../[email protected]/node_modules/node-hid install:       |        ^~~~~~~~~~~~~~~~~~~~~~~~
#12 15.69 .../[email protected]/node_modules/node-hid install: ../src/HID.cc: At global scope:
#12 15.69 .../[email protected]/node_modules/node-hid install: ../src/HID.cc:67:5: error: ISO C++17 does not allow dynamic exception specifications
#12 15.69 .../[email protected]/node_modules/node-hid install:    67 |     throw(JSException);
#12 15.69 .../[email protected]/node_modules/node-hid install:       |     ^~~~~
#12 15.69 .../[email protected]/node_modules/node-hid install: ../src/HID.cc:70:5: error: ISO C++17 does not allow dynamic exception specifications
#12 15.69 .../[email protected]/node_modules/node-hid install:    70 |     throw(JSException);
#12 15.69 .../[email protected]/node_modules/node-hid install:       |     ^~~~~
#12 15.70 .../[email protected]/node_modules/node-hid install: ../src/HID.cc:152:3: error: ISO C++17 does not allow dynamic exception specifications
#12 15.70 .../[email protected]/node_modules/node-hid install:   152 |   throw(JSException)
#12 15.70 .../[email protected]/node_modules/node-hid install:       |   ^~~~~
#12 15.70 .../[email protected]/node_modules/node-hid install: ../src/HID.cc:163:3: error: ISO C++17 does not allow dynamic exception specifications
#12 15.70 .../[email protected]/node_modules/node-hid install:   163 |   throw(JSException)
#12 15.70 .../[email protected]/node_modules/node-hid install:       |   ^~~~~
#12 15.70 .../[email protected]/node_modules/node-hid install: ../src/HID.cc: In static member function 'static Nan::NAN_METHOD_RETURN_TYPE HID::read(Nan::NAN_METHOD_ARGS_TYPE)':
#12 15.70 .../[email protected]/node_modules/node-hid install: ../src/HID.cc:255:52: warning: cast between incompatible function types from 'void (*)(uv_work_t*)' {aka 'void (*)(uv_work_s*)'} to 'uv_after_work_cb' {aka 'void (*)(uv_work_s*, int)'} [-Wcast-function-type]
#12 15.70 .../[email protected]/node_modules/node-hid install:   255 |   uv_queue_work(uv_default_loop(), req, recvAsync, (uv_after_work_cb)recvAsyncDone);
#12 15.70 .../[email protected]/node_modules/node-hid install:       |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#12 15.81 .../[email protected]/node_modules/node-hid install: make: *** [HID-hidraw.target.mk:124: Release/obj.target/HID-hidraw/src/HID.o] Error 1
#12 15.81 .../[email protected]/node_modules/node-hid install: make: Leaving directory '/app/node_modules/.pnpm/[email protected]/node_modules/node-hid/build'
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! build error
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! stack Error: `make` failed with exit code: 2
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! stack     at ChildProcess.onExit (/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/lib/build.js:203:23)
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! System Linux 6.5.3-zen1-1-zen
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! command "/usr/local/bin/node" "/root/.cache/node/corepack/pnpm/8.9.0/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! cwd /app/node_modules/.pnpm/[email protected]/node_modules/node-hid
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! node -v v20.8.0
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! node-gyp -v v9.4.0
#12 15.81 .../[email protected]/node_modules/node-hid install: gyp ERR! not ok
#12 15.82 .../[email protected]/node_modules/node-hid install: Failed

@bard
Copy link

bard commented Oct 11, 2023

node-hid 1.3 is a dependency of @ethersproject/hardware-wallets 5.7.0 via @ledgerhq/hw-transport-node-hid 5.26.0. @ethersproject/hardware-wallets doesn't have a newer version, but node-hid 2.1 is already in the codebase via other packages, so I ovverode the 1.3 requirement in package.json with the following and it seemed to fix the problem:

  "pnpm": {
    "overrides": {
      "node-hid": "^2"
    }
  }

@bard
Copy link

bard commented Oct 11, 2023

Funnily, I get this when running under docker-compose instead of plain docker:

allo-contracts-v1-localchain-init-1  | Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted", method="estimateGas", transaction={"from":"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266","to":"0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0","data":"0x3044ef7f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003b6261666b726569627164766f6463786270636632783779726771696c767979736b6e7265726c7632356637676e6268716e6f6f336a786f633237340000000000","accessList":null}, error={"name":"ProviderError","_stack":"ProviderError: execution reverted\n    at HttpProvider.request (/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/hardhat/src/internal/core/providers/http.ts:88:21)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async EthersProviderWrapper.send (/app/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)","code":3,"_isProviderError":true,"data":"0x"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
allo-contracts-v1-localchain-init-1  |     at Logger.makeError (/app/node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
allo-contracts-v1-localchain-init-1  |     at Logger.throwError (/app/node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
allo-contracts-v1-localchain-init-1  |     at checkError (/app/node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:78:20)
allo-contracts-v1-localchain-init-1  |     at EthersProviderWrapper.<anonymous> (/app/node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:642:20)
allo-contracts-v1-localchain-init-1  |     at step (/app/node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
allo-contracts-v1-localchain-init-1  |     at Object.throw (/app/node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
allo-contracts-v1-localchain-init-1  |     at rejected (/app/node_modules/.pnpm/@[email protected]/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
allo-contracts-v1-localchain-init-1  |     at processTicksAndRejections (node:internal/process/task_queues:95:5) {
allo-contracts-v1-localchain-init-1  |   reason: 'execution reverted',
allo-contracts-v1-localchain-init-1  |   code: 'UNPREDICTABLE_GAS_LIMIT',
allo-contracts-v1-localchain-init-1  |   method: 'estimateGas',
allo-contracts-v1-localchain-init-1  |   transaction: {
allo-contracts-v1-localchain-init-1  |     from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
allo-contracts-v1-localchain-init-1  |     to: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
allo-contracts-v1-localchain-init-1  |     data: '0x3044ef7f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003b6261666b726569627164766f6463786270636632783779726771696c767979736b6e7265726c7632356637676e6268716e6f6f336a786f633237340000000000',
allo-contracts-v1-localchain-init-1  |     accessList: null
allo-contracts-v1-localchain-init-1  |   },
allo-contracts-v1-localchain-init-1  |   error: ProviderError: execution reverted
allo-contracts-v1-localchain-init-1  |       at HttpProvider.request (/app/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/hardhat/src/internal/core/providers/http.ts:88:21)
allo-contracts-v1-localchain-init-1  |       at processTicksAndRejections (node:internal/process/task_queues:95:5)
allo-contracts-v1-localchain-init-1  |       at async EthersProviderWrapper.send (/app/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
allo-contracts-v1-localchain-init-1  | }
allo-contracts-v1-localchain-init-1 exited with code 1

I can share the compose file, but if the above rings any bells @gravityblast please let me know

@gravityblast
Copy link
Author

@bard @boudra since this is a repo we are using to create a local environment and not really to deploy these contracts to production, I propose we remove the hardware wallet dependencies, wdyt?

@bard
Copy link

bard commented Oct 18, 2023

@gravityblast 👍

@gravityblast
Copy link
Author

so I ovverode the 1.3 requirement in package.json with the following and it seemed to fix the problem:

I missed this message, so let's keep it and I'll fix it like you did!
I notice though the image has been built successfully in the github action

@gravityblast
Copy link
Author

I can share the compose file, but if the above rings any bells @gravityblast please let me know

yes if you can share it I can try

@gravityblast
Copy link
Author

@bard I just pushed the node-hid override

@bard
Copy link

bard commented Oct 19, 2023

so I ovverode the 1.3 requirement in package.json with the following and it seemed to fix the problem:

I missed this message, so let's keep it and I'll fix it like you did! I notice though the image has been built successfully in the github action

There was once a build that seemed to only fail on my laptop. And then we moved from Fleek to Vercel.

@bard
Copy link

bard commented Oct 19, 2023

I can share the compose file, but if the above rings any bells @gravityblast please let me know

yes if you can share it I can try

Pushed to the https://github.com/gitcoinco/allo-contracts-v1/tree/dev-env-compose branch

@gravityblast
Copy link
Author

And then we moved from Fleek to Vercel

I meant a new action I added to build the docker image and push it to ghcr https://github.com/gitcoinco/allo-contracts-v1/actions/runs/6567652555/job/17840749412

@bard
Copy link

bard commented Oct 19, 2023

And then we moved from Fleek to Vercel

I meant a new action I added to build the docker image and push it to ghcr https://github.com/gitcoinco/allo-contracts-v1/actions/runs/6567652555/job/17840749412

And I meant the risk of taking "it builds in environment X" as sign that all is good. :)

@gravityblast
Copy link
Author

And I meant the risk of taking "it builds in environment X" as sign that all is good. :)

no of course, I was pointing out that there it worked and it makes sense to understand what we need to fix, not the "it works here™"

@gravityblast
Copy link
Author

Pushed to the https://github.com/gitcoinco/allo-contracts-v1/tree/dev-env-compose branch

ah ok now I understand your docker-compose problem. The script was meant to be used with exec, but with the latest commit it works both ways, you can have something link:

  localchain-init:
    image: ghcr.io/gitcoinco/allo-contracts-v1:pr-1
    depends_on:
      - localchain
    environment:
      - DEV_CHAIN_HOST=localchain
    restart: "no"
    entrypoint: [ "bash", "-c", "sleep 2 && corepack enable && ./docker/deploy-contracts.sh"]

@boudra
Copy link

boudra commented Oct 20, 2023

@gravityblast

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v1

    - name: Login to GHCR
      uses: docker/login-action@v1
      with:
        username: ${{ github.repository_owner }}
        password: ${{ secrets.GITHUB_TOKEN }}

    - name: Build and push Docker images
      uses: docker/build-push-action@v2
      with:
        context: .
        file: ./docker/Dockerfile
        platforms: linux/amd64,linux/arm64
        push: true
        tags: gitcoinco/allo-contracts-v1:latest

remember to give access to GA to write packages

@gravityblast
Copy link
Author

I moved the Dockerfile to the root folder and now buildx works

Dockerfile Outdated
@@ -0,0 +1,25 @@
FROM node:20-slim

RUN apt-get clean && \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the purpose is reducing image size, this should come after apt-get install so that the image doesn't contain cached packages.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch thank you I'm updating it

Dockerfile Outdated
apt-get update && \
apt-get install -y python3 curl git build-essential psmisc

COPY ../ /app
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the Dockerfile being now in the root folder, is../ still referring to the correct folder?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch I forgot it from the previous position of the dockerfile

return data;
}

async function uploadJSONToPinata(content: any) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing a declaration for the return type so there's a risk of returning something unintended and only noticing at call sites. (Same for other functions below.)

for (let i = 1; i < 4; i++) {
let metadataCid = "";

if (pinataBaseUrl !== undefined) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity check: do we want the development environment to be usable without pinata?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in grants stack where we set that env, but it might be useful to use only contracts if you are using this image to debug contracts only

@gravityblast gravityblast merged commit c522ab1 into main Oct 27, 2023
0 of 2 checks passed
@gravityblast gravityblast deleted the dev-env branch October 27, 2023 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants