Skip to content

Commit 7ccd0e9

Browse files
authored
Merge pull request #232 from Zondax/neurons-fix
Neurons fix & update
2 parents 0e58ab6 + 26b09da commit 7ccd0e9

File tree

268 files changed

+714
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+714
-216
lines changed

.github/workflows/check_version.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ jobs:
2525
container:
2626
image: zondax/ledger-app-builder:latest
2727
options: --user ${{ needs.configure.outputs.uid_gid }}
28+
env:
29+
SDK_VARNAME: NANOSP_SDK
2830
outputs:
2931
version: ${{ steps.store-version.outputs.version }}
3032
steps:
3133
- name: Checkout
32-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
3335
with:
3436
submodules: true
3537
- run: make version

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Clone
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
with:
2525
submodules: recursive
2626

.github/workflows/main.yml

Lines changed: 70 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
- id: get-user
1717
run: echo "uid_gid=$(id -u):$(id -g)" >> $GITHUB_OUTPUT
1818

19-
cpp_test:
19+
build:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2424
with:
2525
submodules: true
2626
- name: Install deps
@@ -29,7 +29,7 @@ jobs:
2929
make deps
3030
- run: make cpp_test
3131

32-
build_ledger_nano_S:
32+
build_ledger:
3333
needs: configure
3434
runs-on: ubuntu-latest
3535
container:
@@ -41,7 +41,7 @@ jobs:
4141
size: ${{steps.build.outputs.size}}
4242
steps:
4343
- name: Checkout
44-
uses: actions/checkout@v3
44+
uses: actions/checkout@v4
4545
with:
4646
submodules: true
4747
- name: Build Standard app
@@ -52,93 +52,44 @@ jobs:
5252
echo "size=$(python3 deps/ledger-zxlib/scripts/getSize.py s)" >> $GITHUB_OUTPUT
5353
5454
size_nano_s:
55-
needs: build_ledger_nano_S
55+
needs: build_ledger
5656
runs-on: ubuntu-latest
5757
env:
5858
NANOS_LIMIT_SIZE: 136
5959
steps:
6060
- run: |
61-
echo "LNS app size: ${{needs.build_ledger_nano_S.outputs.size}} KiB"
62-
[ ${{needs.build_ledger_nano_S.outputs.size}} -le $NANOS_LIMIT_SIZE ]
63-
64-
build_ledger_nano_X:
65-
needs: configure
66-
runs-on: ubuntu-latest
67-
container:
68-
image: zondax/ledger-app-builder:latest
69-
options: --user ${{ needs.configure.outputs.uid_gid }}
70-
env:
71-
BOLOS_SDK: /opt/nanox-secure-sdk
72-
steps:
73-
- name: Checkout
74-
uses: actions/checkout@v3
75-
with:
76-
submodules: true
77-
- name: Build Standard app
78-
shell: bash -l {0}
79-
run: make
80-
81-
build_ledger_nano_SP:
82-
needs: configure
83-
runs-on: ubuntu-latest
84-
container:
85-
image: zondax/ledger-app-builder:latest
86-
options: --user ${{ needs.configure.outputs.uid_gid }}
87-
env:
88-
BOLOS_SDK: /opt/nanosplus-secure-sdk
89-
steps:
90-
- name: Checkout
91-
uses: actions/checkout@v3
92-
with:
93-
submodules: true
94-
- name: Build Standard app
95-
shell: bash -l {0}
96-
run: make
97-
98-
build_ledger_stax:
99-
needs: configure
100-
runs-on: ubuntu-latest
101-
container:
102-
image: zondax/ledger-app-builder:latest
103-
options: --user ${{ needs.configure.outputs.uid_gid }}
104-
env:
105-
BOLOS_SDK: /opt/stax-secure-sdk
106-
steps:
107-
- name: Checkout
108-
uses: actions/checkout@v3
109-
with:
110-
submodules: true
111-
- name: Build Standard app
112-
shell: bash -l {0}
113-
run: make
61+
echo "LNS app size: ${{needs.build_ledger.outputs.size}} KiB"
62+
[ ${{needs.build_ledger.outputs.size}} -le $NANOS_LIMIT_SIZE ]
11463
11564
test_zemu:
11665
runs-on: ubuntu-latest
117-
timeout-minutes: 30
11866
steps:
67+
- name: Test
68+
run: |
69+
id
70+
echo $HOME
71+
echo $DISPLAY
11972
- name: Checkout
120-
uses: actions/checkout@v3
73+
uses: actions/checkout@v4
12174
with:
12275
submodules: true
12376
- run: sudo apt-get update -y && sudo apt-get install -y libusb-1.0.0 libudev-dev
12477
- name: Install node
12578
uses: actions/setup-node@v3
12679
- name: Install yarn
127-
run: npm install -g yarn
80+
run: |
81+
npm install -g yarn
12882
- name: Build Ledger app and run tests
12983
run: make test_all
84+
- name: Upload Snapshots (only failure)
85+
if: ${{ failure() }}
86+
uses: actions/upload-artifact@v3
87+
with:
88+
name: snapshots-tmp
89+
path: tests_zemu/snapshots-tmp/
13090

13191
build_package_nanos:
132-
needs:
133-
[
134-
configure,
135-
cpp_test,
136-
build_ledger_nano_S,
137-
build_ledger_nano_X,
138-
build_ledger_nano_SP,
139-
build_ledger_stax,
140-
test_zemu,
141-
]
92+
needs: [configure, build, build_ledger, test_zemu]
14293
if: ${{ github.ref == 'refs/heads/main' }}
14394
runs-on: ubuntu-latest
14495
container:
@@ -148,7 +99,7 @@ jobs:
14899
BOLOS_SDK: /opt/nanos-secure-sdk
149100
steps:
150101
- name: Checkout
151-
uses: actions/checkout@v3
102+
uses: actions/checkout@v4
152103
with:
153104
submodules: true
154105
- name: Install deps
@@ -157,7 +108,7 @@ jobs:
157108
- name: Build NanoS
158109
shell: bash -l {0}
159110
run: |
160-
make
111+
PRODUCTION_BUILD=0 make
161112
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos.sh
162113
- name: Set tag
163114
id: nanos
@@ -173,17 +124,8 @@ jobs:
173124
draft: false
174125
prerelease: false
175126

176-
build_package_nanos_plus:
177-
needs:
178-
[
179-
configure,
180-
cpp_test,
181-
build_ledger_nano_S,
182-
build_ledger_nano_X,
183-
build_ledger_nano_SP,
184-
build_ledger_stax,
185-
test_zemu,
186-
]
127+
build_package_nanosp:
128+
needs: [configure, build, build_ledger, test_zemu]
187129
if: ${{ github.ref == 'refs/heads/main' }}
188130
runs-on: ubuntu-latest
189131
container:
@@ -193,7 +135,7 @@ jobs:
193135
BOLOS_SDK: /opt/nanosplus-secure-sdk
194136
steps:
195137
- name: Checkout
196-
uses: actions/checkout@v3
138+
uses: actions/checkout@v4
197139
with:
198140
submodules: true
199141
- name: Install deps
@@ -202,7 +144,7 @@ jobs:
202144
- name: Build NanoSP
203145
shell: bash -l {0}
204146
run: |
205-
make
147+
PRODUCTION_BUILD=0 make
206148
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanos_plus.sh
207149
- name: Set tag
208150
id: nanosp
@@ -219,16 +161,7 @@ jobs:
219161
prerelease: false
220162

221163
build_package_stax:
222-
needs:
223-
[
224-
configure,
225-
cpp_test,
226-
build_ledger_nano_S,
227-
build_ledger_nano_X,
228-
build_ledger_nano_SP,
229-
build_ledger_stax,
230-
test_zemu,
231-
]
164+
needs: [configure, build, build_ledger, test_zemu]
232165
if: ${{ github.ref == 'refs/heads/main' }}
233166
runs-on: ubuntu-latest
234167
container:
@@ -238,15 +171,16 @@ jobs:
238171
BOLOS_SDK: /opt/stax-secure-sdk
239172
steps:
240173
- name: Checkout
241-
uses: actions/checkout@v3
174+
uses: actions/checkout@v4
242175
with:
243176
submodules: true
244177
- name: Install deps
245178
run: pip install ledgerblue
246179

247180
- name: Build Stax
248181
shell: bash -l {0}
249-
run: make
182+
run: |
183+
PRODUCTION_BUILD=0 make
250184
- name: Set tag
251185
id: stax
252186
run: echo "tag_name=$(./app/pkg/installer_stax.sh version)" >> $GITHUB_OUTPUT
@@ -256,7 +190,44 @@ jobs:
256190
env:
257191
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
258192
with:
259-
files: ./app/pkg/installer_stax.sh
193+
files: |
194+
./app/pkg/installer_stax.sh
260195
tag_name: ${{ steps.stax.outputs.tag_name }}
261196
draft: false
262197
prerelease: false
198+
199+
build_package_flex:
200+
needs: [configure, build, build_ledger, test_zemu]
201+
if: ${{ github.ref == 'refs/heads/main' }}
202+
runs-on: ubuntu-latest
203+
container:
204+
image: zondax/ledger-app-builder:latest
205+
options: --user ${{ needs.configure.outputs.uid_gid }}
206+
env:
207+
BOLOS_SDK: /opt/flex-secure-sdk
208+
steps:
209+
- name: Checkout
210+
uses: actions/checkout@v4
211+
with:
212+
submodules: true
213+
- name: Install deps
214+
run: pip install ledgerblue
215+
216+
- name: Build Flex
217+
shell: bash -l {0}
218+
run: |
219+
PRODUCTION_BUILD=0 make
220+
- name: Set tag
221+
id: flex
222+
run: echo "tag_name=$(./app/pkg/installer_flex.sh version)" >> $GITHUB_OUTPUT
223+
- name: Update Release
224+
id: update_release_2
225+
uses: softprops/action-gh-release@v1
226+
env:
227+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
228+
with:
229+
files: |
230+
./app/pkg/installer_flex.sh
231+
tag_name: ${{ steps.flex.outputs.tag_name }}
232+
draft: false
233+
prerelease: false

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "deps/nanos-secure-sdk"]
22
path = deps/nanos-secure-sdk
3-
url = https://github.com/LedgerHQ/nanos-secure-sdk.git
3+
url = https://github.com/LedgerHQ/ledger-secure-sdk.git
44
[submodule "deps/picohash"]
55
path = deps/picohash
66
url = https://github.com/kazuho/picohash

CMakeLists.txt

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@
1414
#* limitations under the License.
1515
#********************************************************************************
1616
cmake_minimum_required(VERSION 3.0)
17+
include("cmake/HunterGate.cmake")
18+
HunterGate(
19+
URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
20+
SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
21+
LOCAL
22+
)
23+
1724
project(ledger-internet-computer VERSION 0.0.0)
1825
enable_testing()
1926

2027
cmake_policy(SET CMP0025 NEW)
2128
set(CMAKE_CXX_STANDARD 11)
2229

30+
set(HUNTER_STATUS_DEBUG ON)
31+
set(HUNTER_TLS_VERIFY OFF)
32+
2333
option(ENABLE_FUZZING "Build with fuzzing instrumentation and build fuzz targets" OFF)
2434
option(ENABLE_COVERAGE "Build with source code coverage instrumentation" OFF)
2535
option(ENABLE_SANITIZERS "Build with ASAN and UBSAN" OFF)
@@ -30,6 +40,13 @@ string(APPEND CMAKE_LINKER_FLAGS " -fno-omit-frame-pointer -g")
3040

3141
add_definitions(-DAPP_STANDARD)
3242

43+
hunter_add_package(fmt)
44+
find_package(fmt CONFIG REQUIRED)
45+
hunter_add_package(jsoncpp)
46+
find_package(jsoncpp CONFIG REQUIRED)
47+
hunter_add_package(GTest)
48+
find_package(GTest CONFIG REQUIRED)
49+
3350
if (ENABLE_FUZZING)
3451
add_definitions(-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION=1)
3552
SET(ENABLE_SANITIZERS ON CACHE BOOL "Sanitizer automatically enabled" FORCE)
@@ -71,9 +88,6 @@ if (ENABLE_SANITIZERS)
7188
string(APPEND CMAKE_LINKER_FLAGS " -fsanitize=address,undefined -fsanitize-recover=address,undefined")
7289
endif ()
7390

74-
include(cmake/conan/CMakeLists.txt)
75-
add_subdirectory(cmake/gtest)
76-
7791
string(APPEND CMAKE_CXX_FLAGS " -fsanitize=address -fno-omit-frame-pointer")
7892
string(APPEND CMAKE_LINKER_FLAGS " -fsanitize=address -fno-omit-frame-pointer")
7993

@@ -128,10 +142,6 @@ file(GLOB_RECURSE TESTS_SRC
128142

129143
add_executable(unittests ${TESTS_SRC})
130144
target_include_directories(unittests PRIVATE
131-
${gtest_SOURCE_DIR}/include
132-
${gmock_SOURCE_DIR}/include
133-
${CONAN_INCLUDE_DIRS_FMT}
134-
${CONAN_INCLUDE_DIRS_JSONCPP}
135145
${CMAKE_CURRENT_SOURCE_DIR}/app/src
136146
${CMAKE_CURRENT_SOURCE_DIR}/app/src/lib
137147
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinycbor/src
@@ -140,13 +150,13 @@ target_include_directories(unittests PRIVATE
140150

141151

142152
target_link_libraries(unittests PRIVATE
143-
gtest_main
153+
GTest::gtest_main
144154
app_lib
145-
CONAN_PKG::fmt
146-
CONAN_PKG::jsoncpp)
155+
fmt::fmt
156+
JsonCpp::JsonCpp)
147157

148158
add_compile_definitions(TESTVECTORS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/")
149-
add_test(unittests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittests)
159+
add_test(NAME unittests COMMAND unittests)
150160
set_tests_properties(unittests PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)
151161

152162
##############################################################

0 commit comments

Comments
 (0)