Status: In progress
Steps to recreate failing test
-
run
mkdir plugin_dev cd plugin_dev
-
clone app-ethereum into plugin_dev folder
git clone --recurse-submodules [email protected]:LedgerHQ/app-ethereum.git
-
clone plugin-tools into plugin_dev folder
git clone [email protected]:LedgerHQ/plugin-tools.git
-
run docker-compose to connect to container
cd plugin-tools ./start.sh
-
if you're properly connected to the docker-container you can run & see
root@997ccff31349:/plugin_dev$ ls app-ethereum plugin-tools
-
To compile the ethereum app within the container
cd app-ethereum make
-
If everything goes well, you once compilation is done, you should have
[LINK] bin/app.elf
-
We’ve created a boilerplate plugin that should help you write your first plugin! We’ll be following along this boilerplate code for this guide. You can start by forking the repo and cloning your fork in the
plugin_dev
folder:cd .. git clone --recurse-submodules YOUR_FORKED_URL
-
TESTING the code as provided by Ledger boilerplate without making any changes:
cd app-plugin-boilerplate/tests && yarn install
-
Build the plugin tests per this step. In a new terminal window in your
plugin_dev
foldercd plugin-tools ./start.sh
now in the running docker container from
start.sh
cd app-plugin-boilerplate/tests ./build_local_test_elfs.sh
-
Now run back in
plugin_dev
run the testsyarn test
-
and you'll get the error:
yarn run v1.22.15 $ jest src --verbose --runInBand --detectOpenHandles Determining test suites to run...[DOCKER] Pulling from zondax/builder-zemu: [DOCKER] Digest: sha256:fd969f588c9b5444c887397e19d00f4465bc87526428bc25a43adb6f6b2ba71c: [DOCKER] Status: Image is up to date for zondax/builder-zemu:0c7c0c2f6a23e8018dad1de53fa1b23a27a48f6e: [ZEMU] 17:12:26.869: Checking ELF [ZEMU] 17:12:26.875: Starting Container [ZEMU] Using NanoS SDK 2.0 [ZEMU] Command: /home/zondax/speculos/speculos.py --log-level speculos:DEBUG --log-level vnc:DEBUG --log-level vnc:DEBUG --color JADE_GREEN -m nanos -k 2.0 --vnc-port 8001 /project/app/bin/ethereum_nanos.elf -l Boilerplate:/project/app/bin/plugin_nanos.elf [ZEMU] Creating Container [ZEMU] Connected 81b6b8320b9d4907141e81a07d3a4d6239736396dcb5696bdedf7e9e0650180a [ZEMU] Attached 81b6b8320b9d4907141e81a07d3a4d6239736396dcb5696bdedf7e9e0650180a -------------------------------------- Zemu container - zondax.ch -------------------------------------- HTTP proxy started... BOLOS_SDK=/project/deps/nanos-secure-sdk BOLOS_ENV=/opt/bolos [ZEMU] Started 81b6b8320b9d4907141e81a07d3a4d6239736396dcb5696bdedf7e9e0650180a [ZEMU] 17:12:27.463: Started Container [ZEMU] 17:12:27.463: Wait VNC for 5000 ms [ZEMU] 17:12:32.472: VNC Connection created 127.0.0.1:65003 serving at port 9998 17:12:28.654:speculos: executing qemu: ['qemu-arm-static', '/home/zondax/speculos/build/src/launcher', '-m', 'nanos', '-k', '2.0', '-c', '/home/zondax/speculos/cxlib/cx-2.0.elf', 'main:/project/app/bin/ethereum_nanos.elf:0x10000:0xeb00:0x20000200:0x1200', 'Boilerplate:/project/app/bin/plugin_nanos.elf:0x10000:0x1540:0x20000200:0x1200'] QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-zondax' qt.qpa.screen: QXcbConnection: Could not connect to display host.docker.internal:0 Could not connect to any X display. [ZEMU] 17:12:32.476: Could not connect to port 65003 on 127.0.0.1 [ZEMU] 17:12:32.476: Error: connect ECONNREFUSED 127.0.0.1:65003 [ZEMU] 17:12:32.476: Close [ZEMU] Stopping container [ZEMU] 17:12:32.478: [ZEMU] Error: connect ECONNREFUSED 127.0.0.1:65003 [ZEMU] 17:12:32.478: Close [ZEMU] 17:12:32.480: Checking ELF [ZEMU] 17:12:32.484: Starting Container [ZEMU] Command: /home/zondax/speculos/speculos.py --log-level speculos:DEBUG --log-level vnc:DEBUG --log-level vnc:DEBUG --color JADE_GREEN -m nanox --vnc-port 8001 /project/app/bin/ethereum_nanox.elf -l Boilerplate:/project/app/bin/plugin_nanox.elf [ZEMU] Creating Container [ZEMU] Error: (HTTP code 304) container already stopped - [ZEMU] Stopped [ZEMU] Connected c1fcea7fe952f75d4379a7f93e9295927a36f1ab3a135f094fce23f8be1aed43 [ZEMU] Attached c1fcea7fe952f75d4379a7f93e9295927a36f1ab3a135f094fce23f8be1aed43 [ZEMU] Removed -------------------------------------- Zemu container - zondax.ch -------------------------------------- HTTP proxy started... BOLOS_SDK=/project/deps/nanos-secure-sdk BOLOS_ENV=/opt/bolos [ZEMU] Started c1fcea7fe952f75d4379a7f93e9295927a36f1ab3a135f094fce23f8be1aed43 [ZEMU] 17:12:32.997: Started Container [ZEMU] 17:12:32.998: Wait VNC for 5000 ms [ZEMU] 17:12:38.002: VNC Connection created 127.0.0.1:65008 FAIL src/swap_exact_eth_for_tokens.test.js (12.888 s) ✕ [Nano S] Swap Exact Eth For Tokens with beneficiary (5616 ms) ✕ [Nano X] Swap Exact Eth For Tokens with beneficiary (5530 ms) ● [Nano S] Swap Exact Eth For Tokens with beneficiary connect ECONNREFUSED 127.0.0.1:65003 ● [Nano X] Swap Exact Eth For Tokens with beneficiary connect ECONNREFUSED 127.0.0.1:65008 Test Suites: 1 failed, 1 total Tests: 2 failed, 2 total Snapshots: 0 total Time: 12.979 s Ran all test suites matching /src/i. error Command failed with exit code 1.