diff --git a/README.md b/README.md index ac34f34..16939ce 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,208 @@ -# ledger-app-celo +[![Ensure compliance with Ledger guidelines](https://github.com/blooo-io/app-celo-spender/actions/workflows/guidelines_enforcer.yml/badge.svg)](https://github.com/blooo-io/app-celo-spender/actions/workflows/guidelines_enforcer.yml) [![Build and run functional tests using ragger through reusable workflow](https://github.com/blooo-io/app-celo-spender/actions/workflows/build_and_functional_tests.yml/badge.svg?branch=master)](https://github.com/blooo-io/app-celo-spender/actions/workflows/build_and_functional_tests.yml) -Celo wallet application framework for Ledger Blue, Nano S and Nano X +# Celo app for Ledger Wallet -This follows the specification available in the doc/ folder +This app adds support for the Celo native token for the Ledger Nano S/X/SP and Stax. -For more information about the parsing framework you can refer to +## Quick start guide + +### With VSCode + +You can quickly setup a convenient environment to build and test your application by using the vscode integration and the [ledger-app-dev-tools](https://github.com/LedgerHQ/ledger-app-builder/pkgs/container/ledger-app-builder%2Fledger-app-dev-tools) docker image. + +It will allow you, whether you are developing on macOS, Windows or Linux to quickly **build** your apps, **test** them on **Speculos** and **load** them on any supported device. + +1. Install & run Docker. +2. Make sure you have an X11 server running : + - On Ubuntu Linux, it should be running by default. + - On macOS, install and launch [XQuartz](https://www.xquartz.org/) (make sure to go to XQuartz > Preferences > Security and check "Allow client connections"). + - On Windows, install and launch [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (make sure to configure it to disable access control). +3. Open a terminal and clone `app-celo-spender` with `git clone https://github.com/blooo-io/app-celo-spender.git`. +4. Install [VScode](https://code.visualstudio.com/download) and add [Ledger's extension](https://marketplace.visualstudio.com/items?itemName=LedgerHQ.ledger-dev-tools). +5. Open the `app-celo-spender` folder with VSCode. +6. Use Ledger extension's sidebar menu or open the tasks menu with `ctrl + shift + b` (`command + shift + b` on a Mac) to conveniently execute actions : + - Build the app for the device model of your choice with `Build`. + - Test your binary on [Speculos](https://github.com/LedgerHQ/speculos) with `Run with Speculos`. + - You can also run functional tests, load the app on a physical device, and more. + +:information_source: The terminal tab of VSCode will show you what commands the extension runs behind the scene. + +### With a terminal + +The [ledger-app-dev-tools](https://github.com/LedgerHQ/ledger-app-builder/pkgs/container/ledger-app-builder%2Fledger-app-dev-tools) docker image contains all the required tools and libraries to **build**, **test** and **load** an application. + +You can download it from the ghcr.io docker repository: + +```shell +sudo docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest +``` + +You can then enter this development environment by executing the following command from the directory of the application `git` repository: + +**Linux (Ubuntu)** + +```shell +sudo docker run --rm -ti --user "$(id -u):$(id -g)" --privileged -v "/dev/bus/usb:/dev/bus/usb" -v "$(realpath .):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest +``` + +**macOS** + +```shell +sudo docker run --rm -ti --user "$(id -u):$(id -g)" --privileged -v "$(pwd -P):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest +``` + +**Windows (with PowerShell)** + +```shell +docker run --rm -ti --privileged -v "$(Get-Location):/app" ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest +``` + +The application's code will be available from inside the docker container, you can proceed to the following compilation steps to build your app. + +## Compilation and load + +To easily setup a development environment for compilation and loading on a physical device, you can use the [VSCode integration](#with-vscode) whether you are on Linux, macOS or Windows. + +If you prefer using a terminal to perform the steps manually, you can use the guide below. + +### Compilation + +Setup a compilation environment by following the [shell with docker approach](#with-a-terminal). + +From inside the container, use the following command to build the app : + +```shell +make DEBUG=1 # compile optionally with PRINTF +``` + +You can choose which device to compile and load for by setting the `BOLOS_SDK` environment variable to the following values : + +- `BOLOS_SDK=$NANOX_SDK` +- `BOLOS_SDK=$NANOSP_SDK` +- `BOLOS_SDK=$STAX_SDK` + +By default this variable is set to build/load for Nano S. + +### Loading on a physical device + +This step will vary slightly depending on your platform. + +:information_source: Your physical device must be connected, unlocked and the screen showing the dashboard (not inside an application). + +**Linux (Ubuntu)** + +First make sure you have the proper udev rules added on your host : + +```shell +# Run these commands on your host, from the app's source folder. +sudo cp .vscode/20-ledger.ledgerblue.rules /etc/udev/rules.d/ +sudo udevadm control --reload-rules +sudo udevadm trigger +``` + +Then once you have [opened a terminal](#with-a-terminal) in the `app-builder` image and [built the app](#compilation-and-load) for the device you want, run the following command : + +```shell +# Run this command from the app-builder container terminal. +make load # load the app on a Nano S by default +``` + +[Setting the BOLOS_SDK environment variable](#compilation-and-load) will allow you to load on whichever supported device you want. + +**macOS / Windows (with PowerShell)** + +:information_source: It is assumed you have [Python](https://www.python.org/downloads/) installed on your computer. + +Run these commands on your host from the app's source folder once you have [built the app](#compilation-and-load) for the device you want : + +```shell +# Install Python virtualenv +python3 -m pip install virtualenv +# Create the 'ledger' virtualenv +python3 -m virtualenv ledger +``` + +Enter the Python virtual environment + +- macOS : `source ledger/bin/activate` +- Windows : `.\ledger\Scripts\Activate.ps1` + +```shell +# Install Ledgerblue (tool to load the app) +python3 -m pip install ledgerblue +# Load the app. +python3 -m ledgerblue.runScript --scp --fileName bin/app.apdu --elfFile bin/app.elf +``` + +## Test + +The Celo app comes with functional tests implemented with Ledger's [Ragger](https://github.com/LedgerHQ/ragger) test framework. + +### macOS / Windows + +To test your app on macOS or Windows, it is recommended to use [Ledger's VS Code extension](#with-vscode) to quickly setup a working test environment. + +You can use the following sequence of tasks and commands (all accessible in the **extension sidebar menu**) : + +- `Select build target` +- `Build app` + +Then you can choose to execute the functional tests : + +- Use `Run tests`. + +Or simply run the app on the Speculos emulator : + +- `Run with Speculos`. + +### Linux (Ubuntu) + +On Linux, you can use [Ledger's VS Code extension](#with-vscode) to run the tests. If you prefer not to, open a terminal and follow the steps below. + +Install the tests requirements : + +```shell +pip install -r tests/requirements.txt +``` + +Then you can : + +Run the functional tests (here for nanox but available for any device once you have built the binaries) : + +```shell +pytest tests/ --tb=short -v --device nanox +``` + +Or run your app directly with Speculos + +```shell +speculos --model nanox build/nanox/bin/app.elf +``` + +## Documentation + +High level documentation such as [application specification](APP_SPECIFICATION.md), [APDU](doc/APDU.md) and [transaction serialization](doc/TRANSACTION.md) are included in developer documentation which can be generated with [doxygen](https://www.doxygen.nl) + +```shell +doxygen .doxygen/Doxyfile +``` + +the process outputs HTML and LaTeX documentations in `doc/html` and `doc/latex` folders. + +## Continuous Integration + +The flow processed in [GitHub Actions](https://github.com/features/actions) is the following: + +- Ledger guidelines enforcer which verifies that an app is compliant with Ledger guidelines. The successful completion of this reusable workflow is a mandatory step for an app to be available on the Ledger application store. More information on the guidelines can be found in the repository [ledger-app-workflow](https://github.com/LedgerHQ/ledger-app-workflows) +- Code formatting with [clang-format](http://clang.llvm.org/docs/ClangFormat.html) +- Compilation of the application for all Ledger hardware in [ledger-app-builder](https://github.com/LedgerHQ/ledger-app-builder) +- Unit tests of C functions with [cmocka](https://cmocka.org/) (see [unit-tests/](unit-tests/)) +- End-to-end tests with [Speculos](https://github.com/LedgerHQ/speculos) emulator and [ragger](https://github.com/LedgerHQ/ragger) (see [tests/](tests/)) +- Code coverage with [gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html)/[lcov](http://ltp.sourceforge.net/coverage/lcov.php) and upload to [codecov.io](https://about.codecov.io) +- Documentation generation with [doxygen](https://www.doxygen.nl) + +It outputs 3 artifacts: + +- `compiled_app_binaries` within binary files of the build process for each device +- `code-coverage` within HTML details of code coverage +- `documentation` within HTML auto-generated documentation diff --git a/doc/ethapp.asc b/doc/ethapp.asc index 54fe2e2..de98760 100644 --- a/doc/ethapp.asc +++ b/doc/ethapp.asc @@ -1,40 +1,24 @@ -Ethereum application : Common Technical Specifications +Celo application : Common Technical Specifications ======================================================= -Ledger Firmware Team -Application version 1.1.10 - 4th of February 2019 - -## 1.0 - - Initial release - -## 1.1 - - Add GET APP CONFIGURATION - - Add an option to return the chain code in GET ETH PUBLIC ADDRESS - -## 1.2 - - Add SIGN ETH PERSONAL MESSAGE - -## 1.1.10 - - Add PROVIDE ERC 20 TOKEN INFORMATION ## About -This application describes the APDU messages interface to communicate with the Ethereum application. +This application describes the APDU messages interface to communicate with the Celo application. The application covers the following functionalities : - - Retrieve a public Ethereum address given a BIP 32 path - - Sign a basic Ethereum transaction given a BIP 32 path - - Provide callbacks to validate the data associated to an Ethereum transaction + - Retrieve a public Celo address given a BIP 32 path + - Sign Celo's Dynamic Fee Transaction v2 (#123) and Ethereum's Dynamic fee transaction (#2) given a BIP 32 path The application interface can be accessed over HID or BLE ## General purpose APDUs -### GET ETH PUBLIC ADDRESS +### GET CELO PUBLIC ADDRESS #### Description -This command returns the public key and Ethereum address for the given BIP 32 path. +This command returns the public key and Celo address for the given BIP 32 path. The address can be optionally checked on the device before being returned. @@ -71,17 +55,17 @@ The address can be optionally checked on the device before being returned. | *Description* | *Length* | Public Key length | 1 | Uncompressed Public Key | var -| Ethereum address length | 1 -| Ethereum address | var +| Celo address length | 1 +| Celo address | var | Chain code if requested | 32 |============================================================================================================================== -### SIGN ETH TRANSACTION +### SIGN CELO TRANSACTION #### Description -This command signs an Ethereum transaction after having the user validate the following parameters +This command signs an Celo transaction after having the user validate the following parameters - Gas price - Gas limit @@ -136,11 +120,11 @@ The input data is the RLP encoded transaction (as per https://github.com/ethereu -### SIGN ETH PERSONAL MESSAGE +### SIGN CELO PERSONAL MESSAGE #### Description -This command signs an Ethereum message following the personal_sign specification (https://github.com/ethereum/go-ethereum/pull/2940) after having the user validate the SHA-256 hash of the message being signed. +This command signs an Celo message following the personal_sign specification (https://github.com/ethereum/go-ethereum/pull/2940) after having the user validate the SHA-256 hash of the message being signed. This command has been supported since firmware version 1.0.8 diff --git a/doc/provideERC20TokenInformation.txt b/doc/provideERC20TokenInformation.txt new file mode 100644 index 0000000..228fd37 --- /dev/null +++ b/doc/provideERC20TokenInformation.txt @@ -0,0 +1,199 @@ +This file contains the data neccessary to use a different feeCurrency than Celo. Use the method provideERC20TokenInformation and give it the data_hex. + + +It's been parsed with a script from ledgerhq that can be found here: +https://github.com/LedgerHQ/ledger-live/blob/develop/libs/ledgerjs/packages/hw-app-eth/src/services/ledger/erc20.ts +(with the added data_b64 that's the base64 encoded data as well as data_hex, which is the same data hex encoded) + +[ + { + ticker: 'USDT', + address: '0x0e2a3e05bc9a16f5292a6170456a710cb89c6f72', + decimals: 18, + chainId: 42220, + signature: , + data: , + data_b64: 'BFVTRFQOKj4FvJoW9SkqYXBFanEMuJxvcgAAABIAAKTsMEUCICcPOwWqNYZjMUz/fxNfDDGPUwD+4vi4dze3PUd/0mS1AiEAnBLwRESTVC9V/sFr4u3RRK/b3O9uCQMHYVxMnYpSsGg=', + data_hex: '04555344540e2a3e05bc9a16f5292a6170456a710cb89c6f72000000120000a4ec30450220270f3b05aa358663314cff7f135f0c318f5300fee2f8b87737b73d477fd264b50221009c12f0444493542f55fec16be2edd144afdbdcef6e090307615c4c9d8a52b068' + }, + { + ticker: 'USDC', + address: '0x2f25deb3848c207fc8e0c34035b3ba7fc157602b', + decimals: 6, + chainId: 42220, + signature: , + data: , + data_b64: 'BFVTREMvJd6zhIwgf8jgw0A1s7p/wVdgKwAAAAYAAKTsMEYCIQDJhtfRA9zw5DPgg1rYjtvetl0OFIjsaNDU6/bxCmWMPgIhAJ9fKOeUTYA+ANtlquFLzx3qQOL7extlUmsMruoDMJsl', + data_hex: '04555344432f25deb3848c207fc8e0c34035b3ba7fc157602b000000060000a4ec3046022100c986d7d103dcf0e433e0835ad88edbdeb65d0e1488ec68d0d4ebf6f10a658c3e0221009f5f28e7944d803e00db65aae14bcf1dea40e2fb7b1b65526b0caeea03309b25' + }, + { + ticker: 'eXOF', + address: '0x73f93dcc49cb8a239e2032663e9475dd5ef29a08', + decimals: 18, + chainId: 42220, + signature: , + data: , + data_b64: 'BGVYT0Zz+T3MScuKI54gMmY+lHXdXvKaCAAAABIAAKTsMEQCIHHEWmzcwqB+9LOtubklEVNPXWXYSn/xNSW/4cO85OjgAiANgxkeJPJ9CNHVuFIaSvarVNmVt/x0EfDLryBeeBAI6w==', + data_hex: '0465584f4673f93dcc49cb8a239e2032663e9475dd5ef29a08000000120000a4ec3044022071c45a6cdcc2a07ef4b3adb9b92511534f5d65d84a7ff13525bfe1c3bce4e8e002200d83191e24f27d08d1d5b8521a4af6ab54d995b7fc7411f0cbaf205e781008eb' + }, + { + ticker: 'cUSD', + address: '0x765de816845861e75a25fca122bb6898b8b1282a', + decimals: 18, + chainId: 42220, + signature: , + data: , + data_b64: 'BGNVU0R2XegWhFhh51ol/KEiu2iYuLEoKgAAABIAAKTsMEQCIB+CF6YxC3i/5j9A52exQT50gEA2A0hvjTss/UqqhgdHAiBXfATMhNHgrZ00THO2JOD8NsY9Sl8zZUqwvNiSsGjnoQ==', + data_hex: '0463555344765de816845861e75a25fca122bb6898b8b1282a000000120000a4ec304402201f8217a6310b78bfe63f40e767b1413e7480403603486f8d3b2cfd4aaa8607470220577c04cc84d1e0ad9d344c73b624e0fc36c63d4a5f33654ab0bcd892b068e7a1' + }, + { + ticker: 'cEUR', + address: '0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73', + decimals: 18, + chainId: 42220, + signature: , + data: , + data_b64: 'BGNFVVLYdjy6J2o3OObehbSzv1/e1tbKcwAAABIAAKTsMEYCIQCM1m3U0ey+jAJ0SGTXjdJwK/6qb7UwsRGM2z5/40l20wIhAM6HDu2iWlKBnRUVuWNNsKrnqVUcdhnt6+cJpOxylBXt', + data_hex: '0463455552d8763cba276a3738e6de85b4b3bf5fded6d6ca73000000120000a4ec30460221008cd66dd4d1ecbe8c02744864d78dd2702bfeaa6fb530b1118cdb3e7fe34976d3022100ce870eeda25a52819d1515b9634db0aae7a9551c7619edebe709a4ec729415ed' + }, + { + ticker: 'cREAL', + address: '0xe8537a3d056da446677b9e9d6c5db704eaab4787', + decimals: 18, + chainId: 42220, + signature: , + data: , + data_b64: 'BWNSRUFM6FN6PQVtpEZne56dbF23BOqrR4cAAAASAACk7DBGAiEAy8JlGlVb7iEUAYf+gZ9ZXXBNOhZmLH+gAWw8kAQZ0p8CIQDcFLP0WORHbx2CmRBZpuCM7rlfgI/TCpv+JdqEvQsx1Q==', + data_hex: '05635245414ce8537a3d056da446677b9e9d6c5db704eaab4787000000120000a4ec3046022100cbc2651a555bee21140187fe819f595d704d3a16662c7fa0016c3c900419d29f022100dc14b3f458e4476f1d82991059a6e08ceeb95f808fd30a9bfe25da84bd0b31d5' + }, + { + ticker: 'b cUSD', + address: '0x62492a644a588fd904270bed06ad52b9abfea1ae', + decimals: 18, + chainId: 62320, + signature: , + data: , + data_b64: 'BmIgY1VTRGJJKmRKWI/ZBCcL7QatUrmr/qGuAAAAEgAA83AwRAIgD2TXuM3vFW3JtK9h34BLT7D9zFYvYT44aJS6p8UoedsCIHmYoDDo7Wukyz8XlsNzEBbWBbUH6LHI3zqpBNj+fSFJ', + data_hex: '0662206355534462492a644a588fd904270bed06ad52b9abfea1ae000000120000f370304402200f64d7b8cdef156dc9b4af61df804b4fb0fdcc562f613e386894baa7c52879db02207998a030e8ed6ba4cb3f1796c3731016d605b507e8b1c8df3aa904d8fe7d2149' + }, + { + ticker: 'b eXOF', + address: '0x64c1d812673e93bc036adc3d547d9950696da5af', + decimals: 18, + chainId: 62320, + signature: , + data: , + data_b64: 'BmIgZVhPRmTB2BJnPpO8A2rcPVR9mVBpbaWvAAAAEgAA83AwRQIhAKLkbcmR+iPIsw3UXjzTkLHV9paGINHrmh/Nl0Uu8dGzAiBg6qydAZZQaZdAfDCYUHNm89pii4NSts8PC0FXZlvhFg==', + data_hex: '06622065584f4664c1d812673e93bc036adc3d547d9950696da5af000000120000f3703045022100a2e46dc991fa23c8b30dd45e3cd390b1d5f6968620d1eb9a1fcd97452ef1d1b3022060eaac9d0196506997407c3098507366f3da628b8352b6cf0f0b4157665be116' + }, + { + ticker: 'b cREAL', + address: '0x6a0eef2bed4c30dc2cb42fe6c5f01f80f7ef16d1', + decimals: 18, + chainId: 62320, + signature: , + data: , + data_b64: 'B2IgY1JFQUxqDu8r7Uww3Cy0L+bF8B+A9+8W0QAAABIAAPNwMEUCIQCUrG7kT6y2FjlCBc4iJaTaUF8leam6l64fbcX0WWJmTgIgSAIwYwf6PBubwl7ny7WvK8OayCjOnmQKmJ/yIGc3vbs=', + data_hex: '076220635245414c6a0eef2bed4c30dc2cb42fe6c5f01f80f7ef16d1000000120000f370304502210094ac6ee44facb616394205ce2225a4da505f2579a9ba97ae1f6dc5f45962664e02204802306307fa3c1b9bc25ee7cbb5af2bc39ac828ce9e640a989ff2206737bdbb' + }, + { + ticker: 'b cEUR', + address: '0xf9ece301247ad2ce21894941830a2470f4e774ca', + decimals: 18, + chainId: 62320, + signature: , + data: , + data_b64: 'BmIgY0VVUvns4wEketLOIYlJQYMKJHD053TKAAAAEgAA83AwRAIgSPOsJ6UYsF4f9Bo8igrj9EjnAhnHfinGipGNmqTL57sCIAtZt0x7F+JRPHLRKxDcRRZW68mzURqPe0gZY+BNtcp7', + data_hex: '06622063455552f9ece301247ad2ce21894941830a2470f4e774ca000000120000f3703044022048f3ac27a518b05e1ff41a3c8a0ae3f448e70219c77e29c68a918d9aa4cbe7bb02200b59b74c7b17e2513c72d12b10dc451656ebc9b3511a8f7b481963e04db5ca7b' + }, + { + ticker: 'a G$', + address: '0x03d3dab843e6c03b3d271eff9178e6a96c28d25f', + decimals: 18, + chainId: 44787, + signature: , + data: , + data_b64: 'BGEgRyQD09q4Q+bAOz0nHv+ReOapbCjSXwAAABIAAK7zMEUCIQDfgt2nqTqyQgTgxYk2K16wwinC9nzWODCbvuyhsdCEvQIgM3yUbbIyjYyyfmL7CxLwovxQehY7EGFM5355FVDImLY=', + data_hex: '046120472403d3dab843e6c03b3d271eff9178e6a96c28d25f000000120000aef33045022100df82dda7a93ab24204e0c589362b5eb0c229c2f67cd638309bbeeca1b1d084bd0220337c946db2328d8cb27e62fb0b12f0a2fc507a163b10614ce77e791550c898b6' + }, + { + ticker: 'a cEUR', + address: '0x10c892a6ec43a53e45d0b916b4b7d383b1b78c0f', + decimals: 18, + chainId: 44787, + signature: , + data: , + data_b64: 'BmEgY0VVUhDIkqbsQ6U+RdC5FrS304Oxt4wPAAAAEgAArvMwRAIgLbVVXU772r3EnDYUyjs1v1fA1E5edUzv8kzeC6+1A2ECIBAnEpnJfMlFGPJ/MnGMcrA4W2H0dzODscv4IXAHyhW7', + data_hex: '0661206345555210c892a6ec43a53e45d0b916b4b7d383b1b78c0f000000120000aef3304402202db5555d4efbdabdc49c3614ca3b35bf57c0d44e5e754ceff24cde0bafb50361022010271299c97cc94518f27f32718c72b0385b61f4773383b1cbf8217007ca15bb' + }, + { + ticker: 'a EFC', + address: '0x1ad7b617cb6c5156a6dea6e47514d16476b99f38', + decimals: 6, + chainId: 44787, + signature: , + data: , + data_b64: 'BWEgRUZDGte2F8tsUVam3qbkdRTRZHa5nzgAAAAGAACu8zBFAiEA9PJF6MDUQuN0cODuMJKHYGInIla2Jy7mSJFghtCYRHACIFzp/maihqPCw8nI87yTqkThOUM4dFzMCHiZDabMBa1U', + data_hex: '0561204546431ad7b617cb6c5156a6dea6e47514d16476b99f38000000060000aef33045022100f4f245e8c0d442e37470e0ee3092876062272256b6272ee648916086d098447002205ce9fe66a286a3c2c3c9c8f3bc93aa44e1394338745ccc0878990da6cc05ad54' + }, + { + ticker: 'a USDC', + address: '0x4822e58de6f5e485ef90df51c41ce01721331dc0', + decimals: 6, + chainId: 44787, + signature: , + data: , + data_b64: 'BmEgVVNEQ0gi5Y3m9eSF75DfUcQc4BchMx3AAAAABgAArvMwRQIhAOl6woFCcqmCPPlMboyBPq5y7ZVIQBi+/agsk+oi8o8dAiBZqtGjVsV6RTdQynpkvv7aIQBpPC1T5vXl58B+qwmJZQ==', + data_hex: '066120555344434822e58de6f5e485ef90df51c41ce01721331dc0000000060000aef33045022100e97ac2814272a9823cf94c6e8c813eae72ed95484018befda82c93ea22f28f1d022059aad1a356c57a453750ca7a64befeda2100693c2d53e6f5e5e7c07eab098965' + }, + { + ticker: 'a EFC', + address: '0x7d027790998f714b294c96fda9e27af586d1ebb5', + decimals: 6, + chainId: 44787, + signature: , + data: , + data_b64: 'BWEgRUZDfQJ3kJmPcUspTJb9qeJ69YbR67UAAAAGAACu8zBFAiEA7UqR+TlX6jJz/f5fXpmPbzSk+DIkdGMPOE5MS2bmAk0CIBQhfBJgAHIePeTbAo916FTs+CyaeQP9qCPzurzHgg9U', + data_hex: '0561204546437d027790998f714b294c96fda9e27af586d1ebb5000000060000aef33045022100ed4a91f93957ea3273fdfe5f5e998f6f34a4f8322474630f384e4c4b66e6024d022014217c126000721e3de4db028f75e854ecf82c9a7903fda823f3babcc7820f54' + }, + { + ticker: 'a cUSD', + address: '0x874069fa1eb16d44d622f2e0ca25eea172369bc1', + decimals: 18, + chainId: 44787, + signature: , + data: , + data_b64: 'BmEgY1VTRIdAafoesW1E1iLy4Mol7qFyNpvBAAAAEgAArvMwRQIhAJRoALAvsAj11xSkYOCH4IfHMNXd7DGCRWxUY1LhM0psAiAXTIoz0+BDoOUQ8r+MKIJtG+Xd0N/QGeyHxXNBvuJ1YQ==', + data_hex: '06612063555344874069fa1eb16d44d622f2e0ca25eea172369bc1000000120000aef33045022100946800b02fb008f5d714a460e087e087c730d5ddec3182456c546352e1334a6c0220174c8a33d3e043a0e510f2bf8c28826d1be5ddd0dfd019ec87c57341bee27561' + }, + { + ticker: 'a eXOF', + address: '0xb0fa15e002516d0301884059c0aac0f0c72b019d', + decimals: 18, + chainId: 44787, + signature: , + data: , + data_b64: 'BmEgZVhPRrD6FeACUW0DAYhAWcCqwPDHKwGdAAAAEgAArvMwRAIgIbybNKZGcr7/zULRybcWjx1KimWpWYFtAI+Bs25BDusCICQQe5NQf735r8A7KW32IkI77yZ/tVSiMOrQxiGsudEQ', + data_hex: '06612065584f46b0fa15e002516d0301884059c0aac0f0c72b019d000000120000aef33044022021bc9b34a64672beffcd42d1c9b7168f1d4a8a65a959816d008f81b36e410eeb022024107b93507fbdf9afc03b296df622423bef267fb554a230ead0c621acb9d110' + }, + { + ticker: 'a USDT', + address: '0xc4f86e9b4a588d501c1c3e25628dfd50bc8d615e', + decimals: 18, + chainId: 44787, + signature: , + data: , + data_b64: 'BmEgVVNEVMT4bptKWI1QHBw+JWKN/VC8jWFeAAAAEgAArvMwRQIgDWeMp/nbCoswYtk5BQ+rE/lte2o4K1m08eUm8NsVW2wCIQC/QK9ie2N8AxC3wwxByNgeJOZMl7BKxNlWHOVOzbSMhA==', + data_hex: '06612055534454c4f86e9b4a588d501c1c3e25628dfd50bc8d615e000000120000aef3304502200d678ca7f9db0a8b3062d939050fab13f96d7b6a382b59b4f1e526f0db155b6c022100bf40af627b637c0310b7c30c41c8d81e24e64c97b04ac4d9561ce54ecdb48c84' + }, + { + ticker: 'a cREAL', + address: '0xe4d517785d091d3c54818832db6094bcc2744545', + decimals: 18, + chainId: 44787, + signature: , + data: , + data_b64: 'B2EgY1JFQUzk1Rd4XQkdPFSBiDLbYJS8wnRFRQAAABIAAK7zMEYCIQCpcFxVFgYgi+Hs2fGG7u+Wb9Oz1mn8yA82fBBowXykqwIhAP5l2uMxIxL3HqWoPfxTjRANM9ZRM31H347Pwo6P/kr5', + data_hex: '076120635245414ce4d517785d091d3c54818832db6094bcc2744545000000120000aef33046022100a9705c551606208be1ecd9f186eeef966fd3b3d669fcc80f367c1068c17ca4ab022100fe65dae3312312f71ea5a83dfc538d100d33d651337d47df8ecfc28e8ffe4af9' + } +] \ No newline at end of file diff --git a/src/main.c b/src/main.c index e2b8d9d..11ea5b2 100644 --- a/src/main.c +++ b/src/main.c @@ -69,18 +69,23 @@ ux_state_t G_ux; #define OFFSET_CDATA 5 static const uint8_t TOKEN_SIGNATURE_PUBLIC_KEY[] = { -// cLabs production key (2020-04-14) + // cLabs production key (created: May 30, 2024, 17:18:49 GMT+2) + // akeyless URL: https://ui.gateway.akeyless.celo-networks-dev.org/items?id=281699245&name=%2Fstatic-secrets%2Fdev-tooling-circle%2Fledger-key + // akeyless path: /static-secrets/dev-tooling-circle + // Running `openssl ec -in key.pem -text -noout` + // should output the same hex pub key 0x04, - 0xb0,0x6c,0xf5,0xd8,0xf7,0xed,0x71,0xd8, - 0xbd,0x9b,0x9d,0xc3,0x79,0x44,0xa1,0xc6, - 0xd2,0x40,0xf6,0x9b,0xb0,0xbe,0x36,0x21, - 0xdd,0xdb,0xb6,0xac,0xe,0xcc,0xd1,0x50, + 0x59,0xd5,0x59,0xee,0x21,0xa7,0x76,0xfe, + 0x43,0xe4,0xba,0xac,0x14,0x18,0x1c,0x1e, + 0x5f,0xb5,0x1b,0x5b,0x22,0xbc,0x1,0xdd, + 0x46,0xe0,0x60,0xe,0x8d,0xc,0xd7,0xc8, - 0x8b,0xcc,0x2e,0xa4,0x62,0x27,0xe4,0x3b, - 0x94,0x1e,0x2c,0x6f,0x1b,0x1c,0xd0,0xae, - 0x68,0xe5,0x4b,0x18,0x5e,0x2c,0xab,0xef, - 0x34,0x55,0x58,0x6,0x4,0xbd,0x45,0xb8 + + 0x6d,0xc,0xf2,0x3e,0xe0,0xa3,0x8d,0xc8, + 0x3d,0xa6,0x4b,0xd0,0x2a,0x6d,0x43,0x2c, + 0x86,0x10,0x4a,0x47,0xaf,0xef,0x83,0x83, + 0xc2,0x2b,0xe3,0xd4,0xd1,0xa5,0x32,0x2d }; dataContext_t dataContext; @@ -778,4 +783,4 @@ __attribute__((section(".boot"))) int main(void) { } app_exit(); return 0; -} +} \ No newline at end of file diff --git a/tests/python/test_sign_new_transaction.py b/tests/python/test_sign_new_transaction.py index 872f72b..bee4624 100644 --- a/tests/python/test_sign_new_transaction.py +++ b/tests/python/test_sign_new_transaction.py @@ -38,7 +38,7 @@ def test_sign_transaction_eip1559(test_name, backend, firmware, navigator): def test_add_cUSD_as_fee_currency(test_name, backend, navigator): celo = CeloClient(backend) - data = "0463555344765de816845861e75a25fca122bb6898b8b1282a000000120000a4ec3045022100a704051cd04a5e9f95da3abc04c0f6cbfe40c02f5b84f4361f8853fef325fc1e022056a5395b4114644450a314fc5e6f0e524b790ad39fa1907837abb6907616932f" + data = "0463555344765de816845861e75a25fca122bb6898b8b1282a000000120000a4ec304402201f8217a6310b78bfe63f40e767b1413e7480403603486f8d3b2cfd4aaa8607470220577c04cc84d1e0ad9d344c73b624e0fc36c63d4a5f33654ab0bcd892b068e7a1" encoded_data = bytes.fromhex(data) with celo.send_in_chunk_async( INS.INS_PROVIDE_ERC20_TOKEN_INFORMATION,