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

Support Textual Mode & improvements #37

Merged
merged 108 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
55e7cd1
update submodules
chcmedeiros Nov 2, 2022
fd72ffa
add cbor library
chcmedeiros Nov 10, 2022
2fa7477
add sonarcloud
chcmedeiros Dec 5, 2022
c707129
update logo and docs
chcmedeiros Dec 14, 2022
6b62aeb
add textual mode parser support
chcmedeiros Dec 14, 2022
f731088
add textual mode testing support
chcmedeiros Dec 14, 2022
dd06ca1
update snapshots
chcmedeiros Dec 14, 2022
34b485e
disable sonarcloud
chcmedeiros Dec 19, 2022
ee693d1
Merge pull request #75 from cosmos/dev_sign_mode_textual
chcmedeiros Dec 19, 2022
305cabe
add testcase for MsgSetWithdrawAddress
ftheirs Jan 2, 2023
5f22b2b
add testcase for CLI gov deposit
ftheirs Jan 2, 2023
23b8696
extraDepthLevel doesn't depend in list order
ftheirs Jan 2, 2023
c60de9c
update version and Zemu tests
ftheirs Jan 2, 2023
f905876
update zxlib
ftheirs Jan 2, 2023
9a78592
Merge pull request #77 from cosmos/dev
ftheirs Jan 3, 2023
ddae659
support title truncation and individual title and content cbor fields
chcmedeiros Jan 25, 2023
91d60df
update tests
chcmedeiros Jan 25, 2023
922c3ea
update snapshots
chcmedeiros Jan 25, 2023
157b1fa
Merge pull request #78 from cosmos/dev_textual_title_truncation
chcmedeiros Jan 27, 2023
71e49e8
fix textual mode
chcmedeiros Feb 15, 2023
10c631e
add multisend test and paralelize-zemu
chcmedeiros Mar 8, 2023
778407d
updates
chcmedeiros Mar 8, 2023
7d7698d
support array of containers inside struct
chcmedeiros Mar 8, 2023
12514b3
update snapshots
chcmedeiros Mar 8, 2023
4b1721d
update makefile
chcmedeiros Mar 16, 2023
431a9c6
Merge pull request #82 from cosmos/dev
ftheirs Mar 16, 2023
f51ae06
update actions
ftheirs Mar 16, 2023
e24a884
Merge pull request #83 from cosmos/dev
ftheirs Mar 17, 2023
3dfe7a0
update standards tests
chcmedeiros Mar 27, 2023
67d3a96
bump version & update snapshots
chcmedeiros Mar 27, 2023
b470589
Merge pull request #84 from cosmos/dev
ftheirs Mar 27, 2023
99c57e3
Merge branch 'develop' into dev
chcmedeiros Mar 27, 2023
4723471
bump version & update snapshots
chcmedeiros Mar 27, 2023
f9ffd32
Merge pull request #86 from cosmos/dev
chcmedeiros Mar 27, 2023
f21f205
update submodules
chcmedeiros May 2, 2023
5823c7b
add support for eth path
chcmedeiros May 3, 2023
52e8991
cleanup and fix clang warning
chcmedeiros May 3, 2023
5164353
update zemu
chcmedeiros May 3, 2023
ce7e809
update snapshots
chcmedeiros May 3, 2023
b2a98d0
improvements
chcmedeiros May 4, 2023
f7b86a0
update actions
ftheirs Apr 3, 2023
17d2665
add eth path display and expert mode required
chcmedeiros May 10, 2023
37718f8
update zemu
chcmedeiros May 11, 2023
ed9cbe2
update zxlib
chcmedeiros May 11, 2023
4e30a55
update snapshots
chcmedeiros May 11, 2023
f107db1
Merge pull request #89 from cosmos/evm-path-support
ftheirs May 15, 2023
5a7c3cf
add some checks
ftheirs May 18, 2023
74b821e
update deps
ftheirs May 18, 2023
4cf470b
bump version
ftheirs May 18, 2023
cd3217f
Merge pull request #90 from cosmos/fixes
ftheirs May 18, 2023
9b797ee
implement EVM addresses
ftheirs May 23, 2023
c8e8167
cpp test for EVM addresses
ftheirs May 23, 2023
6380a2f
update zemu tests
ftheirs May 23, 2023
5e26ff8
update zxlib & bump version
ftheirs May 23, 2023
f8e26f7
Create SECURITY.md
greg-szabo Apr 13, 2023
d532a94
Merge pull request #91 from cosmos/fix_evm_address
ftheirs May 23, 2023
fb90358
add checks and fix warnings
ftheirs May 25, 2023
201e322
bump version
ftheirs May 25, 2023
29acf41
Merge pull request #92 from cosmos/improvements
ftheirs May 25, 2023
c1b8437
restrict EVM path
ftheirs Jun 8, 2023
6f22df2
update zemu tests
ftheirs Jun 8, 2023
4518d86
bump version
ftheirs Jun 8, 2023
99df548
Merge pull request #93 from cosmos/restriction_evm
ftheirs Jun 13, 2023
8af442f
Merge remote-tracking branch 'remote_ledger/develop' into textual_pr
ftheirs Aug 15, 2023
be550d7
Merge pull request #94 from cosmos/textual_pr
ftheirs Aug 23, 2023
7c1b3eb
fix fuzzer and tests
chcmedeiros Sep 5, 2023
b08d8b4
update version and snapshots
chcmedeiros Sep 12, 2023
cf1eff7
fixing global variables and redundant checks
chcmedeiros Sep 12, 2023
6c6fb9f
fix functions return types
chcmedeiros Sep 12, 2023
09dd6bc
restriction of chain-id values
chcmedeiros Sep 13, 2023
3c05a83
fix bool returns and argument validation
chcmedeiros Sep 15, 2023
70676ed
Merge pull request #95 from cosmos/dev
chcmedeiros Sep 15, 2023
bc67593
add evmos to allowed chain id
chcmedeiros Sep 18, 2023
0105338
update tests & snapshots
chcmedeiros Sep 18, 2023
0e7a871
Merge pull request #98 from cosmos/dev
ftheirs Sep 19, 2023
6205ae8
Merge pull request #27 from cosmos/main
xchapron-ledger Sep 25, 2023
d5a17c6
Update README.md
ainhoa-a Sep 29, 2023
a67b046
Merge pull request #99 from cosmos/ainhoa-a-readme
ainhoa-a Sep 29, 2023
356b8b7
remove unnecesary file from cbor library
ftheirs Nov 10, 2023
fd6b715
update deps
ftheirs Nov 10, 2023
829a637
bump version & update snapshots
ftheirs Nov 10, 2023
df5b43b
Merge pull request #104 from cosmos/dev
ftheirs Nov 10, 2023
1a63982
update Stax icon
ftheirs Nov 11, 2023
06940fb
bump version & update snapshots
ftheirs Nov 11, 2023
a77e98e
update deps
ftheirs Nov 28, 2023
697dbd7
Merge pull request #105 from cosmos/dev
ftheirs Nov 28, 2023
748a646
[auto]: add PR template
sgliner-ledger Nov 29, 2023
fa05382
bump version & update snapshots
ftheirs Dec 29, 2023
4783d05
update deps & fix warning
ftheirs Dec 29, 2023
80fa74d
Merge pull request #106 from cosmos/dev
ftheirs Dec 29, 2023
5cdf3cf
Merge remote-tracking branch 'remote_ledger/develop' into dev2
ftheirs Jan 3, 2024
3bf034b
bump version & update snapshots
ftheirs Jan 3, 2024
0c768a3
Merge pull request #107 from cosmos/dev
ftheirs Jan 3, 2024
d3b91bb
improvements
ftheirs Jan 10, 2024
975e75c
bump version & update snapshots
ftheirs Jan 10, 2024
8e751a7
improve UI for gas limit
ftheirs Jan 10, 2024
25096fa
Merge pull request #108 from cosmos/dev
ftheirs Jan 11, 2024
6e97d37
Merge pull request #23 from LedgerHQ/develop
chcmedeiros Mar 4, 2024
4fe6c04
Merge pull request #28 from LedgerHQ/tdj/2.34.12
chcmedeiros Mar 4, 2024
723d714
update deps
chcmedeiros Mar 1, 2024
46e3e5b
add all ethermint chains
chcmedeiros Mar 1, 2024
714937a
use oneshot hashes
chcmedeiros Mar 1, 2024
a0bd37d
update zemu
chcmedeiros Mar 1, 2024
e0af516
increase nanoS tokens
chcmedeiros Mar 5, 2024
8cd6c6e
remove textual support from NanoS
chcmedeiros Mar 12, 2024
eb96c35
update zemu
chcmedeiros Mar 12, 2024
e0addc1
Merge pull request #112 from cosmos/tokens-textual
chcmedeiros Mar 12, 2024
cfcd682
Merge remote-tracking branch 'origin2/develop' into helper
chcmedeiros Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 0 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Verify PRs to main
on:
workflow_dispatch:
pull_request:
paths:
- app/**
- deps/**
branches:
- main
- develop
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/guidelines_enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
with:
relative_app_directory: 'app'
57 changes: 57 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Sonarcloud

on:
push:
branches:
- disable
pull_request:
branches:
- disable
types: [opened, synchronize, reopened]

jobs:
build:
name: SonarQube analyze
runs-on: ubuntu-latest
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder@sha256:877adc3ff619222aaf03a490d546ea9001f02faa0c6ac7c06c876c99584f9cdb
env:
SONAR_SCANNER_VERSION: 4.7.0.2747
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
apt-get update -y
apt-get upgrade -y
curl -sL https://deb.nodesource.com/setup_16.x | bash -
apt-get install -y gcovr nodejs unzip
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
env:
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
run: |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Run build-wrapper
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make clean all
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ cmake-build-fuzz/
!\deps/nanox-secure-sdk
!\deps/ledger-zxlib
!\deps/tinycbor
!\deps/tinycbor-ledger
!\deps/BLAKE

app/src/glyphs.c
Expand Down
17 changes: 17 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Path to sources
# sonar.sources=
# sonar.exclusions=
# sonar.inclusions=

# Path to tests
# sonar.tests=
# sonar.test.exclusions=
# sonar.test.inclusions=

# Source encoding
# sonar.sourceEncoding=

# Exclusions for copy-paste detection
# sonar.cpd.exclusions=
# Python version (for python projects only)
# sonar.python.version=
13 changes: 11 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ string(APPEND CMAKE_LINKER_FLAGS " -fsanitize=address -fno-omit-frame-pointer")
##############################################################
# static libs
file(GLOB_RECURSE JSMN_SRC
deps/jsmn/src/jsmn.c
${CMAKE_CURRENT_SOURCE_DIR}/deps/jsmn/src/jsmn.c
)
file(GLOB_RECURSE TINYCBOR_SRC
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinycbor/src/cborparser.c
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinycbor/src/cborvalidation.c
)

file(GLOB_RECURSE LIB_SRC
Expand All @@ -98,6 +102,7 @@ file(GLOB_RECURSE LIB_SRC
${CMAKE_CURRENT_SOURCE_DIR}/app/src/formatting.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/parser_impl.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/json/json_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/cbor/cbor_parser_helper.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/tx_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/tx_display.c
${CMAKE_CURRENT_SOURCE_DIR}/app/src/tx_validate.c
Expand All @@ -107,6 +112,7 @@ file(GLOB_RECURSE LIB_SRC
add_library(app_lib STATIC
${LIB_SRC}
${JSMN_SRC}
${TINYCBOR_SRC}
)

target_include_directories(app_lib PUBLIC
Expand All @@ -115,7 +121,8 @@ target_include_directories(app_lib PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/app/src
${CMAKE_CURRENT_SOURCE_DIR}/app/src/common
${CMAKE_CURRENT_SOURCE_DIR}/deps/ledger-zxlib/app/common
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinykeccak
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinycbor/src
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinykeccak/
)

target_link_libraries(app_lib PUBLIC)
Expand All @@ -133,6 +140,7 @@ target_include_directories(unittests PRIVATE
${CONAN_INCLUDE_DIRS_FMT}
${CONAN_INCLUDE_DIRS_JSONCPP}
${CMAKE_CURRENT_SOURCE_DIR}/deps/jsmn/src
${CMAKE_CURRENT_SOURCE_DIR}/deps/tinycbor/src
)

target_link_libraries(unittests PRIVATE
Expand All @@ -143,6 +151,7 @@ target_link_libraries(unittests PRIVATE

add_compile_definitions(TESTVECTORS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/")
add_compile_definitions(APP_TESTING=1)
add_compile_definitions(COMPILE_TEXTUAL=1)
add_test(unittests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittests)
set_tests_properties(unittests PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests)

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@

---

![zondax](docs/zondax.jpg)
![zondax_light](docs/zondax_light.png#gh-light-mode-only)
![zondax_dark](docs/zondax_dark.png#gh-dark-mode-only)

_Please visit our website at [zondax.ch](zondax.ch)_

You can also visit [Zondax Hub](https://hub.zondax.ch/cosmos) to test any of the versions of the app

---

This project contains the Cosmos app for Ledger Nano S and X.
This project contains the Cosmos app for Ledger Nano S, Nano S+, X and Stax.

- Ledger Nano S/X Cosmos app
- Ledger Nano S/S+/X/Stax Cosmos app
- Specs / Documentation
- C++ unit tests
- Zemu tests
Expand Down Expand Up @@ -202,5 +205,8 @@ The Makefile will build the firmware in a docker container and leave the binary

## APDU Specifications

### DISCLAIMER
Ledger NanoS does not support Cosmos Textual Mode due to memory restriction

- [APDU Protocol](docs/APDUSPEC.md)
- [Transaction format](docs/TXSPEC.md)
79 changes: 79 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Coordinated Vulnerability Disclosure Policy

The Cosmos ecosystem believes that strong security is a blend of highly
technical security researchers who care about security and the forward
progression of the ecosystem and the attentiveness and openness of Cosmos core
contributors to help continually secure our operations.

> **IMPORTANT**: *DO NOT* open public issues on this repository for security
> vulnerabilities.

## Scope

| Scope |
|-----------------------|
| last release (tagged) |
| main branch |

The latest **release tag** of this repository is supported for security updates
as well as the **main** branch. Security vulnerabilities should be reported if
the vulnerability can be reproduced on either one of those.

## Reporting a Vulnerability

| Reporting methods |
|---------------------------------------------------------------|
| [GitHub Private Vulnerability Reporting][gh-private-advisory] |
| [HackerOne bug bounty program][h1] |

All security vulnerabilities can be reported under GitHub's [Private
vulnerability reporting][gh-private-advisory] system. This will open a private
issue for the developers. Try to fill in as much of the questions as possible.
If you are not familiar with the CVSS system for assessing vulnerabilities, just
use the Low/High/Critical severity ratings. A partially filled in report for a
critical vulnerability is still better than no report at all.

Vulnerabilities associated with the **Go, Rust or Protobuf code** of the
repository may be eligible for a [bug bounty][h1]. Please see the bug bounty
page for more details on submissions and rewards. If you think the vulnerability
is eligible for a payout, **report on HackerOne first**.

Vulnerabilities in services and their source codes (JavaScript, web page, Google
Workspace) are not in scope for the bug bounty program, but they are welcome to
be reported in GitHub.

### Guidelines

We require that all researchers:

* Abide by this policy to disclose vulnerabilities, and avoid posting
vulnerability information in public places, including GitHub, Discord,
Telegram, and Twitter.
* Make every effort to avoid privacy violations, degradation of user experience,
disruption to production systems (including but not limited to the Cosmos
Hub), and destruction of data.
* Keep any information about vulnerabilities that you’ve discovered confidential
between yourself and the Cosmos engineering team until the issue has been
resolved and disclosed.
* Avoid posting personally identifiable information, privately or publicly.

If you follow these guidelines when reporting an issue to us, we commit to:

* Not pursue or support any legal action related to your research on this
vulnerability
* Work with you to understand, resolve and ultimately disclose the issue in a
timely fashion

### More information

* See [TIMELINE.md] for an example timeline of a disclosure.
* See [DISCLOSURE.md] to see more into the inner workings of the disclosure
process.
* See [EXAMPLES.md] for some of the examples that we are interested in for the
bug bounty program.

[gh-private-advisory]: /../../security/advisories/new
[h1]: https://hackerone.com/cosmos
[TIMELINE.md]: https://github.com/cosmos/security/blob/main/TIMELINE.md
[DISCLOSURE.md]: https://github.com/cosmos/security/blob/main/DISCLOSURE.md
[EXAMPLES.md]: https://github.com/cosmos/security/blob/main/EXAMPLES.md
18 changes: 11 additions & 7 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,25 @@ APP_LOAD_PARAMS = --curve secp256k1 $(COMMON_LOAD_PARAMS) --path $(APPPATH)

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.devices

# On zxlib v19.7.1, Makefile.devices will set a default value for APP_STACK_SIZE
# to follow the most recent nanos-secure-sdk rules we will clean APP_STACK_SIZE value
# and set a minimum value
APP_STACK_SIZE :=
APP_STACK_MIN_SIZE := 1444

$(info TARGET_NAME = [$(TARGET_NAME)])
$(info ICONNAME = [$(ICONNAME)])

ifndef ICONNAME
$(error ICONNAME is not set)
endif

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.platform
# Compile textual mode for all devices excetpt Nano S,
# and define a Min stack size for Nano S with some margin
# to get an error if app grows too much
ifneq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += COMPILE_TEXTUAL
endif

APP_STACK_MIN_SIZE := 1600

include $(CURDIR)/../deps/ledger-zxlib/makefiles/Makefile.platform
CFLAGS += -I$(MY_DIR)/../deps/tinycbor/src
APP_SOURCE_PATH += $(MY_DIR)/../deps/tinycbor-ledger
APP_SOURCE_PATH += $(MY_DIR)/../deps/jsmn/src

.PHONY: rust
Expand Down
4 changes: 2 additions & 2 deletions app/Makefile.version
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is the `transaction_version` field of `Runtime`
APPVERSION_M=2
# This is the `spec_version` field of `Runtime`
APPVERSION_N=34
APPVERSION_N=35
# This is the patch version of this release
APPVERSION_P=14
APPVERSION_P=19
Binary file modified app/glyphs/icon_stax_32.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/glyphs/icon_stax_64.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading