diff --git a/.clang-format b/.clang-format index b4abfa0..12369a4 100644 --- a/.clang-format +++ b/.clang-format @@ -12,9 +12,9 @@ SortIncludes: false SpaceAfterCStyleCast: true AllowShortCaseLabelsOnASingleLine: false AllowAllArgumentsOnNextLine: false -AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Never AllowShortFunctionsOnASingleLine: None BinPackArguments: false BinPackParameters: false --- + diff --git a/Makefile b/Makefile index 00a6c10..32a67df 100755 --- a/Makefile +++ b/Makefile @@ -23,15 +23,18 @@ include $(BOLOS_SDK)/Makefile.defines APP_LOAD_PARAMS= --curve secp256k1 $(COMMON_LOAD_PARAMS) APPVERSION_M=1 -APPVERSION_N=1 -APPVERSION_P=10 +APPVERSION_N=3 +APPVERSION_P=2 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) # Celo APP_LOAD_PARAMS += --path "44'/52752'" +# Ethereum path +APP_LOAD_PARAMS += --path "44'/60'/0'/0/0" --path "44'/60'/0'" --path "44'/60'/0'/0" + APPNAME = "Celo" APP_LOAD_FLAGS=--appFlags 0 -ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) +ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX TARGET_FLEX)) APP_LOAD_FLAGS=--appFlags 0x200 # APPLICATION_FLAG_BOLOS_SETTINGS endif APP_LOAD_PARAMS += $(APP_LOAD_FLAGS) @@ -39,8 +42,10 @@ APP_LOAD_PARAMS += $(APP_LOAD_FLAGS) #prepare hsm generation ifeq ($(TARGET_NAME), TARGET_NANOS) ICONNAME=nanos_app_celo.gif -else ifeq ($(TARGET_NAME),TARGET_STAX) +else ifeq ($(TARGET_NAME), TARGET_STAX) ICONNAME=stax_app_celo.gif +else ifeq ($(TARGET_NAME), TARGET_FLEX) +ICONNAME=flex_app_celo.gif else ICONNAME=nanox_app_celo.gif endif @@ -72,7 +77,7 @@ DEFINES += APPVERSION=\"$(APPVERSION)\" DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL="" -ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) +ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX TARGET_FLEX)) DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE endif @@ -83,7 +88,7 @@ else DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 endif -ifeq ($(TARGET_NAME),TARGET_STAX) +ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_FLEX TARGET_STAX)) DEFINES += NBGL_QRCODE SDK_SOURCE_PATH += qrcode else @@ -133,7 +138,7 @@ endif CC := $(CLANGPATH)clang -#CFLAGS += -O0 +# CFLAGS += -O0 CFLAGS += -O3 -Os AS := $(GCCPATH)arm-none-eabi-gcc @@ -149,11 +154,11 @@ include $(BOLOS_SDK)/Makefile.glyphs APP_SOURCE_PATH += src_common src SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_u2f -ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX)) +ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX TARGET_FLEX)) SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl endif -ifneq ($(TARGET_NAME),TARGET_STAX) +ifneq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_FLEX TARGET_STAX)) SDK_SOURCE_PATH += lib_ux endif diff --git a/README.md b/README.md index ac34f34..1e8dd51 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,210 @@ -# 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/Stax and Flex. + +## 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` +- `BOLOS_SDK=$FLEX_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 -For more information about the parsing framework you can refer to diff --git a/doc/ethapp.asc b/doc/ethapp.asc index 7ae5db3..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 @@ -353,6 +337,7 @@ The following standard Status Words are returned for all APDUs - some specific S [width="80%"] |=============================================================================================== | *SW* | *Description* +| 6501 | TransactionType not supported | 6700 | Incorrect length | 6982 | Security status not satisfied (Canceled by user) | 6A80 | Invalid data 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/flex_app_celo.gif b/flex_app_celo.gif new file mode 100644 index 0000000..f899e55 Binary files /dev/null and b/flex_app_celo.gif differ diff --git a/glyphs/celo_64px.gif b/glyphs/celo_64px.gif index 2cd945c..b61f5f4 100644 Binary files a/glyphs/celo_64px.gif and b/glyphs/celo_64px.gif differ diff --git a/ledger_app.toml b/ledger_app.toml index ab5340f..05e1f00 100644 --- a/ledger_app.toml +++ b/ledger_app.toml @@ -1,7 +1,7 @@ [app] build_directory = "./" sdk = "C" -devices = ["nanos", "nanox", "nanos+", "stax"] +devices = ["nanos", "nanox", "nanos+", "stax", "flex"] [tests] unit_directory = "./tests/unit" diff --git a/nanos_app_celo.gif b/nanos_app_celo.gif index 8895ee7..4c29764 100644 Binary files a/nanos_app_celo.gif and b/nanos_app_celo.gif differ diff --git a/nanox_app_celo.gif b/nanox_app_celo.gif index 94ddbcf..ca925cc 100644 Binary files a/nanox_app_celo.gif and b/nanox_app_celo.gif differ diff --git a/src/celo.c b/src/celo.c index ea8f1c1..2f03161 100644 --- a/src/celo.c +++ b/src/celo.c @@ -111,7 +111,9 @@ static uint32_t splitBinaryParameterPart(char *result, uint8_t *parameter) { } customStatus_e customProcessor(txContext_t *context) { - if ((context->currentField == TX_RLP_DATA) && + if (((context->txType == CELO_LEGACY && context->currentField == CELO_LEGACY_RLP_DATA) || + (context->txType == CIP64 && context->currentField == CIP64_RLP_DATA) || + (context->txType == EIP1559 && context->currentField == EIP1559_RLP_DATA)) && (context->currentFieldLength != 0)) { dataPresent = true; // If handling a new contract rather than a function call, abort immediately @@ -232,15 +234,16 @@ customStatus_e customProcessor(txContext_t *context) { copyTxData(context, dataContext.withdrawContext.data + context->currentFieldPos, copySize); + break; case PROVISION_RELOCK: copyTxData(context, dataContext.relockContext.data + context->currentFieldPos, copySize); + break; case PROVISION_CREATE_ACCOUNT: copyTxData(context, dataContext.createAccountContext.data + context->currentFieldPos, copySize); - break; default: break; @@ -331,8 +334,8 @@ void finalizeParsing(bool direct) { uint32_t i; uint8_t decimals = WEI_TO_ETHER; uint8_t feeDecimals = WEI_TO_ETHER; - char *ticker = CHAINID_COINNAME " "; - char *feeTicker = CHAINID_COINNAME " "; + const char *ticker = CHAINID_COINNAME " "; + const char *feeTicker = CHAINID_COINNAME " "; uint8_t tickerOffset = 0; // Display correct currency if fee currency field sent @@ -342,10 +345,10 @@ void finalizeParsing(bool direct) { reset_app_context(); PRINTF("Invalid fee currency"); if (direct) { - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } else { - io_seproxyhal_send_status(0x6A80); + io_seproxyhal_send_status(SW_ERROR_IN_DATA); ui_idle(); return; } @@ -356,7 +359,12 @@ void finalizeParsing(bool direct) { } // Store the hash - cx_hash((cx_hash_t *)&sha3, CX_LAST, tmpCtx.transactionContext.hash, 0, tmpCtx.transactionContext.hash, 32); + CX_THROW(cx_hash_no_throw((cx_hash_t *) &sha3, + CX_LAST, + tmpCtx.transactionContext.hash, + 0, + tmpCtx.transactionContext.hash, + 32)); // If there is a token to process, check if it is well known if (provisionType == PROVISION_TOKEN) { tokenDefinition_t *currentToken = getKnownToken(tmpContent.txContent.destination); @@ -393,10 +401,10 @@ void finalizeParsing(bool direct) { reset_app_context(); PRINTF("Data field forbidden\n"); if (direct) { - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } else { - io_seproxyhal_send_status(0x6A80); + io_seproxyhal_send_status(SW_ERROR_IN_DATA); ui_idle(); return; } diff --git a/src/celo.h b/src/celo.h index a873eb3..7ad96bd 100644 --- a/src/celo.h +++ b/src/celo.h @@ -1,25 +1,82 @@ +/** + * @file celo.h + * @brief Header file containing function declarations and definitions for the Celo application. + */ + #pragma once #include #include "ethUstream.h" #include "tokens.h" +/** + * @brief Sends the status code to the SE proxy hardware abstraction layer. + * + * @param sw The status code to be sent. + */ void io_seproxyhal_send_status(uint32_t sw); + +/** + * @brief Formats the signature output. + * + * @param signature The signature to be formatted. + */ void format_signature_out(const uint8_t* signature); + +/** + * @brief Sets the result and retrieves the public key. + * + * @return The status code for the operation. + */ uint32_t set_result_get_publicKey(); + +/** + * @brief Resets the application context. + */ void reset_app_context(); +/** + * @brief Retrieves the known token based on the token address. + * + * @param tokenAddr The address of the token. + * @return A pointer to the token definition. + */ tokenDefinition_t* getKnownToken(uint8_t *tokenAddr); +/** + * @brief Custom processor for transaction context. + * + * @param context The transaction context. + * @return The custom status code. + */ customStatus_e customProcessor(txContext_t *context); + +/** + * @brief Initializes the transaction context. + * + * @param context The transaction context. + * @param sha3 The SHA3 context. + * @param content The transaction content. + * @param customProcessor The custom processor function. + * @param extra Additional data for the custom processor. + */ void initTx(txContext_t *context, cx_sha3_t *sha3, txContent_t *content, ustreamProcess_t customProcessor, void *extra); + +/** + * @brief Finalizes the parsing process. + * + * @param direct Flag indicating if the parsing is direct. + */ void finalizeParsing(bool direct); // TODO: this should not be exposed +/** + * @brief Enumeration representing the application state. + */ typedef enum { APP_STATE_IDLE, APP_STATE_SIGNING_TX, APP_STATE_SIGNING_MESSAGE } app_state_t; -extern volatile uint8_t appState; +extern volatile uint8_t appState; /**< The application state. */ diff --git a/src/globals.h b/src/globals.h index 4729caf..fdfcd1a 100644 --- a/src/globals.h +++ b/src/globals.h @@ -8,6 +8,18 @@ #define CHAINID_COINNAME "CELO" #define CHAIN_ID 0 +// RETURN CODES +#define SW_TX_TYPE_NOT_SUPPORTED 0x6501 +#define SW_NO_APDU_RECEIVED 0x6982 +#define SW_INITIALIZATION_ERROR 0x6985 +#define SW_ERROR_IN_DATA 0x6A80 +#define SW_WRONG_P1_OR_P2 0x6b00 +#define SW_OK 0x9000 +#define SW_INS_NOT_SUPPORTED 0x6d00 +#define SW_CLA_NOT_SUPPORTED 0x6e00 + + + typedef union { txContent_t txContent; cx_sha256_t sha2; diff --git a/src/main.c b/src/main.c index 8608d33..c8c03b6 100644 --- a/src/main.c +++ b/src/main.c @@ -33,17 +33,19 @@ #include "utils.h" #include "ui_common.h" +// Global variables uint8_t G_io_seproxyhal_spi_buffer[IO_SEPROXYHAL_BUFFER_SIZE_B]; bolos_ux_params_t G_ux_params; ux_state_t G_ux; - - +// App flags #define APP_FLAG_DATA_ALLOWED 0x01 #define APP_FLAG_EXTERNAL_TOKEN_NEEDED 0x02 +// App type #define APP_TYPE 0x02 +// APDU instructions #define CLA 0xE0 #define INS_GET_PUBLIC_KEY 0x02 #define INS_SIGN 0x04 @@ -58,9 +60,11 @@ ux_state_t G_ux; #define P1_FIRST 0x00 #define P1_MORE 0x80 +// Common instructions #define COMMON_CLA 0xB0 #define COMMON_INS_GET_WALLET_ID 0x04 +// APDU offsets #define OFFSET_CLA 0 #define OFFSET_INS 1 #define OFFSET_P1 2 @@ -68,49 +72,63 @@ ux_state_t G_ux; #define OFFSET_LC 4 #define OFFSET_CDATA 5 +// Token signature public key 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 }; +// Contexts dataContext_t dataContext; - tmpCtx_t tmpCtx; - txContext_t txContext; - tmpContent_t tmpContent; - cx_sha3_t sha3; +// Volatile variables volatile uint8_t dataAllowed; volatile uint8_t contractDetails; volatile bool dataPresent; volatile provision_type_t provisionType; +// Strings strings_t strings; +// Internal storage const internalStorage_t N_storage_real; static const char SIGN_MAGIC[] = "\x19" "Ethereum Signed Message:\n"; + +/** + * IO exchange function + * + * @param channel The communication channel + * @param tx_len The length of the data to be transmitted + * @return The received data length or 0 if nothing received + */ unsigned short io_exchange_al(unsigned char channel, unsigned short tx_len) { switch (channel & ~(IO_FLAGS)) { case CHANNEL_KEYBOARD: break; - // multiplexed io exchange over a SPI channel and TLV encapsulated protocol + // Multiplexed IO exchange over a SPI channel and TLV encapsulated protocol case CHANNEL_SPI: if (tx_len) { io_seproxyhal_spi_send(G_io_apdu_buffer, tx_len); @@ -118,11 +136,9 @@ unsigned short io_exchange_al(unsigned char channel, unsigned short tx_len) { if (channel & IO_RESET_AFTER_REPLIED) { reset(); } - return 0; // nothing received from the master so far (it's a tx - // transaction) + return 0; // Nothing received from the master so far (it's a tx transaction) } else { - return io_seproxyhal_spi_recv(G_io_apdu_buffer, - sizeof(G_io_apdu_buffer), 0); + return io_seproxyhal_spi_recv(G_io_apdu_buffer, sizeof(G_io_apdu_buffer), 0); } default: @@ -133,6 +149,14 @@ unsigned short io_exchange_al(unsigned char channel, unsigned short tx_len) { #define MAX_BIP32_PATH 10 +/** + * Parse BIP32 path + * + * @param derivationPath The BIP32 path structure to be filled + * @param input The input data buffer + * @param len The length of the input data buffer + * @return 0 if successful, -1 if failed + */ static int parse_bip32_path(bip32Path_t *derivationPath, const uint8_t *input, size_t len) { uint8_t path_length; @@ -163,50 +187,71 @@ unsigned int const U_os_perso_seed_cookie[] = { 0xc1a551c5, }; +/** + * Handle Get Wallet ID command + * + * @param tx The transaction buffer + */ void handleGetWalletId(volatile unsigned int *tx) { unsigned char t[64]; cx_ecfp_256_private_key_t priv; cx_ecfp_256_public_key_t pub; // seed => priv key - os_perso_derive_node_bip32(CX_CURVE_256K1, U_os_perso_seed_cookie, 2, t, NULL); + CX_THROW(os_derive_bip32_no_throw(CX_CURVE_256K1, U_os_perso_seed_cookie, 2, t, NULL)); // priv key => pubkey - cx_ecdsa_init_private_key(CX_CURVE_256K1, t, 32, &priv); - cx_ecfp_generate_pair(CX_CURVE_256K1, &pub, &priv, 1); + CX_THROW(cx_ecdsa_init_private_key(CX_CURVE_256K1, t, 32, &priv)); + CX_THROW(cx_ecfp_generate_pair_no_throw(CX_CURVE_256K1, &pub, &priv, 1)); // pubkey -> sha512 cx_hash_sha512(pub.W, sizeof(pub.W), t, sizeof(t)); // ! cookie ! memcpy(G_io_apdu_buffer, t, 64); *tx = 64; - THROW(0x9000); + THROW(SW_OK); } #endif // HAVE_WALLET_ID_SDK +/** + * Handle Get Public Key command + * + * @param p1 The first parameter + * @param p2 The second parameter + * @param dataBuffer The data buffer + * @param dataLength The length of the data buffer + * @param flags The flags + * @param tx The transaction buffer + */ void handleGetPublicKey(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t dataLength, volatile unsigned int *flags, volatile unsigned int *tx) { UNUSED(dataLength); - uint8_t privateKeyData[32]; + uint8_t privateKeyData[64]; bip32Path_t derivationPath; cx_ecfp_private_key_t privateKey; reset_app_context(); if ((p1 != P1_CONFIRM) && (p1 != P1_NON_CONFIRM)) { - THROW(0x6B00); + THROW(SW_WRONG_P1_OR_P2); } if ((p2 != P2_CHAINCODE) && (p2 != P2_NO_CHAINCODE)) { - THROW(0x6B00); + THROW(SW_WRONG_P1_OR_P2); } if (parse_bip32_path(&derivationPath, dataBuffer, dataLength)) { PRINTF("Invalid path\n"); - THROW(0x6a80); + THROW(SW_ERROR_IN_DATA); } tmpCtx.publicKeyContext.getChaincode = (p2 == P2_CHAINCODE); io_seproxyhal_io_heartbeat(); - os_perso_derive_node_bip32(CX_CURVE_256K1, derivationPath.path, derivationPath.len, privateKeyData, (tmpCtx.publicKeyContext.getChaincode ? tmpCtx.publicKeyContext.chainCode : NULL)); - cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32, &privateKey); + CX_THROW(os_derive_bip32_no_throw( + CX_CURVE_256K1, + derivationPath.path, + derivationPath.len, + privateKeyData, + (tmpCtx.publicKeyContext.getChaincode ? tmpCtx.publicKeyContext.chainCode : NULL))); + + CX_THROW(cx_ecfp_init_private_key_no_throw(CX_CURVE_256K1, privateKeyData, 32, &privateKey)); io_seproxyhal_io_heartbeat(); - cx_ecfp_generate_pair(CX_CURVE_256K1, &tmpCtx.publicKeyContext.publicKey, &privateKey, 1); + CX_THROW(cx_ecfp_generate_pair_no_throw(CX_CURVE_256K1, &tmpCtx.publicKeyContext.publicKey, &privateKey, 1)); explicit_bzero(&privateKey, sizeof(privateKey)); explicit_bzero(privateKeyData, sizeof(privateKeyData)); io_seproxyhal_io_heartbeat(); @@ -216,7 +261,7 @@ void handleGetPublicKey(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t da #endif // NO_CONSENT { *tx = set_result_get_publicKey(); - THROW(0x9000); + THROW(SW_OK); } #ifndef NO_CONSENT else { @@ -228,6 +273,16 @@ void handleGetPublicKey(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, uint16_t da #endif // NO_CONSENT } +/** + * Handle Provide ERC20 Token Information command + * + * @param p1 The first parameter + * @param p2 The second parameter + * @param workBuffer The work buffer + * @param dataLength The length of the data buffer + * @param flags The flags + * @param tx The transaction buffer + */ void handleProvideErc20TokenInformation(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint16_t dataLength, volatile unsigned int *flags, volatile unsigned int *tx) { UNUSED(p1); UNUSED(p2); @@ -245,16 +300,16 @@ void handleProvideErc20TokenInformation(uint8_t p1, uint8_t p2, uint8_t *workBuf PRINTF("Provisioning currentTokenIndex %d\n", tmpCtx.transactionContext.currentTokenIndex); if (dataLength < 1) { - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } tickerLength = workBuffer[offset++]; dataLength--; // We need to make sure we can write the ticker, a space and a zero byte at the end if ((tickerLength + 2) >= sizeof(token->ticker)) { - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } if (dataLength < tickerLength + 20 + 4 + 4) { - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } cx_hash_sha256(workBuffer + offset, tickerLength + 20 + 4 + 4, hash, 32); memcpy(token->ticker, workBuffer + offset, tickerLength); @@ -272,15 +327,25 @@ void handleProvideErc20TokenInformation(uint8_t p1, uint8_t p2, uint8_t *workBuf // Skip chainId offset += 4; dataLength -= 4; - cx_ecfp_init_public_key(CX_CURVE_256K1, TOKEN_SIGNATURE_PUBLIC_KEY, sizeof(TOKEN_SIGNATURE_PUBLIC_KEY), &tokenKey); - if (!cx_ecdsa_verify(&tokenKey, CX_LAST, CX_SHA256, hash, 32, workBuffer + offset, dataLength)) { + CX_THROW(cx_ecfp_init_public_key_no_throw(CX_CURVE_256K1, TOKEN_SIGNATURE_PUBLIC_KEY, sizeof(TOKEN_SIGNATURE_PUBLIC_KEY), &tokenKey)); + if (!cx_ecdsa_verify_no_throw(&tokenKey, hash, 32, workBuffer + offset, dataLength)) { PRINTF("Invalid token signature\n"); - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } tmpCtx.transactionContext.tokenSet[tmpCtx.transactionContext.currentTokenIndex] = 1; - THROW(0x9000); + THROW(SW_OK); } +/** + * Handles the signing of a transaction. + * + * @param p1 The first parameter of the APDU command. + * @param p2 The second parameter of the APDU command. + * @param workBuffer The buffer containing the transaction data. + * @param dataLength The length of the transaction data. + * @param flags The flags variable. + * @param tx The transaction variable. + */ void handleSign(uint8_t p1, uint8_t p2, const uint8_t *workBuffer, uint16_t dataLength, volatile unsigned int *flags, volatile unsigned int *tx) { UNUSED(tx); parserStatus_e txResult; @@ -291,7 +356,7 @@ void handleSign(uint8_t p1, uint8_t p2, const uint8_t *workBuffer, uint16_t data if (parse_bip32_path(&tmpCtx.transactionContext.derivationPath, workBuffer, dataLength)) { PRINTF("Invalid path\n"); - THROW(0x6a80); + THROW(SW_ERROR_IN_DATA); } workBuffer += 1 + tmpCtx.transactionContext.derivationPath.len * sizeof(uint32_t); dataLength -= 1 + tmpCtx.transactionContext.derivationPath.len * sizeof(uint32_t); @@ -299,23 +364,34 @@ void handleSign(uint8_t p1, uint8_t p2, const uint8_t *workBuffer, uint16_t data appState = APP_STATE_SIGNING_TX; dataPresent = false; provisionType = PROVISION_NONE; - //0x8000003c is the Ethereum path initTx(&txContext, &sha3, &tmpContent.txContent, customProcessor, NULL); + // Extract and validate the transaction type + uint8_t txType = *workBuffer; + if (txType == EIP1559 || txType == CIP64) { + // Initialize the SHA3 hashing with the transaction type + CX_THROW(cx_hash_no_throw((cx_hash_t *) &sha3, 0, workBuffer, 1, NULL, 0)); + // Save the transaction type + txContext.txType = txType; + workBuffer++; + dataLength--; + } + else { + THROW(SW_TX_TYPE_NOT_SUPPORTED); + } } - else - if (p1 != P1_MORE) { - THROW(0x6B00); + else if (p1 != P1_MORE) { + THROW(SW_WRONG_P1_OR_P2); } if (p2 != 0) { - THROW(0x6B00); + THROW(SW_WRONG_P1_OR_P2); } if ((p1 == P1_MORE) && (appState != APP_STATE_SIGNING_TX)) { PRINTF("Signature not initialized\n"); - THROW(0x6985); + THROW(SW_INITIALIZATION_ERROR); } - if (txContext.currentField == TX_RLP_NONE) { + if (txContext.currentField == RLP_NONE) { PRINTF("Parser not initialized\n"); - THROW(0x6985); + THROW(SW_INITIALIZATION_ERROR); } txResult = processTx(&txContext, workBuffer, dataLength); switch (txResult) { @@ -324,12 +400,12 @@ void handleSign(uint8_t p1, uint8_t p2, const uint8_t *workBuffer, uint16_t data case USTREAM_FINISHED: break; case USTREAM_PROCESSING: - THROW(0x9000); + THROW(SW_OK); case USTREAM_FAULT: - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); default: PRINTF("Unexpected parser status\n"); - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } *flags |= IO_ASYNCH_REPLY; @@ -339,6 +415,16 @@ void handleSign(uint8_t p1, uint8_t p2, const uint8_t *workBuffer, uint16_t data } } +/** + * Handles the retrieval of the application configuration. + * + * @param p1 The first parameter of the APDU command. + * @param p2 The second parameter of the APDU command. + * @param workBuffer The buffer containing the command data. + * @param dataLength The length of the command data. + * @param flags The flags variable. + * @param tx The transaction variable. + */ void handleGetAppConfiguration(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint16_t dataLength, volatile unsigned int *flags, volatile unsigned int *tx) { UNUSED(p1); UNUSED(p2); @@ -353,9 +439,19 @@ void handleGetAppConfiguration(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint G_io_apdu_buffer[2] = LEDGER_MINOR_VERSION; G_io_apdu_buffer[3] = LEDGER_PATCH_VERSION; *tx = 4; - THROW(0x9000); + THROW(SW_OK); } +/** + * Handles the retrieval of the application type. + * + * @param p1 The first parameter of the APDU command. + * @param p2 The second parameter of the APDU command. + * @param workBuffer The buffer containing the command data. + * @param dataLength The length of the command data. + * @param flags The flags variable. + * @param tx The transaction variable. + */ void handleGetAppType(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint16_t dataLength, volatile unsigned int *flags, volatile unsigned int *tx) { UNUSED(p1); UNUSED(p2); @@ -364,10 +460,19 @@ void handleGetAppType(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint16_t data UNUSED(flags); G_io_apdu_buffer[0] = APP_TYPE; *tx = 1; - THROW(0x9000); + THROW(SW_OK); } - +/** + * Handles the signing of a personal message. + * + * @param p1 The first parameter of the APDU command. + * @param p2 The second parameter of the APDU command. + * @param workBuffer The buffer containing the command data. + * @param dataLength The length of the command data. + * @param flags The flags variable. + * @param tx The transaction variable. + */ void handleSignPersonalMessage(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint16_t dataLength, volatile unsigned int *flags, volatile unsigned int *tx) { UNUSED(tx); @@ -383,7 +488,7 @@ void handleSignPersonalMessage(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint if (parse_bip32_path(&tmpCtx.messageSigningContext.derivationPath, workBuffer, dataLength)) { PRINTF("Invalid path\n"); - THROW(0x6a80); + THROW(SW_ERROR_IN_DATA); } workBuffer += 1 + tmpCtx.messageSigningContext.derivationPath.len * sizeof(uint32_t); dataLength -= 1 + tmpCtx.messageSigningContext.derivationPath.len * sizeof(uint32_t); @@ -392,14 +497,20 @@ void handleSignPersonalMessage(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint if (dataLength < 4) { PRINTF("Invalid data\n"); - THROW(0x6a80); + THROW(SW_ERROR_IN_DATA); } tmpCtx.messageSigningContext.remainingLength = U4BE(workBuffer, 0); workBuffer += 4; dataLength -= 4; // Initialize message header + length - cx_keccak_init(&sha3, 256); - cx_hash((cx_hash_t *)&sha3, 0, (uint8_t*)SIGN_MAGIC, sizeof(SIGN_MAGIC) - 1, NULL, 0); + CX_THROW(cx_keccak_init_no_throw(&sha3, 256)); + CX_THROW(cx_hash_no_throw((cx_hash_t *)&sha3, + 0, + (uint8_t*)SIGN_MAGIC, + sizeof(SIGN_MAGIC) - 1, + NULL, + 0)); + for (i = 1; (((i * base) <= tmpCtx.messageSigningContext.remainingLength) && (((i * base) / base) == i)); i *= base); @@ -407,30 +518,32 @@ void handleSignPersonalMessage(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint tmp[pos++] = '0' + ((tmpCtx.messageSigningContext.remainingLength / i) % base); } tmp[pos] = '\0'; - cx_hash((cx_hash_t *)&sha3, 0, (uint8_t*)tmp, pos, NULL, 0); + + CX_THROW(cx_hash_no_throw((cx_hash_t *) &sha3, 0, (uint8_t*)tmp, pos, NULL, 0)); + cx_sha256_init(&tmpContent.sha2); } else if (p1 != P1_MORE) { - THROW(0x6B00); + THROW(SW_WRONG_P1_OR_P2); } if (p2 != 0) { - THROW(0x6B00); + THROW(SW_WRONG_P1_OR_P2); } if ((p1 == P1_MORE) && (appState != APP_STATE_SIGNING_MESSAGE)) { PRINTF("Signature not initialized\n"); - THROW(0x6985); + THROW(SW_INITIALIZATION_ERROR); } if (dataLength > tmpCtx.messageSigningContext.remainingLength) { - THROW(0x6A80); + THROW(SW_ERROR_IN_DATA); } - cx_hash((cx_hash_t *)&sha3, 0, workBuffer, dataLength, NULL, 0); - cx_hash((cx_hash_t *)&tmpContent.sha2, 0, workBuffer, dataLength, NULL, 0); + CX_THROW(cx_hash_no_throw((cx_hash_t *)&sha3, 0, workBuffer, dataLength, NULL, 0)); + CX_THROW(cx_hash_no_throw((cx_hash_t *)&tmpContent.sha2, 0, workBuffer, dataLength, NULL, 0)); tmpCtx.messageSigningContext.remainingLength -= dataLength; if (tmpCtx.messageSigningContext.remainingLength == 0) { uint8_t hashMessage[32]; - cx_hash((cx_hash_t *)&sha3, CX_LAST, workBuffer, 0, tmpCtx.messageSigningContext.hash, 32); - cx_hash((cx_hash_t *)&tmpContent.sha2, CX_LAST, workBuffer, 0, hashMessage, 32); + CX_THROW(cx_hash_no_throw((cx_hash_t *)&sha3, CX_LAST, workBuffer, 0, tmpCtx.messageSigningContext.hash, 32)); + CX_THROW(cx_hash_no_throw((cx_hash_t *)&tmpContent.sha2, CX_LAST, workBuffer, 0, hashMessage, 32)); #ifdef HAVE_BAGL #define HASH_LENGTH 4 @@ -453,10 +566,15 @@ void handleSignPersonalMessage(uint8_t p1, uint8_t p2, uint8_t *workBuffer, uint *flags |= IO_ASYNCH_REPLY; } else { - THROW(0x9000); + THROW(SW_OK); } } - +/** + * Handles the APDU command. + * + * @param flags The flags variable. + * @param tx The tx variable. + */ void handleApdu(volatile unsigned int *flags, volatile unsigned int *tx) { unsigned short sw = 0; @@ -465,6 +583,7 @@ void handleApdu(volatile unsigned int *flags, volatile unsigned int *tx) { #ifndef HAVE_WALLET_ID_SDK + // Handle the GET_WALLET_ID command if ((G_io_apdu_buffer[OFFSET_CLA] == COMMON_CLA) && (G_io_apdu_buffer[OFFSET_INS] == COMMON_INS_GET_WALLET_ID)) { handleGetWalletId(tx); return; @@ -472,10 +591,12 @@ void handleApdu(volatile unsigned int *flags, volatile unsigned int *tx) { #endif + // Check the CLA byte if (G_io_apdu_buffer[OFFSET_CLA] != CLA) { - THROW(0x6E00); + THROW(SW_CLA_NOT_SUPPORTED); } + // Handle different INS commands switch (G_io_apdu_buffer[OFFSET_INS]) { case INS_GET_PUBLIC_KEY: memset(tmpCtx.transactionContext.tokenSet, 0, MAX_TOKEN); @@ -499,9 +620,9 @@ void handleApdu(volatile unsigned int *flags, volatile unsigned int *tx) { handleSignPersonalMessage(G_io_apdu_buffer[OFFSET_P1], G_io_apdu_buffer[OFFSET_P2], G_io_apdu_buffer + OFFSET_CDATA, G_io_apdu_buffer[OFFSET_LC], flags, tx); break; - case INS_GET_APP_TYPE: - handleGetAppType(G_io_apdu_buffer[OFFSET_P1], G_io_apdu_buffer[OFFSET_P2], G_io_apdu_buffer + OFFSET_CDATA, G_io_apdu_buffer[OFFSET_LC], flags, tx); - break; + case INS_GET_APP_TYPE: + handleGetAppType(G_io_apdu_buffer[OFFSET_P1], G_io_apdu_buffer[OFFSET_P2], G_io_apdu_buffer + OFFSET_CDATA, G_io_apdu_buffer[OFFSET_LC], flags, tx); + break; #if 0 case 0xFF: // return to dashboard @@ -509,7 +630,7 @@ void handleApdu(volatile unsigned int *flags, volatile unsigned int *tx) { #endif default: - THROW(0x6D00); + THROW(SW_INS_NOT_SUPPORTED); } } CATCH(EXCEPTION_IO_RESET) { @@ -522,7 +643,7 @@ void handleApdu(volatile unsigned int *flags, volatile unsigned int *tx) { sw = e; reset_app_context(); break; - case 0x9000: + case SW_OK: // All is well sw = e; break; @@ -531,160 +652,175 @@ void handleApdu(volatile unsigned int *flags, volatile unsigned int *tx) { sw = 0x6800 | (e & 0x7FF); reset_app_context(); break; - } - if (e != 0x9000) { - *flags &= ~IO_ASYNCH_REPLY; - } - // Unexpected exception => report - G_io_apdu_buffer[*tx] = sw >> 8; - G_io_apdu_buffer[*tx + 1] = sw; - *tx += 2; } - FINALLY { + if (e != SW_OK) { + *flags &= ~IO_ASYNCH_REPLY; } + // Unexpected exception => report + G_io_apdu_buffer[*tx] = sw >> 8; + G_io_apdu_buffer[*tx + 1] = sw; + *tx += 2; + } + FINALLY { + } } END_TRY; } - +/** + * Main function for the application. + */ void sample_main(void) { - volatile unsigned int tx = 0; - volatile unsigned int flags = 0; - - // DESIGN NOTE: the bootloader ignores the way APDU are fetched. The only - // goal is to retrieve APDU. - // When APDU are to be fetched from multiple IOs, like NFC+USB+BLE, make - // sure the io_event is called with a - // switch event, before the apdu is replied to the bootloader. This avoid - // APDU injection faults. - for (;;) { - volatile unsigned int rx = 0; - volatile unsigned short sw = 0; - - BEGIN_TRY { - TRY { - rx = tx; - tx = 0; // ensure no race in catch_other if io_exchange throws - // an error - rx = io_exchange(CHANNEL_APDU | flags, rx); - flags = 0; - - // no apdu received, well, reset the session, and reset the - // bootloader configuration - if (rx == 0) { - THROW(0x6982); - } + volatile unsigned int tx = 0; + volatile unsigned int flags = 0; + + // DESIGN NOTE: the bootloader ignores the way APDU are fetched. The only + // goal is to retrieve APDU. + // When APDU are to be fetched from multiple IOs, like NFC+USB+BLE, make + // sure the io_event is called with a + // switch event, before the apdu is replied to the bootloader. This avoid + // APDU injection faults. + for (;;) { + volatile unsigned int rx = 0; + volatile unsigned short sw = 0; + + BEGIN_TRY { + TRY { + rx = tx; + tx = 0; // ensure no race in catch_other if io_exchange throws + // an error + rx = io_exchange(CHANNEL_APDU | flags, rx); + flags = 0; + + // no apdu received, well, reset the session, and reset the + // bootloader configuration + if (rx == 0) { + THROW(SW_NO_APDU_RECEIVED); + } - PRINTF("New APDU received:\n%.*H\n", rx, G_io_apdu_buffer); + PRINTF("New APDU received:\n%.*H\n", rx, G_io_apdu_buffer); - handleApdu(&flags, &tx); - } - CATCH(EXCEPTION_IO_RESET) { - THROW(EXCEPTION_IO_RESET); - } - CATCH_OTHER(e) { - switch (e & 0xF000) { - case 0x6000: - // Wipe the transaction context and report the exception - sw = e; - reset_app_context(); - break; - case 0x9000: - // All is well - sw = e; - break; - default: - // Internal error - sw = 0x6800 | (e & 0x7FF); - reset_app_context(); - break; - } - if (e != 0x9000) { - flags &= ~IO_ASYNCH_REPLY; - } - // Unexpected exception => report - G_io_apdu_buffer[tx] = sw >> 8; - G_io_apdu_buffer[tx + 1] = sw; - tx += 2; - } - FINALLY { - } + handleApdu(&flags, &tx); + } + CATCH(EXCEPTION_IO_RESET) { + THROW(EXCEPTION_IO_RESET); + } + CATCH_OTHER(e) { + switch (e & 0xF000) { + case 0x6000: + // Wipe the transaction context and report the exception + sw = e; + reset_app_context(); + break; + case SW_OK: + // All is well + sw = e; + break; + default: + // Internal error + sw = 0x6800 | (e & 0x7FF); + reset_app_context(); + break; } - END_TRY; + if (e != SW_OK) { + flags &= ~IO_ASYNCH_REPLY; + } + // Unexpected exception => report + G_io_apdu_buffer[tx] = sw >> 8; + G_io_apdu_buffer[tx + 1] = sw; + tx += 2; + } + FINALLY { + } } + END_TRY; + } -//return_to_dashboard: - return; + //return_to_dashboard: + return; } -// override point, but nothing more to do #ifdef HAVE_BAGL +/** + * Display function for the SEPROXYHAL. + * @param element The element to display. + */ void io_seproxyhal_display(const bagl_element_t *element) { io_seproxyhal_display_default((bagl_element_t *)element); } #endif // HAVE_BAGL +/** + * Event handler for the SEPROXYHAL. + * @param channel The channel of the event. + * @return 1 if the event was processed successfully, 0 otherwise. + */ unsigned char io_event(unsigned char channel) { - UNUSED(channel); + UNUSED(channel); - // nothing done with the event, throw an error on the transport layer if - // needed + // nothing done with the event, throw an error on the transport layer if + // needed - // can't have more than one tag in the reply, not supported yet. - switch (G_io_seproxyhal_spi_buffer[0]) { + // can't have more than one tag in the reply, not supported yet. + switch (G_io_seproxyhal_spi_buffer[0]) { #ifdef HAVE_NBGL - case SEPROXYHAL_TAG_FINGER_EVENT: - UX_FINGER_EVENT(G_io_seproxyhal_spi_buffer); - break; + case SEPROXYHAL_TAG_FINGER_EVENT: + UX_FINGER_EVENT(G_io_seproxyhal_spi_buffer); + break; #endif // HAVE_NBGL - case SEPROXYHAL_TAG_BUTTON_PUSH_EVENT: + case SEPROXYHAL_TAG_BUTTON_PUSH_EVENT: #ifdef HAVE_BAGL - UX_BUTTON_PUSH_EVENT(G_io_seproxyhal_spi_buffer); + UX_BUTTON_PUSH_EVENT(G_io_seproxyhal_spi_buffer); #endif // HAVE_BAGL - break; + break; - case SEPROXYHAL_TAG_STATUS_EVENT: - if (G_io_apdu_media == IO_APDU_MEDIA_USB_HID && !(U4BE(G_io_seproxyhal_spi_buffer, 3) & SEPROXYHAL_TAG_STATUS_EVENT_FLAG_USB_POWERED)) { - THROW(EXCEPTION_IO_RESET); - } - // no break is intentional - default: - UX_DEFAULT_EVENT(); - break; - case SEPROXYHAL_TAG_DISPLAY_PROCESSED_EVENT: + case SEPROXYHAL_TAG_STATUS_EVENT: + if (G_io_apdu_media == IO_APDU_MEDIA_USB_HID && !(U4BE(G_io_seproxyhal_spi_buffer, 3) & SEPROXYHAL_TAG_STATUS_EVENT_FLAG_USB_POWERED)) { + THROW(EXCEPTION_IO_RESET); + } + // no break is intentional + __attribute__((fallthrough)); // ignore fall-through warning + + default: + UX_DEFAULT_EVENT(); + break; + case SEPROXYHAL_TAG_DISPLAY_PROCESSED_EVENT: #ifdef HAVE_BAGL - UX_DISPLAYED_EVENT({}); + UX_DISPLAYED_EVENT({}); #endif // HAVE_BAGL #ifdef HAVE_NBGL - UX_DEFAULT_EVENT(); + UX_DEFAULT_EVENT(); #endif // HAVE_NBGL - break; + break; - case SEPROXYHAL_TAG_TICKER_EVENT: - UX_TICKER_EVENT(G_io_seproxyhal_spi_buffer, {}); - break; - } + case SEPROXYHAL_TAG_TICKER_EVENT: + UX_TICKER_EVENT(G_io_seproxyhal_spi_buffer, {}); + break; + } - // close the event if not done previously (by a display or whatever) - if (!io_seproxyhal_spi_is_status_sent()) { - io_seproxyhal_general_status(); - } + // close the event if not done previously (by a display or whatever) + if (!io_seproxyhal_spi_is_status_sent()) { + io_seproxyhal_general_status(); + } - // command has been processed, DO NOT reset the current APDU transport - return 1; + // command has been processed, DO NOT reset the current APDU transport + return 1; } +/** + * Function to exit the application. + */ void app_exit(void) { - BEGIN_TRY_L(exit) { - TRY_L(exit) { - os_sched_exit(-1); - } - FINALLY_L(exit) { + BEGIN_TRY_L(exit) { + TRY_L(exit) { + os_sched_exit(-1); + } + FINALLY_L(exit) { - } } - END_TRY_L(exit); + } + END_TRY_L(exit); } __attribute__((section(".boot"))) int main(void) { @@ -713,7 +849,7 @@ __attribute__((section(".boot"))) int main(void) { if (N_storage.initialized != 0x01) { internalStorage_t storage; - storage.dataAllowed = 0x01; + storage.dataAllowed = 0x00; storage.contractDetails = 0x00; storage.initialized = 0x01; nvm_write(&N_storage, (void*)&storage, sizeof(internalStorage_t)); @@ -749,4 +885,4 @@ __attribute__((section(".boot"))) int main(void) { } app_exit(); return 0; -} +} \ No newline at end of file diff --git a/src/ui_common.c b/src/ui_common.c index 349a9da..2244e12 100644 --- a/src/ui_common.c +++ b/src/ui_common.c @@ -20,14 +20,14 @@ unsigned int io_seproxyhal_touch_data_ok(void) { case USTREAM_FINISHED: break; case USTREAM_PROCESSING: - io_seproxyhal_send_status(0x9000); + io_seproxyhal_send_status(SW_OK); #ifdef HAVE_BAGL ui_idle(); #endif // HAVE_BAGL break; case USTREAM_FAULT: reset_app_context(); - io_seproxyhal_send_status(0x6A80); + io_seproxyhal_send_status(SW_ERROR_IN_DATA); #ifdef HAVE_BAGL ui_idle(); #endif // HAVE_BAGL @@ -35,7 +35,7 @@ unsigned int io_seproxyhal_touch_data_ok(void) { default: PRINTF("Unexpected parser status\n"); reset_app_context(); - io_seproxyhal_send_status(0x6A80); + io_seproxyhal_send_status(SW_ERROR_IN_DATA); #ifdef HAVE_BAGL ui_idle(); #endif // HAVE_BAGL @@ -50,7 +50,7 @@ unsigned int io_seproxyhal_touch_data_ok(void) { unsigned int io_seproxyhal_touch_data_cancel(void) { reset_app_context(); - io_seproxyhal_send_status(0x6985); + io_seproxyhal_send_status(SW_INITIALIZATION_ERROR); #ifdef HAVE_BAGL // Display back the original UX ui_idle(); @@ -86,40 +86,32 @@ unsigned int io_seproxyhal_touch_address_cancel(void) { } unsigned int io_seproxyhal_touch_tx_ok(void) { - uint8_t privateKeyData[32]; + uint8_t privateKeyData[64]; uint8_t signature[100]; cx_ecfp_private_key_t privateKey; uint32_t tx = 0; - uint32_t v = getV(&tmpContent.txContent); io_seproxyhal_io_heartbeat(); - os_perso_derive_node_bip32(CX_CURVE_256K1, tmpCtx.transactionContext.derivationPath.path, + CX_THROW(os_derive_bip32_no_throw(CX_CURVE_256K1, tmpCtx.transactionContext.derivationPath.path, tmpCtx.transactionContext.derivationPath.len, - privateKeyData, NULL); - cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32, - &privateKey); + privateKeyData, NULL)); + CX_THROW(cx_ecfp_init_private_key_no_throw(CX_CURVE_256K1, privateKeyData, 32, + &privateKey)); explicit_bzero(privateKeyData, sizeof(privateKeyData)); unsigned int info = 0; + size_t sig_len = sizeof(signature); io_seproxyhal_io_heartbeat(); - cx_ecdsa_sign(&privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256, + CX_THROW(cx_ecdsa_sign_no_throw(&privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256, tmpCtx.transactionContext.hash, - sizeof(tmpCtx.transactionContext.hash), signature, sizeof(signature), &info); + sizeof(tmpCtx.transactionContext.hash), signature, &sig_len, &info)); explicit_bzero(&privateKey, sizeof(privateKey)); - // Parity is present in the sequence tag in the legacy API - if (tmpContent.txContent.vLength == 0) { - // Legacy API - G_io_apdu_buffer[0] = 27; - } - else { - // New API - // Note that this is wrong for a large v, but the client can always recover - G_io_apdu_buffer[0] = (v * 2) + 35; - } + + // For EIP1559 and CIP64 transactions, the Ledger SDK expects v to be + // the parity: 0 | 1 + G_io_apdu_buffer[0] = 0; if (info & CX_ECCINFO_PARITY_ODD) { G_io_apdu_buffer[0]++; } - if (info & CX_ECCINFO_xGTn) { - G_io_apdu_buffer[0] += 2; - } + format_signature_out(signature); tx = 65; G_io_apdu_buffer[tx++] = 0x90; @@ -148,22 +140,24 @@ unsigned int io_seproxyhal_touch_tx_cancel(void) { } unsigned int io_seproxyhal_touch_signMessage_ok(void) { - uint8_t privateKeyData[32]; + uint8_t privateKeyData[64]; uint8_t signature[100]; cx_ecfp_private_key_t privateKey; uint32_t tx = 0; io_seproxyhal_io_heartbeat(); - os_perso_derive_node_bip32( - CX_CURVE_256K1, tmpCtx.messageSigningContext.derivationPath.path, - tmpCtx.messageSigningContext.derivationPath.len, privateKeyData, NULL); + CX_THROW(os_derive_bip32_no_throw( + CX_CURVE_256K1, tmpCtx.messageSigningContext.derivationPath.path, + tmpCtx.messageSigningContext.derivationPath.len, privateKeyData, NULL)); + io_seproxyhal_io_heartbeat(); - cx_ecfp_init_private_key(CX_CURVE_256K1, privateKeyData, 32, &privateKey); + CX_THROW(cx_ecfp_init_private_key_no_throw(CX_CURVE_256K1, privateKeyData, 32, &privateKey)); explicit_bzero(privateKeyData, sizeof(privateKeyData)); unsigned int info = 0; + size_t sig_len = sizeof(signature); io_seproxyhal_io_heartbeat(); - cx_ecdsa_sign(&privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256, + CX_THROW(cx_ecdsa_sign_no_throw(&privateKey, CX_RND_RFC6979 | CX_LAST, CX_SHA256, tmpCtx.messageSigningContext.hash, - sizeof(tmpCtx.messageSigningContext.hash), signature, sizeof(signature), &info); + sizeof(tmpCtx.messageSigningContext.hash), signature, &sig_len, &info)); explicit_bzero(&privateKey, sizeof(privateKey)); G_io_apdu_buffer[0] = 27; if (info & CX_ECCINFO_PARITY_ODD) { diff --git a/src/ui_confirm_selector_nbgl.c b/src/ui_confirm_selector_nbgl.c index 9b6279c..f0c0439 100644 --- a/src/ui_confirm_selector_nbgl.c +++ b/src/ui_confirm_selector_nbgl.c @@ -14,44 +14,35 @@ static void approveCallback(void) { static void confirmationCallback(bool confirm) { if (confirm) { - nbgl_useCaseStatus("SELECTOR\nAPPROVED", true, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_OPERATION_SIGNED, ui_idle); approveCallback(); } else { - nbgl_useCaseStatus("Selector rejected", false, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_OPERATION_REJECTED, ui_idle); rejectCallback(); } } -static void continueCallback(void) { - tagValueList.pairs = tagValuePair; - tagValueList.smallCaseForValue = false; - - infoLongPress.text = "Approve selector"; - infoLongPress.icon = &C_celo_64px; - infoLongPress.longPressText = "Hold to sign"; - infoLongPress.longPressToken = 0; - infoLongPress.tuneId = TUNE_TAP_CASUAL; - - nbgl_useCaseStaticReview(&tagValueList, &infoLongPress, "Cancel", confirmationCallback); -} - void ui_confirm_selector_flow(void) { tagValuePair[0].item = "Selector"; tagValuePair[0].value = (char*)strings.tmp.tmp; + tagValueList.nbMaxLinesForValue = 0; tagValueList.nbPairs = 1; + tagValueList.pairs = tagValuePair; - nbgl_useCaseReviewStart(&C_celo_64px, "Verify selector", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Verify selector", NULL, "Confirm selector", confirmationCallback); } void ui_confirm_parameter_flow(void) { tagValuePair[0].item = "Parameter"; tagValuePair[0].value = (char*)strings.tmp.tmp; + tagValueList.nbMaxLinesForValue = 0; tagValueList.nbPairs = 1; + tagValueList.pairs = tagValuePair; - nbgl_useCaseReviewStart(&C_celo_64px, "Verify", strings.tmp.tmp2, "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Verify", NULL, "Confirm", confirmationCallback); } #endif // HAVE_NBGL diff --git a/src/ui_display_public_nbgl.c b/src/ui_display_public_nbgl.c index 814535c..79376b9 100644 --- a/src/ui_display_public_nbgl.c +++ b/src/ui_display_public_nbgl.c @@ -4,13 +4,13 @@ #include "bolos_target.h" static void address_cancel(void) { - nbgl_useCaseStatus("Address rejected", false, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_REJECTED, ui_idle); io_seproxyhal_touch_address_cancel(); } static void address_confirmation(bool confirm) { if (confirm) { - nbgl_useCaseStatus("ADDRESS\nAPPROVED", true, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_VERIFIED, ui_idle); io_seproxyhal_touch_address_ok(); } else { @@ -18,17 +18,13 @@ static void address_confirmation(bool confirm) { } } -static void address_display(void) { - nbgl_useCaseAddressConfirmation(strings.common.fullAddress, address_confirmation); -} - void ui_display_public_flow(void) { - nbgl_useCaseReviewStart(&C_celo_64px, - "Verify Celo\naddress", - "", - "Cancel", - address_display, - address_cancel); + nbgl_useCaseAddressReview(tmpCtx.publicKeyContext.address, + NULL, + &C_celo_64px, + "Verify Celo\naddress", + NULL, + address_confirmation); } #endif // HAVE_NBGL diff --git a/src/ui_settings_nbgl.c b/src/ui_settings_nbgl.c index ea9aa3c..e1f29a1 100644 --- a/src/ui_settings_nbgl.c +++ b/src/ui_settings_nbgl.c @@ -10,9 +10,8 @@ #define IS_TOUCHABLE false // Forward declaration -static void displaySettingsMenu(void); -static void settingsControlsCallback(int token, uint8_t index); -static bool settingsNavCallback(uint8_t page, nbgl_pageContent_t *content); +static uint8_t initSettingPage; +static void controls_callback(int token, uint8_t index, int page); enum { SWITCH_CONTRACT_DATA_SET_TOKEN = FIRST_USER_TOKEN, @@ -20,44 +19,33 @@ enum { NB_SETTINGS_SWITCHES, }; -static nbgl_layoutSwitch_t switches[NB_SETTINGS_SWITCHES - FIRST_USER_TOKEN]; +static nbgl_contentSwitch_t switches[NB_SETTINGS_SWITCHES - FIRST_USER_TOKEN]; -static const char* const infoTypes[] = {"Version", "Celo App"}; -static const char* const infoContents[] = {APPVERSION, "(c) 2022 Ledger"}; +static const char* const infoTypes[NB_INFO_FIELDS] = {"Version", "Celo App"}; +static const char* const infoContents[NB_INFO_FIELDS] = {APPVERSION, "(c) 2022 Ledger"}; static void onQuitCallback(void) { os_sched_exit(-1); } -static bool settingsNavCallback(uint8_t page, nbgl_pageContent_t *content) { - if (page == 0) { - content->type = INFOS_LIST; - content->infosList.nbInfos = NB_INFO_FIELDS; - content->infosList.infoTypes = (const char**) infoTypes; - content->infosList.infoContents = (const char**) infoContents; - } - else if (page == 1) { - switches[0].text = "Contract data"; - switches[0].subText = "Allow contract data\nin transactions"; - switches[0].token = SWITCH_CONTRACT_DATA_SET_TOKEN; - switches[0].tuneId = TUNE_TAP_CASUAL; - switches[0].initState = N_storage.dataAllowed; +static const nbgl_contentInfoList_t infoList = { + .nbInfos = NB_INFO_FIELDS, + .infoTypes = (const char**) infoTypes, + .infoContents = (const char**) infoContents, +}; - switches[1].text = "Debug data"; - switches[1].subText = "Display contract data details"; - switches[1].token = SWITCH_DEBUG_DATA_SET_TOKEN; - switches[1].tuneId = TUNE_TAP_CASUAL; - switches[1].initState = N_storage.contractDetails; - content->type = SWITCHES_LIST; - content->switchesList.nbSwitches = NB_SETTINGS_SWITCHES - FIRST_USER_TOKEN, - content->switchesList.switches = (nbgl_layoutSwitch_t*) switches; - } - else { - return false; - } - return true; -} +// settings menu definition +#define SETTING_CONTENTS_NB 1 +static const nbgl_content_t contents[SETTING_CONTENTS_NB] = { + {.type = SWITCHES_LIST, + .content.switchesList.nbSwitches = NB_SETTINGS_SWITCHES - FIRST_USER_TOKEN, + .content.switchesList.switches = (nbgl_layoutSwitch_t*) switches, + .contentActionCallback = controls_callback}}; + +static const nbgl_genericContents_t settingContents = {.callbackCallNeeded = false, + .contentsList = contents, + .nbContents = SETTING_CONTENTS_NB}; static void switch_settings_contract_data() { uint8_t value = (N_storage.dataAllowed ? 0 : 1); @@ -68,14 +56,14 @@ static void switch_settings_display_data() { uint8_t value = (N_storage.contractDetails ? 0 : 1); nvm_write(&N_storage.contractDetails, (void*)&value, sizeof(uint8_t)); } - -static void settingsControlsCallback(int token, uint8_t index) { +static void controls_callback(int token, uint8_t index, int page) { UNUSED(index); + initSettingPage = page; switch(token) { case SWITCH_CONTRACT_DATA_SET_TOKEN: switch_settings_contract_data(); - break; + break; case SWITCH_DEBUG_DATA_SET_TOKEN: switch_settings_display_data(); @@ -88,19 +76,31 @@ static void settingsControlsCallback(int token, uint8_t index) { switches[0].initState = N_storage.dataAllowed; switches[1].initState = N_storage.contractDetails; - - displaySettingsMenu(); -} - -static void displaySettingsMenu(void) { - nbgl_useCaseSettings("Celo settings", PAGE_START, NB_PAGE_SETTING, IS_TOUCHABLE, ui_idle, - settingsNavCallback, settingsControlsCallback); } void ui_idle(void) { - nbgl_useCaseHome("Celo", &C_celo_64px, - NULL, true, - displaySettingsMenu, onQuitCallback); + switches[0].initState = N_storage.dataAllowed; + switches[0].text = "Contract data"; + switches[0].subText = "Allow contract data\nin transactions"; + switches[0].token = SWITCH_CONTRACT_DATA_SET_TOKEN; + switches[0].tuneId = TUNE_TAP_CASUAL; + + switches[1].initState = N_storage.contractDetails; + switches[1].text = "Debug data"; + switches[1].subText = "Display contract data details"; + switches[1].token = SWITCH_DEBUG_DATA_SET_TOKEN; + switches[1].tuneId = TUNE_TAP_CASUAL; + + nbgl_useCaseHomeAndSettings( + "Celo", + &C_celo_64px, + NULL, + INIT_HOME_PAGE, + &settingContents, + &infoList, + NULL, + onQuitCallback + ); } #endif // HAVE_NBGL diff --git a/src/ui_sign_nbgl.c b/src/ui_sign_nbgl.c index 7d16d78..3486429 100644 --- a/src/ui_sign_nbgl.c +++ b/src/ui_sign_nbgl.c @@ -5,13 +5,13 @@ #include "bolos_target.h" static void sign_cancel(void) { - nbgl_useCaseStatus("Message rejected", false, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_REJECTED, ui_idle); io_seproxyhal_touch_signMessage_cancel(); } static void sign_confirmation(bool confirm) { if (confirm) { - nbgl_useCaseStatus("MESSAGE\nAPPROVED", true, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_SIGNED, ui_idle); io_seproxyhal_touch_signMessage_ok(); } else { @@ -19,7 +19,7 @@ static void sign_confirmation(bool confirm) { } } -static void sign_display(void) { +void ui_display_sign_flow(void) { tagValuePair[0].item = "Message hash"; tagValuePair[0].value = (char*)strings.common.fullAddress; @@ -27,21 +27,6 @@ static void sign_display(void) { tagValueList.pairs = tagValuePair; tagValueList.smallCaseForValue = false; - infoLongPress.text = "Sign message"; - infoLongPress.icon = &C_celo_64px; - infoLongPress.longPressText = "Hold to sign"; - infoLongPress.longPressToken = 0; - infoLongPress.tuneId = TUNE_TAP_CASUAL; - - nbgl_useCaseStaticReview(&tagValueList, &infoLongPress, "Cancel", sign_confirmation); -} - -void ui_display_sign_flow(void) { - nbgl_useCaseReviewStart(&C_celo_64px, - "Review message", - "", - "Cancel", - sign_display, - sign_cancel); + nbgl_useCaseReview(TYPE_MESSAGE, &tagValueList, &C_celo_64px, "Review message", NULL, "Sign message", sign_confirmation); } #endif // HAVE_NBGL diff --git a/src/ui_tx_nbgl.c b/src/ui_tx_nbgl.c index c26222a..56548de 100644 --- a/src/ui_tx_nbgl.c +++ b/src/ui_tx_nbgl.c @@ -14,11 +14,11 @@ static void approveCallback(void) { static void confirmationCallback(bool confirm) { if (confirm) { - nbgl_useCaseStatus("TRANSACTION\nAPPROVED", true, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_SIGNED, ui_idle); approveCallback(); } else { - nbgl_useCaseStatus("Transaction rejected", false, ui_idle); + nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_REJECTED, ui_idle); rejectCallback(); } } @@ -36,7 +36,7 @@ static void continueCallback(void) { } static void warningCallback(void) { - nbgl_useCaseReviewStart(&C_warning64px, "WARNING", "Data present", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReviewStart(&C_Warning_64px, "WARNING", "Data present", "Cancel", continueCallback, rejectCallback); } static void fill_data_tx(void) { @@ -50,6 +50,7 @@ static void fill_data_tx(void) { tagValuePair[2].value = (char*)strings.common.maxFee; tagValueList.nbPairs = 3; + tagValueList.pairs = tagValuePair; } static void fill_gateway_tx(void) { @@ -69,6 +70,7 @@ static void fill_gateway_tx(void) { tagValuePair[4].value = (char*)strings.common.fullGatewayAddress; tagValueList.nbPairs = 5; + tagValueList.pairs = tagValuePair; } static void fill_lock_relock(void) { @@ -82,6 +84,7 @@ static void fill_lock_relock(void) { tagValuePair[2].value = (char*)strings.common.maxFee; tagValueList.nbPairs = 3; + tagValueList.pairs = tagValuePair; } static void fill_withdraw_or_create_account(void) { @@ -92,6 +95,7 @@ static void fill_withdraw_or_create_account(void) { tagValuePair[1].value = (char*)strings.common.maxFee; tagValueList.nbPairs = 2; + tagValueList.pairs = tagValuePair; } static void fill_activate(void) { @@ -105,6 +109,7 @@ static void fill_activate(void) { tagValuePair[2].value = (char*)strings.common.maxFee; tagValueList.nbPairs = 3; + tagValueList.pairs = tagValuePair; } static void fill_vote_revoke(void) { @@ -121,11 +126,12 @@ static void fill_vote_revoke(void) { tagValuePair[3].value = (char*)strings.common.maxFee; tagValueList.nbPairs = 4; + tagValueList.pairs = tagValuePair; } void ui_approval_celo_tx_flow(void) { fill_data_tx(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback); } void ui_approval_celo_data_warning_tx_flow(void) { @@ -135,7 +141,7 @@ void ui_approval_celo_data_warning_tx_flow(void) { void ui_approval_celo_gateway_tx_flow(void) { fill_gateway_tx(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback); } void ui_approval_celo_data_warning_gateway_tx_flow(void) { @@ -145,32 +151,31 @@ void ui_approval_celo_data_warning_gateway_tx_flow(void) { void ui_approval_celo_lock_unlock_flow(void) { fill_lock_relock(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback); } void ui_approval_celo_relock_flow(void) { fill_lock_relock(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback); } void ui_approval_celo_withdraw_flow(void) { fill_withdraw_or_create_account(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback); } void ui_approval_celo_create_account_flow(void) { fill_withdraw_or_create_account(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); -} + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback);} void ui_approval_celo_activate_flow(void) { fill_activate(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback); } void ui_approval_celo_vote_revoke_flow(void) { fill_vote_revoke(); - nbgl_useCaseReviewStart(&C_celo_64px, "Review transaction", "", "Cancel", continueCallback, rejectCallback); + nbgl_useCaseReview(TYPE_TRANSACTION, &tagValueList, &C_celo_64px, "Review transaction", NULL, "Approve Transaction", confirmationCallback); } #endif // HAVE_NBGL diff --git a/src/utils.h b/src/utils.h index 5509d56..1999e2e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -22,10 +22,29 @@ #include "uint256.h" +/** + * Converts a binary array to a hexadecimal string representation. + * + * @param strbuf [out] The buffer to store the hexadecimal string. + * @param bin [in] The binary array to convert. + * @param len [in] The length of the binary array. + */ void array_hexstr(char *strbuf, const void *bin, size_t len); +/** + * Converts a big-endian byte array to a uint256_t target. + * + * @param data [in] The big-endian byte array to convert. + * @param length [in] The length of the byte array. + * @param target [out] The target uint256_t to store the converted value. + */ void convertUint256BE(const uint8_t *data, uint32_t length, uint256_t *target); +/** + * Retrieves the V value from the transaction content. + * + * @param txContent [in] The transaction content. + * @return The V value. + */ uint32_t getV(txContent_t *txContent); - -#endif /* _UTILS_H_ */ +#endif /* _UTILS_H_ */ \ No newline at end of file diff --git a/src_common/ethUstream.c b/src_common/ethUstream.c index 0c65a8f..47ffd37 100644 --- a/src_common/ethUstream.c +++ b/src_common/ethUstream.c @@ -15,16 +15,26 @@ * limitations under the License. ********************************************************************************/ -#include "ethUstream.h" -#include "rlp.h" #include #include +#include "ethUstream.h" +#include "rlp.h" + + #ifdef TESTING #define PRINTF(...) #endif +/** + * @brief Reads a byte from the transaction buffer. + * + * @param[in,out] context The transaction context. + * @param[out] byte The byte read from the buffer. + * + * @return 0 if successful, -1 if underflow occurs. + */ static int readTxByte(txContext_t *context, uint8_t *byte) { uint8_t data; @@ -40,7 +50,7 @@ static int readTxByte(txContext_t *context, uint8_t *byte) { } #ifndef TESTING if (!(context->processingField && context->fieldSingleByte)) { - cx_hash((cx_hash_t*)context->sha3, 0, &data, 1, NULL, 0); + CX_THROW(cx_hash_no_throw((cx_hash_t*)context->sha3, 0, &data, 1, NULL, 0)); } #endif if (byte) { @@ -49,6 +59,15 @@ static int readTxByte(txContext_t *context, uint8_t *byte) { return 0; } +/** + * @brief Copies data from the transaction buffer to the output buffer. + * + * @param[in,out] context The transaction context. + * @param[out] out The output buffer. + * @param[in] length The length of data to be copied. + * + * @return 0 if successful, -1 if underflow occurs. + */ int copyTxData(txContext_t *context, uint8_t *out, size_t length) { if (context->commandLength < length) { PRINTF("copyTxData Underflow\n"); @@ -59,7 +78,7 @@ int copyTxData(txContext_t *context, uint8_t *out, size_t length) { } #ifndef TESTING if (!(context->processingField && context->fieldSingleByte)) { - cx_hash((cx_hash_t*)context->sha3, 0, context->workBuffer, length, NULL, 0); + CX_THROW(cx_hash_no_throw((cx_hash_t*)context->sha3, 0, context->workBuffer, length, NULL, 0)); } #endif context->workBuffer += length; @@ -70,27 +89,76 @@ int copyTxData(txContext_t *context, uint8_t *out, size_t length) { return 0; } -static int processContent(txContext_t *context) { +/** + * @brief Processes the RLP_CONTENT field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processContent(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } // Keep the full length for sanity checks, move to the next field if (!context->currentFieldIsList) { PRINTF("Invalid type for RLP_CONTENT\n"); - return -1; + return true; } context->dataLength = context->currentFieldLength; context->currentField++; context->processingField = false; - return 0; + return false; } +/** + * @brief Processes the RLP_ACCESS_LIST field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processAccessList(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } + if (!context->currentFieldIsList) { + PRINTF("Invalid type for RLP_ACCESS_LIST\n"); + return true; + } + if (context->currentFieldPos < context->currentFieldLength) { + uint32_t copySize = + MIN(context->commandLength, context->currentFieldLength - context->currentFieldPos); + copyTxData(context, NULL, copySize); + } + if (context->currentFieldPos == context->currentFieldLength) { + context->currentField++; + context->processingField = false; + } + return false; +} -static int processType(txContext_t *context) { +/** + * @brief Processes the RLP_TYPE field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processType(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_TYPE\n"); - return -1; + return true; } if (context->currentFieldLength > MAX_INT256) { PRINTF("Invalid length for RLP_TYPE\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -99,24 +167,35 @@ static int processType(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, NULL, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { context->currentField++; context->processingField = false; } - return 0; + return false; } -static int processNonce(txContext_t *context) { +/** + * @brief Processes the RLP_NONCE field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processNonce(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_NONCE\n"); - return -1; + return true; } if (context->currentFieldLength > MAX_INT256) { PRINTF("Invalid length for RLP_NONCE\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -125,25 +204,36 @@ static int processNonce(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, NULL, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { context->currentField++; context->processingField = false; } - return 0; + return false; } -static int processStartGas(txContext_t *context) { +/** + * @brief Processes the RLP_STARTGAS field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processStartGas(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_STARTGAS\n"); - return -1; + return true; } if (context->currentFieldLength > MAX_INT256) { PRINTF("Invalid length for RLP_STARTGAS %d\n", context->currentFieldLength); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -152,7 +242,7 @@ static int processStartGas(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, context->content->startgas.value + context->currentFieldPos, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { @@ -160,17 +250,28 @@ static int processStartGas(txContext_t *context) { context->currentField++; context->processingField = false; } - return 0; + return false; } -static int processGasprice(txContext_t *context) { +/** + * @brief Processes the RLP_GASPRICE field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processGasprice(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_GASPRICE\n"); - return -1; + return true; } if (context->currentFieldLength > MAX_INT256) { PRINTF("Invalid length for RLP_GASPRICE\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -179,7 +280,7 @@ static int processGasprice(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, context->content->gasprice.value + context->currentFieldPos, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { @@ -187,44 +288,28 @@ static int processGasprice(txContext_t *context) { context->currentField++; context->processingField = false; } - return 0; + return false; } -static int processGatewayFee(txContext_t *context) { - if (context->currentFieldIsList) { - PRINTF("Invalid type for RLP_GATEWAYFEE\n"); - return -1; - } - if (context->currentFieldLength > MAX_INT256) { - PRINTF("Invalid length for RLP_GATEWAYFEE\n"); - return -1; - } - if (context->currentFieldPos < context->currentFieldLength) { - uint32_t copySize = - (context->commandLength < - ((context->currentFieldLength - context->currentFieldPos)) - ? context->commandLength - : context->currentFieldLength - context->currentFieldPos); - if (copyTxData(context, context->content->gatewayFee.value + context->currentFieldPos, copySize)) { - return -1; - } - } - if (context->currentFieldPos == context->currentFieldLength) { - context->content->gatewayFee.length = context->currentFieldLength; - context->currentField++; - context->processingField = false; +/** + * @brief Processes the RLP_FEECURRENCY field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processFeeCurrency(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; } - return 0; -} - -static int processFeeCurrency(txContext_t *context) { if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_FEECURRENCY\n"); - return -1; + return true; } if (context->currentFieldLength > MAX_ADDRESS) { PRINTF("Invalid length for RLP_FEECURRENCY\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -233,7 +318,7 @@ static int processFeeCurrency(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, context->content->feeCurrency + context->currentFieldPos, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { @@ -241,44 +326,28 @@ static int processFeeCurrency(txContext_t *context) { context->currentField++; context->processingField = false; } - return 0; + return false; } -static int processGatewayTo(txContext_t *context) { - if (context->currentFieldIsList) { - PRINTF("Invalid type for RLP_GATEWAYTO\n"); - return -1; - } - if (context->currentFieldLength != 0 && context->currentFieldLength != MAX_ADDRESS) { - PRINTF("Invalid length for RLP_GATEWAYTO\n"); - return -1; - } - if (context->currentFieldPos < context->currentFieldLength) { - uint32_t copySize = - (context->commandLength < - ((context->currentFieldLength - context->currentFieldPos)) - ? context->commandLength - : context->currentFieldLength - context->currentFieldPos); - if (copyTxData(context, context->content->gatewayDestination + context->currentFieldPos, copySize)) { - return -1; - } - } - if (context->currentFieldPos == context->currentFieldLength) { - context->content->gatewayDestinationLength = context->currentFieldLength; - context->currentField++; - context->processingField = false; +/** + * @brief Processes the RLP_VALUE field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processValue(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; } - return 0; -} - -static int processValue(txContext_t *context) { if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_VALUE\n"); - return -1; + return true; } if (context->currentFieldLength > MAX_INT256) { PRINTF("Invalid length for RLP_VALUE\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -287,7 +356,7 @@ static int processValue(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, context->content->value.value + context->currentFieldPos, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { @@ -295,17 +364,28 @@ static int processValue(txContext_t *context) { context->currentField++; context->processingField = false; } - return 0; + return false; } -static int processTo(txContext_t *context) { +/** + * @brief Processes the RLP_TO field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processTo(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_TO\n"); - return -1; + return true; } if (context->currentFieldLength != 0 && context->currentFieldLength != MAX_ADDRESS) { PRINTF("Invalid length for RLP_TO\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -314,7 +394,7 @@ static int processTo(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, context->content->destination + context->currentFieldPos, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { @@ -322,13 +402,24 @@ static int processTo(txContext_t *context) { context->currentField++; context->processingField = false; } - return 0; + return false; } -static int processData(txContext_t *context) { +/** + * @brief Processes the RLP_DATA field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processData(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_DATA\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -337,24 +428,86 @@ static int processData(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, NULL, copySize)) { - return -1; + return true; } } if (context->currentFieldPos == context->currentFieldLength) { context->currentField++; context->processingField = false; } + return false; +} + +/** + * @brief Processes a discarded field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processAndDiscard(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } + if (context->currentFieldIsList) { + PRINTF("Invalid type for Discarded field\n"); + return true; + } + if (context->currentFieldPos < context->currentFieldLength) { + uint32_t copySize = + MIN(context->commandLength, context->currentFieldLength - context->currentFieldPos); + copyTxData(context, NULL, copySize); + } + if (context->currentFieldPos == context->currentFieldLength) { + context->currentField++; + context->processingField = false; + } + return false; +} +#define NUM_CHAIN_IDS 3 + // Mainnet, Alfajores, Baklava, +static const uint16_t AUTHORIZED_CHAIN_IDS[NUM_CHAIN_IDS] = {42220, 44787, 17323}; + +/** + * @brief Checks if the given chain ID is authorized. + * + * @param[in] chainID The chain ID to check. + * + * @return 1 if authorized, 0 otherwise. + */ +static int isChainIDAuthorized(uint8_t chainID[4]) { + if(chainID == NULL) { + return 0; + } + uint16_t chainIDInt = (chainID[0] << 8) | chainID[1]; + for (int i = 0; i < NUM_CHAIN_IDS; i++) { + if (chainIDInt == AUTHORIZED_CHAIN_IDS[i]) { + return 1; + } + } return 0; } -static int processV(txContext_t *context) { +/** + * @brief Processes the RLP_V field. + * + * @param[in,out] context The transaction context. + * + * @return false if successful, true if an error occurs. + */ +static bool processV(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_V\n"); - return -1; + return true; } if (context->currentFieldLength > MAX_V) { PRINTF("Invalid length for RLP_V\n"); - return -1; + return true; } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = @@ -363,7 +516,11 @@ static int processV(txContext_t *context) { ? context->commandLength : context->currentFieldLength - context->currentFieldPos); if (copyTxData(context, context->content->v + context->currentFieldPos, copySize)) { - return -1; + return true; + } + if (!isChainIDAuthorized(context->content->v)) { + PRINTF("ChainID not authorized\n"); + return true; } } if (context->currentFieldPos == context->currentFieldLength) { @@ -371,19 +528,212 @@ static int processV(txContext_t *context) { context->currentField++; context->processingField = false; } - return 0; + return false; } +/** + * @brief Processes a CIP64 transaction. + * + * @param[in,out] context The transaction context. + * + * @return false if the transaction is processed successfully, true otherwise. + */ +static bool processCIP64Tx(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } + switch (context->currentField) { + case CIP64_RLP_CONTENT: { + if(processContent(context)) { + return true; + } + if ((context->processingFlags & TX_FLAG_TYPE) == 0) { + context->currentField++; + } + return false; + } + // This gets hit only by Wanchain + case CIP64_RLP_TYPE: { + return processType(context); + } + case CIP64_RLP_CHAINID: { + return processV(context); + } + case CIP64_RLP_NONCE: { + return processNonce(context); + } + case CIP64_RLP_MAX_PRIORITY_FEE_PER_GAS: { + return processAndDiscard(context); + } + case CIP64_RLP_MAX_FEE_PER_GAS: { + return processGasprice(context); + } + case CIP64_RLP_GASLIMIT: { + return processStartGas(context); + } + case CIP64_RLP_TO: { + return processTo(context); + } + case CIP64_RLP_VALUE: { + return processValue(context); + } + case CIP64_RLP_DATA: { + return processData(context); + } + case CIP64_RLP_ACCESS_LIST: { + return processAccessList(context); + } + case CIP64_RLP_FEECURRENCY: { + return processFeeCurrency(context); + } + default: + PRINTF("Invalid RLP decoder context\n"); + return true; + } +} +/** + * @brief Processes an EIP1559 transaction. + * + * @param[in,out] context The transaction context. + * + * @return false if the transaction is processed successfully, true otherwise. + */ +static bool processEIP1559Tx(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return true; + } + switch (context->currentField) { + case EIP1559_RLP_CONTENT: { + if(processContent(context)) { + return true; + } + if ((context->processingFlags & TX_FLAG_TYPE) == 0) { + context->currentField++; + } + return false; + } + case EIP1559_RLP_TYPE: { + return processType(context); + } + case EIP1559_RLP_CHAINID: { + return processV(context); + } + case EIP1559_RLP_NONCE: { + return processNonce(context); + } + case EIP1559_RLP_MAX_FEE_PER_GAS: { + return processGasprice(context); + } + case EIP1559_RLP_GASLIMIT: { + return processStartGas(context); + } + case EIP1559_RLP_TO: { + return processTo(context); + } + case EIP1559_RLP_VALUE: { + return processValue(context); + } + case EIP1559_RLP_DATA: { + return processData(context); + } + case EIP1559_RLP_ACCESS_LIST: { + return processAccessList(context); + } + case EIP1559_RLP_MAX_PRIORITY_FEE_PER_GAS: { + return processAndDiscard(context); + } + default: + PRINTF("Invalid RLP decoder context\n"); + return true; + } +} + +/** + * @brief Parses the RLP buffer and decodes the current field. + * + * @param[in,out] context The transaction context. + * + * @return USTREAM_PROCESSING if the RLP buffer is being processed, USTREAM_FAULT if there is an error, USTREAM_PROCESSING if more data is needed. + */ +static parserStatus_e parseRLP(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return USTREAM_FAULT; + } + bool canDecode = false; + uint32_t offset; + while (context->commandLength != 0) { + bool valid; + // Feed the RLP buffer until the length can be decoded + uint8_t byte; + if (readTxByte(context, &byte)) { + return USTREAM_FAULT; + } + context->rlpBuffer[context->rlpBufferPos++] = byte; + if (rlpCanDecode(context->rlpBuffer, context->rlpBufferPos, &valid)) { + // Can decode now, if valid + if (!valid) { + PRINTF("RLP pre-decode error\n"); + return USTREAM_FAULT; + } + canDecode = true; + break; + } + // Cannot decode yet + // Sanity check + if (context->rlpBufferPos == sizeof(context->rlpBuffer)) { + PRINTF("RLP pre-decode logic error\n"); + return USTREAM_FAULT; + } + } + if (!canDecode) { + return USTREAM_PROCESSING; + } + // Ready to process this field + if (!rlpDecodeLength(context->rlpBuffer, context->rlpBufferPos, + &context->currentFieldLength, &offset, + &context->currentFieldIsList)) { + PRINTF("RLP decode error\n"); + return USTREAM_FAULT; + } + if (offset == 0) { + // Hack for single byte, self encoded + context->workBuffer--; + context->commandLength++; + context->fieldSingleByte = true; + } else { + context->fieldSingleByte = false; + } + context->currentFieldPos = 0; + context->rlpBufferPos = 0; + context->processingField = true; + return USTREAM_PROCESSING; +} + +/** + * @brief Processes the transaction fields based on the transaction type. + * + * @param[in,out] context The transaction context. + * + * @return USTREAM_FINISHED if the transaction processing is complete, USTREAM_PROCESSING if more data is needed, USTREAM_FAULT if there is an error. + */ static parserStatus_e processTxInternal(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return USTREAM_FAULT; + } for (;;) { customStatus_e customStatus = CUSTOM_NOT_HANDLED; - // EIP 155 style transasction - if (context->currentField == TX_RLP_DONE) { + // EIP 155 style transaction + if (PARSING_IS_DONE(context)) { + PRINTF("Parsing done\n"); return USTREAM_FINISHED; } // Old style transaction - if ((context->currentField == TX_RLP_V) && (context->commandLength == 0)) { + if ((context->txType == CELO_LEGACY && context->currentField == CELO_LEGACY_RLP_V) && (context->commandLength == 0)) { context->content->vLength = 0; // We don't want to support old style transactions. We treat an empty V as a false positive // - data ended exactly on the APDU boundary, and so we tell the processing to continue. @@ -393,54 +743,10 @@ static parserStatus_e processTxInternal(txContext_t *context) { return USTREAM_PROCESSING; } if (!context->processingField) { - bool canDecode = false; - uint32_t offset; - while (context->commandLength != 0) { - bool valid; - // Feed the RLP buffer until the length can be decoded - uint8_t byte; - if (readTxByte(context, &byte)) { - return USTREAM_FAULT; - } - context->rlpBuffer[context->rlpBufferPos++] = byte; - if (rlpCanDecode(context->rlpBuffer, context->rlpBufferPos, - &valid)) { - // Can decode now, if valid - if (!valid) { - PRINTF("RLP pre-decode error\n"); - return USTREAM_FAULT; - } - canDecode = true; - break; - } - // Cannot decode yet - // Sanity check - if (context->rlpBufferPos == sizeof(context->rlpBuffer)) { - PRINTF("RLP pre-decode logic error\n"); - return USTREAM_FAULT; - } - } - if (!canDecode) { - return USTREAM_PROCESSING; - } - // Ready to process this field - if (!rlpDecodeLength(context->rlpBuffer, context->rlpBufferPos, - &context->currentFieldLength, &offset, - &context->currentFieldIsList)) { - PRINTF("RLP decode error\n"); - return USTREAM_FAULT; - } - if (offset == 0) { - // Hack for single byte, self encoded - context->workBuffer--; - context->commandLength++; - context->fieldSingleByte = true; - } else { - context->fieldSingleByte = false; + parserStatus_e status = parseRLP(context); + if(status != USTREAM_PROCESSING) { + return status; } - context->currentFieldPos = 0; - context->rlpBufferPos = 0; - context->processingField = true; } if (context->customProcessor != NULL) { customStatus = context->customProcessor(context); @@ -459,97 +765,76 @@ static parserStatus_e processTxInternal(txContext_t *context) { } } if (customStatus == CUSTOM_NOT_HANDLED) { - switch (context->currentField) { - case TX_RLP_CONTENT: - if (processContent(context)) { - return USTREAM_FAULT; - } - context->currentField++; - break; - case TX_RLP_TYPE: - if (processType(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_NONCE: - if (processNonce(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_GASPRICE: - if (processGasprice(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_STARTGAS: - if (processStartGas(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_VALUE: - if (processValue(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_TO: - if (processTo(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_FEECURRENCY: - if (processFeeCurrency(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_GATEWAYTO: - if (processGatewayTo(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_GATEWAYFEE: - if (processGatewayFee(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_DATA: - case TX_RLP_R: - case TX_RLP_S: - if (processData(context)) { - return USTREAM_FAULT; - } - break; - case TX_RLP_V: - if (processV(context)) { + switch(context->txType) { + case EIP1559: + if (processEIP1559Tx(context)) { + return USTREAM_FAULT; + } + break; + case CIP64: + if (processCIP64Tx(context)) { + return USTREAM_FAULT; + } + break; + default: + PRINTF("Transaction type %d not supported\n", context->txType); return USTREAM_FAULT; - } - break; - default: - PRINTF("Invalid RLP decoder context\n"); - return USTREAM_FAULT; } } } } +/** + * @brief Processes the transaction. + * + * @param[in,out] context The transaction context. + * @param[in] buffer The input buffer containing the transaction data. + * @param[in] length The length of the input buffer. + * + * @return USTREAM_FINISHED if the transaction processing is complete, USTREAM_PROCESSING if more data is needed, USTREAM_FAULT if there is an error. + */ parserStatus_e processTx(txContext_t *context, const uint8_t *buffer, size_t length) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return USTREAM_FAULT; + } context->workBuffer = buffer; context->commandLength = length; return processTxInternal(context); } +/** + * @brief Continues processing the transaction. + * + * @param[in,out] context The transaction context. + * + * @return USTREAM_FINISHED if the transaction processing is complete, USTREAM_PROCESSING if more data is needed, USTREAM_FAULT if there is an error. + */ parserStatus_e continueTx(txContext_t *context) { + if (context == NULL) { + PRINTF("Context pointer is NULL\n"); + return USTREAM_FAULT; + } return processTxInternal(context); } -void initTx(txContext_t *context, cx_sha3_t *sha3, txContent_t *content, - ustreamProcess_t customProcessor, void *extra) { +/** + * @brief Initializes the transaction context. + * + * @param[in,out] context The transaction context. + * @param[in] sha3 The SHA3 context. + * @param[in] content The transaction content. + * @param[in] customProcessor The custom processor function. + * @param[in] extra Additional data for the custom processor. + */ +void initTx(txContext_t *context, cx_sha3_t *sha3, txContent_t *content, ustreamProcess_t customProcessor, void *extra) { memset(context, 0, sizeof(txContext_t)); context->sha3 = sha3; context->content = content; context->customProcessor = customProcessor; context->extra = extra; - context->currentField = TX_RLP_CONTENT; + context->currentField = CELO_LEGACY_RLP_CONTENT; #ifndef TESTING - cx_keccak_init(context->sha3, 256); + CX_THROW(cx_keccak_init_no_throw(context->sha3, 256)); #endif } diff --git a/src_common/ethUstream.h b/src_common/ethUstream.h index 5b5b1f5..6aa2c0a 100644 --- a/src_common/ethUstream.h +++ b/src_common/ethUstream.h @@ -24,6 +24,9 @@ #ifdef TESTING typedef void * cx_sha3_t; +#ifndef MIN +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +#endif #else #include "os.h" #include "cx.h" @@ -33,8 +36,78 @@ typedef void * cx_sha3_t; #define MAX_ADDRESS 20 #define MAX_V 4 +#define TX_FLAG_TYPE 0x01 + +// First variant of every Tx enum. +#define RLP_NONE 0 + +#define PARSING_IS_DONE(ctx) \ + ((ctx->txType == CELO_LEGACY && ctx->currentField == CELO_LEGACY_RLP_DONE) || \ + (ctx->txType == CIP64 && ctx->currentField == CIP64_RLP_DONE) || \ + (ctx->txType == EIP1559 && ctx->currentField == EIP1559_RLP_DONE)) + +typedef enum rlpCeloLegacyTxField_e { + CELO_LEGACY_RLP_NONE = RLP_NONE, + CELO_LEGACY_RLP_CONTENT, + CELO_LEGACY_RLP_TYPE, + CELO_LEGACY_RLP_NONCE, + CELO_LEGACY_RLP_GASPRICE, + CELO_LEGACY_RLP_STARTGAS, + CELO_LEGACY_RLP_FEECURRENCY, + CELO_LEGACY_RLP_GATEWAYTO, + CELO_LEGACY_RLP_GATEWAYFEE, + CELO_LEGACY_RLP_TO, + CELO_LEGACY_RLP_VALUE, + CELO_LEGACY_RLP_DATA, + CELO_LEGACY_RLP_V, + CELO_LEGACY_RLP_R, + CELO_LEGACY_RLP_S, + CELO_LEGACY_RLP_DONE +} rlpCeloLegacyTxField_e; + +typedef enum rlpCIP64TxField_e { + CIP64_RLP_NONE = RLP_NONE, + CIP64_RLP_CONTENT, + CIP64_RLP_TYPE, + CIP64_RLP_CHAINID, + CIP64_RLP_NONCE, + CIP64_RLP_MAX_PRIORITY_FEE_PER_GAS, + CIP64_RLP_MAX_FEE_PER_GAS, + CIP64_RLP_GASLIMIT, + CIP64_RLP_TO, + CIP64_RLP_VALUE, + CIP64_RLP_DATA, + CIP64_RLP_ACCESS_LIST, + CIP64_RLP_FEECURRENCY, + CIP64_RLP_DONE +} rlpCIP64TxField_e; + +typedef enum rlpEIP1559TxField_e { + EIP1559_RLP_NONE = RLP_NONE, + EIP1559_RLP_CONTENT, + EIP1559_RLP_TYPE, + EIP1559_RLP_CHAINID, + EIP1559_RLP_NONCE, + EIP1559_RLP_MAX_PRIORITY_FEE_PER_GAS, + EIP1559_RLP_MAX_FEE_PER_GAS, + EIP1559_RLP_GASLIMIT, + EIP1559_RLP_TO, + EIP1559_RLP_VALUE, + EIP1559_RLP_DATA, + EIP1559_RLP_ACCESS_LIST, + EIP1559_RLP_DONE +} rlpEIP1559TxField_e; + + struct txContext_t; +// Valid transaction types +typedef enum txType_e { + CELO_LEGACY = 0x01, + EIP1559 = 0x02, + CIP64 = 0x7b, // 123 +} txType_e; + typedef enum customStatus_e { CUSTOM_NOT_HANDLED, CUSTOM_HANDLED, @@ -44,24 +117,6 @@ typedef enum customStatus_e { typedef customStatus_e (*ustreamProcess_t)(struct txContext_t *context); -typedef enum rlpTxField_e { - TX_RLP_NONE = 0, - TX_RLP_CONTENT, - TX_RLP_TYPE, - TX_RLP_NONCE, - TX_RLP_GASPRICE, - TX_RLP_STARTGAS, - TX_RLP_FEECURRENCY, - TX_RLP_GATEWAYTO, - TX_RLP_GATEWAYFEE, - TX_RLP_TO, - TX_RLP_VALUE, - TX_RLP_DATA, - TX_RLP_V, - TX_RLP_R, - TX_RLP_S, - TX_RLP_DONE -} rlpTxField_e; typedef enum parserStatus_e { USTREAM_PROCESSING, @@ -92,7 +147,7 @@ typedef struct txContent_t { } txContent_t; typedef struct txContext_t { - rlpTxField_e currentField; + uint8_t currentField; cx_sha3_t *sha3; uint32_t currentFieldLength; uint32_t currentFieldPos; @@ -104,9 +159,11 @@ typedef struct txContext_t { uint32_t rlpBufferPos; const uint8_t *workBuffer; uint32_t commandLength; + uint32_t processingFlags; ustreamProcess_t customProcessor; txContent_t *content; void *extra; + uint8_t txType; } txContext_t; void initTx(txContext_t *context, cx_sha3_t *sha3, txContent_t *content, diff --git a/src_common/ethUtils.c b/src_common/ethUtils.c index 794fb3d..9968184 100644 --- a/src_common/ethUtils.c +++ b/src_common/ethUtils.c @@ -61,8 +61,8 @@ char convertDigit(uint8_t *address, uint8_t index, uint8_t *hash) { void getEthAddressStringFromKey(const cx_ecfp_public_key_t *publicKey, char *out, cx_sha3_t *sha3Context) { uint8_t hashAddress[32]; - cx_keccak_init(sha3Context, 256); - cx_hash((cx_hash_t*)sha3Context, CX_LAST, publicKey->W + 1, 64, hashAddress, 32); + CX_THROW(cx_keccak_init_no_throw(sha3Context, 256)); + CX_THROW(cx_hash_no_throw((cx_hash_t*)sha3Context, CX_LAST, publicKey->W + 1, 64, hashAddress, 32)); getEthAddressStringFromBinary(hashAddress + 12, out, sha3Context); } @@ -70,8 +70,8 @@ void getEthAddressStringFromBinary(const uint8_t *address, uint8_t *out, cx_sha3_t *sha3Context) { uint8_t hashChecksum[32]; uint8_t i; - cx_keccak_init(sha3Context, 256); - cx_hash((cx_hash_t*)sha3Context, CX_LAST, address, 20, hashChecksum, 32); + CX_THROW(cx_keccak_init_no_throw(sha3Context, 256)); + CX_THROW(cx_hash_no_throw((cx_hash_t*)sha3Context, CX_LAST, address, 20, hashChecksum, 32)); for (i = 0; i < 40; i++) { out[i] = convertDigit(address, i, hashChecksum); } @@ -84,8 +84,8 @@ static const uint8_t HEXDIGITS[] = "0123456789abcdef"; void getEthAddressStringFromKey(const cx_ecfp_public_key_t *publicKey, char *out, int chainId, cx_sha3_t *sha3Context) { uint8_t hashAddress[32]; - cx_keccak_init(sha3Context, 256); - cx_hash((cx_hash_t*)sha3Context, CX_LAST, publicKey->W + 1, 64, hashAddress, 32); + CX_THROW(cx_keccak_init_no_throw(sha3Context, 256)); + CX_THROW(cx_hash_no_throw((cx_hash_t*)sha3Context, CX_LAST, publicKey->W + 1, 64, hashAddress, 32)); getEthAddressStringFromBinary(hashAddress + 12, out, chainId, sha3Context); } @@ -111,8 +111,8 @@ void getEthAddressStringFromBinary(const uint8_t *address, char *out, int chainI tmp[offset + 2 * i] = HEXDIGITS[(digit >> 4) & 0x0f]; tmp[offset + 2 * i + 1] = HEXDIGITS[digit & 0x0f]; } - cx_keccak_init(sha3Context, 256); - cx_hash((cx_hash_t*)sha3Context, CX_LAST, (uint8_t *) tmp, offset + 40, hashChecksum, 32); + CX_THROW(cx_keccak_init_no_throw(sha3Context, 256)); + CX_THROW(cx_hash_no_throw((cx_hash_t*)sha3Context, CX_LAST, (uint8_t *) tmp, offset + 40, hashChecksum, 32)); for (i = 0; i < 40; i++) { uint8_t digit = address[i / 2]; if ((i % 2) == 0) { diff --git a/src_common/rlp.h b/src_common/rlp.h index 39b8568..70d1577 100644 --- a/src_common/rlp.h +++ b/src_common/rlp.h @@ -17,4 +17,19 @@ * @return true if the RLP header is consistent */ bool rlpCanDecode(const uint8_t *buffer, size_t bufferLength, bool *valid); -bool rlpDecodeLength(const uint8_t *buffer, size_t bufferLength, uint32_t *fieldLength, uint32_t *offset, bool *list); + +/** + * @brief Decode the length of an RLP encoded field. + * + * This function decodes the length of an RLP encoded field, given a buffer containing the RLP encoded data. + * The RLP encoding format is defined in the Ethereum wiki: https://github.com/ethereum/wiki/wiki/RLP + * + * @param [in] buffer The buffer containing the RLP encoded field to decode. + * @param [in] bufferLength The size of the buffer. + * @param [out] fieldLength The length of the RLP encoded field. + * @param [out] offset The offset to the beginning of the RLP encoded field from the buffer. + * @param [out] list A boolean indicating whether the field encodes a list (true) or a string (false). + * + * @return true if the RLP header is consistent, false otherwise. + */ +bool rlpDecodeLength(const uint8_t *buffer, size_t bufferLength, uint32_t *fieldLength, uint32_t *offset, bool *list); \ No newline at end of file diff --git a/stax_app_celo.gif b/stax_app_celo.gif index ee155bb..13c7161 100644 Binary files a/stax_app_celo.gif and b/stax_app_celo.gif differ diff --git a/stax_app_celo_64.gif b/stax_app_celo_64.gif new file mode 100644 index 0000000..b61f5f4 Binary files /dev/null and b/stax_app_celo_64.gif differ diff --git a/tests/python/apps/celo.py b/tests/python/apps/celo.py index 04d3602..896b7cc 100644 --- a/tests/python/apps/celo.py +++ b/tests/python/apps/celo.py @@ -23,7 +23,8 @@ class INS(IntEnum): class StatusCode(IntEnum): STATUS_OK = 0x9000 - + STATUS_DEPRECATED = 0x6501 + STATUS_ERROR_IN_DATA = 0x6A80 class Param(IntEnum): P1_DirectlyFetchAddress = 0x00 # Return address directly from the wallet @@ -91,3 +92,12 @@ def sign_transaction_async(self, derivation_path : bytes, arg_list : List[str]) with self.send_in_chunk_async(INS.INS_SIGN, payload): yield + + @contextmanager + def sign_transaction_with_rawTx_async(self, derivation_path : bytes, rawTx: str) -> Generator[None, None, None]: + encoded = bytes.fromhex(rawTx) + payload: bytes = derivation_path + payload += encoded + + with self.send_in_chunk_async(INS.INS_SIGN, payload): + yield diff --git a/tests/python/apps/celo_utils.py b/tests/python/apps/celo_utils.py index b6d66c2..28ae81d 100644 --- a/tests/python/apps/celo_utils.py +++ b/tests/python/apps/celo_utils.py @@ -1,3 +1,4 @@ from ragger.bip import pack_derivation_path CELO_PACKED_DERIVATION_PATH = pack_derivation_path("m/44'/52752'/12345'") +ETH_PACKED_DERIVATION_PATH = pack_derivation_path("m/44'/60'/0'") diff --git a/tests/python/snapshots/flex/test_celo_derive_address/00000.png b/tests/python/snapshots/flex/test_celo_derive_address/00000.png new file mode 100644 index 0000000..3c5f5e0 Binary files /dev/null and b/tests/python/snapshots/flex/test_celo_derive_address/00000.png differ diff --git a/tests/python/snapshots/flex/test_celo_derive_address/00001.png b/tests/python/snapshots/flex/test_celo_derive_address/00001.png new file mode 100644 index 0000000..ad3809f Binary files /dev/null and b/tests/python/snapshots/flex/test_celo_derive_address/00001.png differ diff --git a/tests/python/snapshots/flex/test_celo_derive_address/00002.png b/tests/python/snapshots/flex/test_celo_derive_address/00002.png new file mode 100644 index 0000000..0acd7a7 Binary files /dev/null and b/tests/python/snapshots/flex/test_celo_derive_address/00002.png differ diff --git a/tests/python/snapshots/flex/test_celo_derive_address/00003.png b/tests/python/snapshots/flex/test_celo_derive_address/00003.png new file mode 100644 index 0000000..ad3809f Binary files /dev/null and b/tests/python/snapshots/flex/test_celo_derive_address/00003.png differ diff --git a/tests/python/snapshots/flex/test_celo_derive_address/00004.png b/tests/python/snapshots/flex/test_celo_derive_address/00004.png new file mode 100644 index 0000000..4321e60 Binary files /dev/null and b/tests/python/snapshots/flex/test_celo_derive_address/00004.png differ diff --git a/tests/python/snapshots/flex/test_celo_derive_address/00005.png b/tests/python/snapshots/flex/test_celo_derive_address/00005.png new file mode 100644 index 0000000..b174685 Binary files /dev/null and b/tests/python/snapshots/flex/test_celo_derive_address/00005.png differ diff --git a/tests/python/snapshots/flex/test_sign_data/00000.png b/tests/python/snapshots/flex/test_sign_data/00000.png new file mode 100644 index 0000000..40bc550 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_data/00000.png differ diff --git a/tests/python/snapshots/flex/test_sign_data/00001.png b/tests/python/snapshots/flex/test_sign_data/00001.png new file mode 100644 index 0000000..2f1d84c Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_data/00001.png differ diff --git a/tests/python/snapshots/flex/test_sign_data/00002.png b/tests/python/snapshots/flex/test_sign_data/00002.png new file mode 100644 index 0000000..b8660cf Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_data/00002.png differ diff --git a/tests/python/snapshots/flex/test_sign_data/00003.png b/tests/python/snapshots/flex/test_sign_data/00003.png new file mode 100644 index 0000000..8b981d4 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_data/00003.png differ diff --git a/tests/python/snapshots/flex/test_sign_data/00004.png b/tests/python/snapshots/flex/test_sign_data/00004.png new file mode 100644 index 0000000..b174685 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_data/00004.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_cip64/00000.png b/tests/python/snapshots/flex/test_sign_transaction_cip64/00000.png new file mode 100644 index 0000000..36b9a9b Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_cip64/00000.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_cip64/00001.png b/tests/python/snapshots/flex/test_sign_transaction_cip64/00001.png new file mode 100644 index 0000000..70a6e6e Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_cip64/00001.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_cip64/00002.png b/tests/python/snapshots/flex/test_sign_transaction_cip64/00002.png new file mode 100644 index 0000000..9d8e493 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_cip64/00002.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_cip64/00003.png b/tests/python/snapshots/flex/test_sign_transaction_cip64/00003.png new file mode 100644 index 0000000..be51a9d Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_cip64/00003.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_cip64/00004.png b/tests/python/snapshots/flex/test_sign_transaction_cip64/00004.png new file mode 100644 index 0000000..b174685 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_cip64/00004.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00000.png b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00000.png new file mode 100644 index 0000000..36b9a9b Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00000.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00001.png b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00001.png new file mode 100644 index 0000000..c962f67 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00001.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00002.png b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00002.png new file mode 100644 index 0000000..9d8e493 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00002.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00003.png b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00003.png new file mode 100644 index 0000000..be51a9d Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00003.png differ diff --git a/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00004.png b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00004.png new file mode 100644 index 0000000..b174685 Binary files /dev/null and b/tests/python/snapshots/flex/test_sign_transaction_eip1559_no_data/00004.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00001.png deleted file mode 100644 index cb76b61..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00002.png deleted file mode 100644 index a7c4e6c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00003.png deleted file mode 100644 index bc741dd..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00004.png deleted file mode 100644 index 7aac2e5..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00005.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00006.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00007.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_activate/00009.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_activate/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00000.png similarity index 100% rename from tests/python/snapshots/nanos/test_sign_transaction_activate/00000.png rename to tests/python/snapshots/nanos/test_sign_transaction_cip64/00000.png diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00001.png similarity index 100% rename from tests/python/snapshots/nanos/test_sign_transaction_empty/00001.png rename to tests/python/snapshots/nanos/test_sign_transaction_cip64/00001.png diff --git a/tests/python/snapshots/nanos/test_sign_transaction_cip64/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00002.png new file mode 100644 index 0000000..e5e9945 Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00002.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_cip64/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00003.png new file mode 100644 index 0000000..455b7fb Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00003.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_cip64/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00004.png new file mode 100644 index 0000000..01165c8 Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00004.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_cip64/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00005.png new file mode 100644 index 0000000..345094e Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00005.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_cip64/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00006.png new file mode 100644 index 0000000..ce478b8 Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00006.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_activate/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00007.png similarity index 100% rename from tests/python/snapshots/nanos/test_sign_transaction_activate/00008.png rename to tests/python/snapshots/nanos/test_sign_transaction_cip64/00007.png diff --git a/tests/python/snapshots/nanos/test_celo_derive_address/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_cip64/00008.png similarity index 100% rename from tests/python/snapshots/nanos/test_celo_derive_address/00006.png rename to tests/python/snapshots/nanos/test_sign_transaction_cip64/00008.png diff --git a/tests/python/snapshots/nanos/test_sign_transaction_create/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_create/00001.png deleted file mode 100644 index 09844cb..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_create/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_create/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_create/00002.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_create/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_create/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_create/00003.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_create/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_create/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_create/00004.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_create/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_create/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_create/00005.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_create/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_create/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_create/00006.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_create/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_create/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00000.png similarity index 100% rename from tests/python/snapshots/nanos/test_sign_transaction_create/00000.png rename to tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00000.png diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00001.png similarity index 100% rename from tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00001.png rename to tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00001.png diff --git a/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00002.png new file mode 100644 index 0000000..e5e9945 Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00002.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00003.png new file mode 100644 index 0000000..455b7fb Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00003.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00004.png new file mode 100644 index 0000000..01165c8 Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00004.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00005.png new file mode 100644 index 0000000..e3bb2ad Binary files /dev/null and b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00005.png differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00006.png similarity index 100% rename from tests/python/snapshots/nanos/test_sign_transaction_lock/00006.png rename to tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00006.png diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00007.png similarity index 100% rename from tests/python/snapshots/nanos/test_sign_transaction_lock/00007.png rename to tests/python/snapshots/nanos/test_sign_transaction_eip1559_no_data/00007.png diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00002.png deleted file mode 100644 index 85d5804..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00003.png deleted file mode 100644 index 800391f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00004.png deleted file mode 100644 index 3ec4b9f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00005.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00006.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00007.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00008.png deleted file mode 100644 index 9311e03..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00009.png deleted file mode 100644 index 4112824..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00010.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00010.png deleted file mode 100644 index edecb87..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00010.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00011.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00011.png deleted file mode 100644 index 0e19496..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00011.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00012.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00012.png deleted file mode 100644 index e3a54ff..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00012.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00013.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00013.png deleted file mode 100644 index ddd5155..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00013.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00014.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00014.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00014.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_empty/00015.png b/tests/python/snapshots/nanos/test_sign_transaction_empty/00015.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_empty/00015.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_lock/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_lock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_lock/00001.png deleted file mode 100644 index 391eba2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_lock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_lock/00002.png deleted file mode 100644 index 2b72a28..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_lock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_lock/00003.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_lock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_lock/00004.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_lock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_lock/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_lock/00005.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_lock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00002.png deleted file mode 100644 index 85d5804..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00003.png deleted file mode 100644 index 800391f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00004.png deleted file mode 100644 index 3ec4b9f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00005.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00006.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00007.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00008.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00009.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00001.png deleted file mode 100644 index 5adfa7b..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00002.png deleted file mode 100644 index 2b72a28..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00003.png deleted file mode 100644 index 85d5804..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00004.png deleted file mode 100644 index 800391f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00005.png deleted file mode 100644 index 3ec4b9f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00006.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00007.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00008.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00009.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00010.png b/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00010.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_no_gtw2/00010.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00001.png deleted file mode 100644 index d60eca6..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00002.png deleted file mode 100644 index eba1f5c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00003.png deleted file mode 100644 index b29f2d4..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00004.png deleted file mode 100644 index 2d228cc..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00005.png deleted file mode 100644 index 5626de9..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00006.png deleted file mode 100644 index d001d84..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00007.png deleted file mode 100644 index c0cee95..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00008.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00009.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00010.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00010.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00010.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00011.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00011.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00011.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_relock/00012.png b/tests/python/snapshots/nanos/test_sign_transaction_relock/00012.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_relock/00012.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00001.png deleted file mode 100644 index 1d66c38..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00002.png deleted file mode 100644 index eba1f5c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00003.png deleted file mode 100644 index b29f2d4..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00004.png deleted file mode 100644 index 2d228cc..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00005.png deleted file mode 100644 index 5626de9..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00006.png deleted file mode 100644 index d001d84..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00007.png deleted file mode 100644 index c0cee95..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00008.png deleted file mode 100644 index a7c4e6c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00009.png deleted file mode 100644 index bc741dd..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00010.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00010.png deleted file mode 100644 index 7aac2e5..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00010.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00011.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00011.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00011.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00012.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00012.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00012.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00013.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00013.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00013.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00014.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00014.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00014.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00015.png b/tests/python/snapshots/nanos/test_sign_transaction_revoke/00015.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_revoke/00015.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00001.png deleted file mode 100644 index 5adfa7b..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00002.png deleted file mode 100644 index 2b72a28..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00003.png deleted file mode 100644 index 85d5804..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00004.png deleted file mode 100644 index 800391f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00005.png deleted file mode 100644 index 3ec4b9f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00006.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00007.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00008.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00009.png deleted file mode 100644 index 9311e03..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00010.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00010.png deleted file mode 100644 index 4112824..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00010.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00011.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00011.png deleted file mode 100644 index edecb87..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00011.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00012.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00012.png deleted file mode 100644 index 0e19496..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00012.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00013.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00013.png deleted file mode 100644 index e3a54ff..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00013.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00014.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00014.png deleted file mode 100644 index ddd5155..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00014.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00015.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00015.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00015.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00016.png b/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00016.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_token_transfer/00016.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00001.png deleted file mode 100644 index f937e19..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00002.png deleted file mode 100644 index eba1f5c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00003.png deleted file mode 100644 index b29f2d4..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00004.png deleted file mode 100644 index 2d228cc..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00005.png deleted file mode 100644 index 5626de9..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00006.png deleted file mode 100644 index d001d84..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00007.png deleted file mode 100644 index c0cee95..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00008.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00009.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00010.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00010.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00010.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00011.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00011.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00011.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00012.png b/tests/python/snapshots/nanos/test_sign_transaction_unlock/00012.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_unlock/00012.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00001.png deleted file mode 100644 index 4ce1ba3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00002.png deleted file mode 100644 index eba1f5c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00003.png deleted file mode 100644 index b29f2d4..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00004.png deleted file mode 100644 index 2d228cc..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00005.png deleted file mode 100644 index 5626de9..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00006.png deleted file mode 100644 index d001d84..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00007.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00007.png deleted file mode 100644 index c0cee95..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00008.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00008.png deleted file mode 100644 index a7c4e6c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00009.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00009.png deleted file mode 100644 index bc741dd..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00009.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00010.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00010.png deleted file mode 100644 index 7aac2e5..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00010.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00011.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00011.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00011.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00012.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00012.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00012.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00013.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00013.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00013.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00014.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00014.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00014.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_vote/00015.png b/tests/python/snapshots/nanos/test_sign_transaction_vote/00015.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_vote/00015.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00000.png b/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00000.png deleted file mode 100644 index 8d84cc7..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00001.png b/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00001.png deleted file mode 100644 index f4832b0..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00002.png b/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00002.png deleted file mode 100644 index 0130ea2..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00003.png b/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00003.png deleted file mode 100644 index 30c9a48..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00004.png b/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00004.png deleted file mode 100644 index 1b0400f..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00005.png b/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00005.png deleted file mode 100644 index 1c9156c..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00006.png b/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00006.png deleted file mode 100644 index ce795f3..0000000 Binary files a/tests/python/snapshots/nanos/test_sign_transaction_withdraw/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_activate/00001.png deleted file mode 100644 index 0786dec..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_activate/00002.png deleted file mode 100644 index 97b8d7e..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_activate/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00000.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_activate/00000.png rename to tests/python/snapshots/nanosp/test_sign_transaction_cip64/00000.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00001.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_empty/00001.png rename to tests/python/snapshots/nanosp/test_sign_transaction_cip64/00001.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00002.png new file mode 100644 index 0000000..9fd8cd9 Binary files /dev/null and b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00002.png differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00003.png new file mode 100644 index 0000000..1a05e3b Binary files /dev/null and b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00003.png differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00004.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_activate/00004.png rename to tests/python/snapshots/nanosp/test_sign_transaction_cip64/00004.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_activate/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_cip64/00005.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_activate/00005.png rename to tests/python/snapshots/nanosp/test_sign_transaction_cip64/00005.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_create/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_create/00001.png deleted file mode 100644 index a10bf89..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_create/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_create/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_create/00002.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_create/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_create/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_create/00003.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_create/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_create/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_create/00004.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_create/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_create/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00000.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_create/00000.png rename to tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00000.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00001.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00001.png rename to tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00001.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00002.png new file mode 100644 index 0000000..9fd8cd9 Binary files /dev/null and b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00002.png differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00003.png new file mode 100644 index 0000000..d158d51 Binary files /dev/null and b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00003.png differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00004.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_lock/00004.png rename to tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00004.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00005.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_lock/00005.png rename to tests/python/snapshots/nanosp/test_sign_transaction_eip1559_no_data/00005.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_empty/00002.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_empty/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_empty/00004.png deleted file mode 100644 index 60cc95a..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_empty/00005.png deleted file mode 100644 index 561ba78..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00006.png b/tests/python/snapshots/nanosp/test_sign_transaction_empty/00006.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00007.png b/tests/python/snapshots/nanosp/test_sign_transaction_empty/00007.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_lock/00001.png deleted file mode 100644 index d2fac22..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_lock/00002.png deleted file mode 100644 index 9250a42..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_lock/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00002.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00001.png deleted file mode 100644 index 8fc8955..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00002.png deleted file mode 100644 index 9250a42..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00003.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00005.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00006.png b/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00006.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw2/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_relock/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_relock/00001.png deleted file mode 100644 index d24661d..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_relock/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_relock/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_relock/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_relock/00005.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00006.png b/tests/python/snapshots/nanosp/test_sign_transaction_relock/00006.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_relock/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00001.png deleted file mode 100644 index 145f506..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00004.png deleted file mode 100644 index 97b8d7e..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00005.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00006.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00006.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00007.png b/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00007.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_revoke/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00001.png deleted file mode 100644 index 8fc8955..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00002.png deleted file mode 100644 index 9250a42..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00003.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00005.png deleted file mode 100644 index 60cc95a..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00006.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00006.png deleted file mode 100644 index 561ba78..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00007.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00007.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00008.png b/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00008.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_token_transfer/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00001.png deleted file mode 100644 index 0cb4b26..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00005.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00006.png b/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00006.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_unlock/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00001.png deleted file mode 100644 index 069ed78..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00004.png deleted file mode 100644 index 97b8d7e..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00005.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00005.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00006.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00006.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00007.png b/tests/python/snapshots/nanosp/test_sign_transaction_vote/00007.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_vote/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00000.png b/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00001.png b/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00001.png deleted file mode 100644 index a84e600..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00002.png b/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00002.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00003.png b/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00003.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00004.png b/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00004.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanosp/test_sign_transaction_withdraw/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_celo_derive_address/00004.png b/tests/python/snapshots/nanox/test_celo_derive_address/00004.png deleted file mode 100644 index a58590b..0000000 Binary files a/tests/python/snapshots/nanox/test_celo_derive_address/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_activate/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_activate/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_activate/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_activate/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_activate/00001.png deleted file mode 100644 index 0786dec..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_activate/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_activate/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_activate/00002.png deleted file mode 100644 index 97b8d7e..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_activate/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_activate/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_activate/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_activate/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_empty/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00000.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_empty/00000.png rename to tests/python/snapshots/nanox/test_sign_transaction_cip64/00000.png diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00001.png similarity index 100% rename from tests/python/snapshots/nanox/test_sign_transaction_empty/00001.png rename to tests/python/snapshots/nanox/test_sign_transaction_cip64/00001.png diff --git a/tests/python/snapshots/nanox/test_sign_transaction_cip64/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00002.png new file mode 100644 index 0000000..9fd8cd9 Binary files /dev/null and b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00002.png differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_cip64/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00003.png new file mode 100644 index 0000000..1a05e3b Binary files /dev/null and b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00003.png differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00004.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00004.png rename to tests/python/snapshots/nanox/test_sign_transaction_cip64/00004.png diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_cip64/00005.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_no_gtw/00005.png rename to tests/python/snapshots/nanox/test_sign_transaction_cip64/00005.png diff --git a/tests/python/snapshots/nanox/test_sign_transaction_create/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_create/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_create/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_create/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_create/00001.png deleted file mode 100644 index a10bf89..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_create/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_create/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_create/00002.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_create/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_create/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_create/00003.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_create/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_create/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_create/00004.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_create/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanosp/test_sign_transaction_lock/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00000.png similarity index 100% rename from tests/python/snapshots/nanosp/test_sign_transaction_lock/00000.png rename to tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00000.png diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00001.png similarity index 100% rename from tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00001.png rename to tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00001.png diff --git a/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00002.png new file mode 100644 index 0000000..9fd8cd9 Binary files /dev/null and b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00002.png differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00003.png new file mode 100644 index 0000000..d158d51 Binary files /dev/null and b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00003.png differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_activate/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00004.png similarity index 100% rename from tests/python/snapshots/nanox/test_sign_transaction_activate/00004.png rename to tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00004.png diff --git a/tests/python/snapshots/nanox/test_sign_transaction_activate/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00005.png similarity index 100% rename from tests/python/snapshots/nanox/test_sign_transaction_activate/00005.png rename to tests/python/snapshots/nanox/test_sign_transaction_eip1559_no_data/00005.png diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_empty/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_empty/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_empty/00002.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_empty/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_empty/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_empty/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_empty/00004.png deleted file mode 100644 index 60cc95a..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_empty/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_empty/00005.png deleted file mode 100644 index 561ba78..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_empty/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00006.png b/tests/python/snapshots/nanox/test_sign_transaction_empty/00006.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_empty/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_empty/00007.png b/tests/python/snapshots/nanox/test_sign_transaction_empty/00007.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_empty/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_lock/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_lock/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_lock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_lock/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_lock/00001.png deleted file mode 100644 index d2fac22..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_lock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_lock/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_lock/00002.png deleted file mode 100644 index 9250a42..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_lock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_lock/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_lock/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_lock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_lock/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_lock/00004.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_lock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_lock/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_lock/00005.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_lock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00002.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00003.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00004.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00005.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00001.png deleted file mode 100644 index 8fc8955..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00002.png deleted file mode 100644 index 9250a42..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00003.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00005.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00006.png b/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00006.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_no_gtw2/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_relock/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_relock/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_relock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_relock/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_relock/00001.png deleted file mode 100644 index d24661d..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_relock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_relock/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_relock/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_relock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_relock/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_relock/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_relock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_relock/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_relock/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_relock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_relock/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_relock/00005.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_relock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_relock/00006.png b/tests/python/snapshots/nanox/test_sign_transaction_relock/00006.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_relock/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00001.png deleted file mode 100644 index 145f506..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00004.png deleted file mode 100644 index 97b8d7e..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00005.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00006.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00006.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00007.png b/tests/python/snapshots/nanox/test_sign_transaction_revoke/00007.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_revoke/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00001.png deleted file mode 100644 index 8fc8955..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00002.png deleted file mode 100644 index 9250a42..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00003.png deleted file mode 100644 index 15a8a4c..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00005.png deleted file mode 100644 index 60cc95a..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00006.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00006.png deleted file mode 100644 index 561ba78..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00007.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00007.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00008.png b/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00008.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_token_transfer/00008.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_unlock/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_unlock/00001.png deleted file mode 100644 index 0cb4b26..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_unlock/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_unlock/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_unlock/00004.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_unlock/00005.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00006.png b/tests/python/snapshots/nanox/test_sign_transaction_unlock/00006.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_unlock/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00001.png deleted file mode 100644 index 069ed78..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00002.png deleted file mode 100644 index 90445ef..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00003.png deleted file mode 100644 index a5de59f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00004.png deleted file mode 100644 index 97b8d7e..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00004.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00005.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00005.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00005.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00006.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00006.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00006.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_vote/00007.png b/tests/python/snapshots/nanox/test_sign_transaction_vote/00007.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_vote/00007.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00000.png b/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00000.png deleted file mode 100644 index 487ea10..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00001.png b/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00001.png deleted file mode 100644 index a84e600..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00001.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00002.png b/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00002.png deleted file mode 100644 index 83fb84f..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00003.png b/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00003.png deleted file mode 100644 index 570ce28..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00004.png b/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00004.png deleted file mode 100644 index 6578872..0000000 Binary files a/tests/python/snapshots/nanox/test_sign_transaction_withdraw/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_celo_derive_address/00000.png b/tests/python/snapshots/stax/test_celo_derive_address/00000.png index caf6009..bfb8d13 100644 Binary files a/tests/python/snapshots/stax/test_celo_derive_address/00000.png and b/tests/python/snapshots/stax/test_celo_derive_address/00000.png differ diff --git a/tests/python/snapshots/stax/test_celo_derive_address/00001.png b/tests/python/snapshots/stax/test_celo_derive_address/00001.png index 0c8de85..cb33abe 100644 Binary files a/tests/python/snapshots/stax/test_celo_derive_address/00001.png and b/tests/python/snapshots/stax/test_celo_derive_address/00001.png differ diff --git a/tests/python/snapshots/stax/test_celo_derive_address/00002.png b/tests/python/snapshots/stax/test_celo_derive_address/00002.png index 92b8843..92ab0a3 100644 Binary files a/tests/python/snapshots/stax/test_celo_derive_address/00002.png and b/tests/python/snapshots/stax/test_celo_derive_address/00002.png differ diff --git a/tests/python/snapshots/stax/test_celo_derive_address/00003.png b/tests/python/snapshots/stax/test_celo_derive_address/00003.png index 0c8de85..cb33abe 100644 Binary files a/tests/python/snapshots/stax/test_celo_derive_address/00003.png and b/tests/python/snapshots/stax/test_celo_derive_address/00003.png differ diff --git a/tests/python/snapshots/stax/test_celo_derive_address/00004.png b/tests/python/snapshots/stax/test_celo_derive_address/00004.png index b69649a..7a49478 100644 Binary files a/tests/python/snapshots/stax/test_celo_derive_address/00004.png and b/tests/python/snapshots/stax/test_celo_derive_address/00004.png differ diff --git a/tests/python/snapshots/stax/test_celo_derive_address/00005.png b/tests/python/snapshots/stax/test_celo_derive_address/00005.png index 3966189..571dfa7 100644 Binary files a/tests/python/snapshots/stax/test_celo_derive_address/00005.png and b/tests/python/snapshots/stax/test_celo_derive_address/00005.png differ diff --git a/tests/python/snapshots/stax/test_sign_data/00000.png b/tests/python/snapshots/stax/test_sign_data/00000.png index 057744d..a08ebe3 100644 Binary files a/tests/python/snapshots/stax/test_sign_data/00000.png and b/tests/python/snapshots/stax/test_sign_data/00000.png differ diff --git a/tests/python/snapshots/stax/test_sign_data/00001.png b/tests/python/snapshots/stax/test_sign_data/00001.png index 57e1c74..5259473 100644 Binary files a/tests/python/snapshots/stax/test_sign_data/00001.png and b/tests/python/snapshots/stax/test_sign_data/00001.png differ diff --git a/tests/python/snapshots/stax/test_sign_data/00002.png b/tests/python/snapshots/stax/test_sign_data/00002.png index c7c89cb..c48b35c 100644 Binary files a/tests/python/snapshots/stax/test_sign_data/00002.png and b/tests/python/snapshots/stax/test_sign_data/00002.png differ diff --git a/tests/python/snapshots/stax/test_sign_data/00003.png b/tests/python/snapshots/stax/test_sign_data/00003.png index b1bf4dd..cfee3ae 100644 Binary files a/tests/python/snapshots/stax/test_sign_data/00003.png and b/tests/python/snapshots/stax/test_sign_data/00003.png differ diff --git a/tests/python/snapshots/stax/test_sign_data/00004.png b/tests/python/snapshots/stax/test_sign_data/00004.png index 3966189..571dfa7 100644 Binary files a/tests/python/snapshots/stax/test_sign_data/00004.png and b/tests/python/snapshots/stax/test_sign_data/00004.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_activate/00000.png b/tests/python/snapshots/stax/test_sign_transaction_activate/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_activate/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_activate/00001.png b/tests/python/snapshots/stax/test_sign_transaction_activate/00001.png deleted file mode 100644 index c213847..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_activate/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_activate/00002.png b/tests/python/snapshots/stax/test_sign_transaction_activate/00002.png deleted file mode 100644 index d8ea2f0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_activate/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_activate/00003.png b/tests/python/snapshots/stax/test_sign_transaction_activate/00003.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_activate/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_activate/00004.png b/tests/python/snapshots/stax/test_sign_transaction_activate/00004.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_activate/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_cip64/00000.png b/tests/python/snapshots/stax/test_sign_transaction_cip64/00000.png new file mode 100644 index 0000000..f72f36e Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_cip64/00000.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_cip64/00001.png b/tests/python/snapshots/stax/test_sign_transaction_cip64/00001.png new file mode 100644 index 0000000..cb67d88 Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_cip64/00001.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_cip64/00002.png b/tests/python/snapshots/stax/test_sign_transaction_cip64/00002.png new file mode 100644 index 0000000..da02a30 Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_cip64/00002.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_cip64/00003.png b/tests/python/snapshots/stax/test_sign_transaction_cip64/00003.png new file mode 100644 index 0000000..392165d Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_cip64/00003.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_cip64/00004.png b/tests/python/snapshots/stax/test_sign_transaction_cip64/00004.png new file mode 100644 index 0000000..571dfa7 Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_cip64/00004.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_create/00000.png b/tests/python/snapshots/stax/test_sign_transaction_create/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_create/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_create/00001.png b/tests/python/snapshots/stax/test_sign_transaction_create/00001.png deleted file mode 100644 index d8ada22..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_create/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_create/00002.png b/tests/python/snapshots/stax/test_sign_transaction_create/00002.png deleted file mode 100644 index d8ea2f0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_create/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_create/00003.png b/tests/python/snapshots/stax/test_sign_transaction_create/00003.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_create/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_create/00004.png b/tests/python/snapshots/stax/test_sign_transaction_create/00004.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_create/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00000.png b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00000.png new file mode 100644 index 0000000..f72f36e Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00000.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00001.png b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00001.png new file mode 100644 index 0000000..85aaafb Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00001.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00002.png b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00002.png new file mode 100644 index 0000000..da02a30 Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00002.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00003.png b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00003.png new file mode 100644 index 0000000..392165d Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00003.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00004.png b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00004.png new file mode 100644 index 0000000..571dfa7 Binary files /dev/null and b/tests/python/snapshots/stax/test_sign_transaction_eip1559_no_data/00004.png differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_empty/00000.png b/tests/python/snapshots/stax/test_sign_transaction_empty/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_empty/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_empty/00001.png b/tests/python/snapshots/stax/test_sign_transaction_empty/00001.png deleted file mode 100644 index 5145a2e..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_empty/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_empty/00002.png b/tests/python/snapshots/stax/test_sign_transaction_empty/00002.png deleted file mode 100644 index de2782e..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_empty/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_empty/00003.png b/tests/python/snapshots/stax/test_sign_transaction_empty/00003.png deleted file mode 100644 index 82e63a0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_empty/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_empty/00004.png b/tests/python/snapshots/stax/test_sign_transaction_empty/00004.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_empty/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_empty/00005.png b/tests/python/snapshots/stax/test_sign_transaction_empty/00005.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_empty/00005.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_lock/00000.png b/tests/python/snapshots/stax/test_sign_transaction_lock/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_lock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_lock/00001.png b/tests/python/snapshots/stax/test_sign_transaction_lock/00001.png deleted file mode 100644 index f625ffc..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_lock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_lock/00002.png b/tests/python/snapshots/stax/test_sign_transaction_lock/00002.png deleted file mode 100644 index d8ea2f0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_lock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_lock/00003.png b/tests/python/snapshots/stax/test_sign_transaction_lock/00003.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_lock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_lock/00004.png b/tests/python/snapshots/stax/test_sign_transaction_lock/00004.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_lock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00000.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00001.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00001.png deleted file mode 100644 index 6edce85..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00002.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00002.png deleted file mode 100644 index d8ea2f0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00003.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00003.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00004.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00004.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00000.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00001.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00001.png deleted file mode 100644 index 6b45815..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00002.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00002.png deleted file mode 100644 index 6edce85..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00003.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00003.png deleted file mode 100644 index d8ea2f0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00004.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00004.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00005.png b/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00005.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_no_gtw2/00005.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_relock/00000.png b/tests/python/snapshots/stax/test_sign_transaction_relock/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_relock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_relock/00001.png b/tests/python/snapshots/stax/test_sign_transaction_relock/00001.png deleted file mode 100644 index 3872cc7..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_relock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_relock/00002.png b/tests/python/snapshots/stax/test_sign_transaction_relock/00002.png deleted file mode 100644 index 18ad36d..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_relock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_relock/00003.png b/tests/python/snapshots/stax/test_sign_transaction_relock/00003.png deleted file mode 100644 index 82e63a0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_relock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_relock/00004.png b/tests/python/snapshots/stax/test_sign_transaction_relock/00004.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_relock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_relock/00005.png b/tests/python/snapshots/stax/test_sign_transaction_relock/00005.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_relock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_revoke/00000.png b/tests/python/snapshots/stax/test_sign_transaction_revoke/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_revoke/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_revoke/00001.png b/tests/python/snapshots/stax/test_sign_transaction_revoke/00001.png deleted file mode 100644 index 59db859..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_revoke/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_revoke/00002.png b/tests/python/snapshots/stax/test_sign_transaction_revoke/00002.png deleted file mode 100644 index 97ca1b1..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_revoke/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_revoke/00003.png b/tests/python/snapshots/stax/test_sign_transaction_revoke/00003.png deleted file mode 100644 index 82e63a0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_revoke/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_revoke/00004.png b/tests/python/snapshots/stax/test_sign_transaction_revoke/00004.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_revoke/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_revoke/00005.png b/tests/python/snapshots/stax/test_sign_transaction_revoke/00005.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_revoke/00005.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00000.png b/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00001.png b/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00001.png deleted file mode 100644 index 6b45815..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00002.png b/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00002.png deleted file mode 100644 index 5145a2e..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00003.png b/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00003.png deleted file mode 100644 index de2782e..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00004.png b/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00004.png deleted file mode 100644 index 82e63a0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00005.png b/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00005.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00005.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00006.png b/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00006.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_token_transfer/00006.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_unlock/00000.png b/tests/python/snapshots/stax/test_sign_transaction_unlock/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_unlock/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_unlock/00001.png b/tests/python/snapshots/stax/test_sign_transaction_unlock/00001.png deleted file mode 100644 index 541e536..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_unlock/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_unlock/00002.png b/tests/python/snapshots/stax/test_sign_transaction_unlock/00002.png deleted file mode 100644 index 18ad36d..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_unlock/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_unlock/00003.png b/tests/python/snapshots/stax/test_sign_transaction_unlock/00003.png deleted file mode 100644 index 82e63a0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_unlock/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_unlock/00004.png b/tests/python/snapshots/stax/test_sign_transaction_unlock/00004.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_unlock/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_unlock/00005.png b/tests/python/snapshots/stax/test_sign_transaction_unlock/00005.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_unlock/00005.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_vote/00000.png b/tests/python/snapshots/stax/test_sign_transaction_vote/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_vote/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_vote/00001.png b/tests/python/snapshots/stax/test_sign_transaction_vote/00001.png deleted file mode 100644 index 5d69244..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_vote/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_vote/00002.png b/tests/python/snapshots/stax/test_sign_transaction_vote/00002.png deleted file mode 100644 index 97ca1b1..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_vote/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_vote/00003.png b/tests/python/snapshots/stax/test_sign_transaction_vote/00003.png deleted file mode 100644 index 82e63a0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_vote/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_vote/00004.png b/tests/python/snapshots/stax/test_sign_transaction_vote/00004.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_vote/00004.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_vote/00005.png b/tests/python/snapshots/stax/test_sign_transaction_vote/00005.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_vote/00005.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00000.png b/tests/python/snapshots/stax/test_sign_transaction_withdraw/00000.png deleted file mode 100644 index c7270bd..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00000.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00001.png b/tests/python/snapshots/stax/test_sign_transaction_withdraw/00001.png deleted file mode 100644 index cdd0268..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00001.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00002.png b/tests/python/snapshots/stax/test_sign_transaction_withdraw/00002.png deleted file mode 100644 index d8ea2f0..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00002.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00003.png b/tests/python/snapshots/stax/test_sign_transaction_withdraw/00003.png deleted file mode 100644 index 275de9a..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00003.png and /dev/null differ diff --git a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00004.png b/tests/python/snapshots/stax/test_sign_transaction_withdraw/00004.png deleted file mode 100644 index 3966189..0000000 Binary files a/tests/python/snapshots/stax/test_sign_transaction_withdraw/00004.png and /dev/null differ diff --git a/tests/python/test_celo.py b/tests/python/test_celo.py index 7559ebc..a406c6b 100644 --- a/tests/python/test_celo.py +++ b/tests/python/test_celo.py @@ -19,10 +19,18 @@ def test_celo_derive_address(test_name, backend, firmware, show, chaincode, navi instructions = get_nano_review_instructions(4) elif firmware.device.startswith("nano"): instructions = get_nano_review_instructions(2) + elif firmware.device == "stax": + instructions = [ + NavIns(NavInsID.SWIPE_CENTER_TO_LEFT), + NavIns(NavInsID.TOUCH, (64, 521)), + NavIns(NavInsID.USE_CASE_ADDRESS_CONFIRMATION_EXIT_QR), + NavIns(NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CONFIRM), + NavIns(NavInsID.USE_CASE_STATUS_DISMISS) + ] else: instructions = [ - NavIns(NavInsID.USE_CASE_CHOICE_CONFIRM), - NavIns(NavInsID.TOUCH, (200, 335)), + NavIns(NavInsID.SWIPE_CENTER_TO_LEFT), + NavIns(NavInsID.TOUCH, (76, 463)), NavIns(NavInsID.USE_CASE_ADDRESS_CONFIRMATION_EXIT_QR), NavIns(NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CONFIRM), NavIns(NavInsID.USE_CASE_STATUS_DISMISS) diff --git a/tests/python/test_sign_transaction.py b/tests/python/test_deprecated_legacy.py similarity index 78% rename from tests/python/test_sign_transaction.py rename to tests/python/test_deprecated_legacy.py index 49c8e1c..eddfcc2 100644 --- a/tests/python/test_sign_transaction.py +++ b/tests/python/test_deprecated_legacy.py @@ -20,53 +20,52 @@ def sign_transaction(test_name, backend, navigator, instructions, payload): celo = CeloClient(backend) - with celo.sign_transaction_async(CELO_PACKED_DERIVATION_PATH, - [ - "1234", #Nonce - "1234", #GasPrice - "1234", #StartGas - "", #FeeCurrency - "12345678901234567890", #GatewayTo - "1234", #GatewayFee - "12345678901234567890", #To - "", #Value - payload, - "", #V - "", #R - "", #S - "" #Done - ] - ): - navigator.navigate_and_compare(TESTS_ROOT_DIR, test_name, instructions) - response: bytes = get_async_response(backend) - - assert (response.status == StatusCode.STATUS_OK) + try: + with celo.sign_transaction_async(CELO_PACKED_DERIVATION_PATH, + [ + "1234", #Nonce + "1234", #GasPrice + "1234", #StartGas + "", #FeeCurrency + "12345678901234567890", #GatewayTo + "1234", #GatewayFee + "12345678901234567890", #To + "", #Value + payload, + "", #V + "", #R + "", #S + "" #Done + ] + ): + pass + except Exception as e: + assert e.status == StatusCode.STATUS_DEPRECATED def sign_transaction_no_gtw(test_name, backend, navigator, instructions, payload): celo = CeloClient(backend) - with celo.sign_transaction_async(CELO_PACKED_DERIVATION_PATH, - [ - "1234", #Nonce - "1234", #GasPrice - "1234", #StartGas - "", #FeeCurrency - "", #GatewayTo - "1234", #GatewayFee - "12345678901234567890", #To - "", #Value - payload, - "", #V - "", #R - "", #S - "" #Done - ] - ): - navigator.navigate_and_compare(TESTS_ROOT_DIR, test_name, instructions) - response: bytes = get_async_response(backend) - - assert (response.status == StatusCode.STATUS_OK) - + try: + with celo.sign_transaction_async(CELO_PACKED_DERIVATION_PATH, + [ + "1234", #Nonce + "1234", #GasPrice + "1234", #StartGas + "", #FeeCurrency + "", #GatewayTo + "1234", #GatewayFee + "12345678901234567890", #To + "", #Value + payload, + "", #V + "", #R + "", #S + "" #Done + ] + ): + pass + except Exception as e: + assert e.status == StatusCode.STATUS_DEPRECATED def test_sign_transaction_empty(test_name, backend, firmware, navigator): if firmware.device == "nanos": diff --git a/tests/python/test_sign_new_transaction.py b/tests/python/test_sign_new_transaction.py new file mode 100644 index 0000000..6a24e83 --- /dev/null +++ b/tests/python/test_sign_new_transaction.py @@ -0,0 +1,77 @@ +from pathlib import Path +from .apps.celo import CeloClient, StatusCode, INS +from .apps.celo_utils import ETH_PACKED_DERIVATION_PATH +from .utils import get_async_response, get_nano_review_instructions, get_stax_review_instructions, get_stax_review_instructions_with_warning +from ragger.navigator import NavInsID, NavIns + +import pytest + +TESTS_ROOT_DIR = Path(__file__).parent + +# Transaction types +TX_TYPE_EIP1559 = 2 +TX_TYPE_CIP64 = 123 + + +def sign_transaction_with_rawTx(test_name, backend, navigator, instructions, rawTx): + celo = CeloClient(backend) + # transaction_params.append("") # ADD DONE PARAMETER + with celo.sign_transaction_with_rawTx_async( + ETH_PACKED_DERIVATION_PATH,rawTx + ): + navigator.navigate_and_compare(TESTS_ROOT_DIR, test_name, instructions) + + response: bytes = get_async_response(backend) + return response + +def test_sign_transaction_eip1559_no_data(test_name, backend, firmware, navigator): + if firmware.device == "nanos": + instructions = get_nano_review_instructions(6) + elif firmware.device.startswith("nano"): + instructions = get_nano_review_instructions(4) + else: + instructions = get_stax_review_instructions(1) + + rawTx = "02f86c82aef380830f42408506fc35fb8082520894da52c9ffebd4d54c94a072776126069d43e74f9e8080c080a099059ce0f1fe1f4fe27a583a6fd6a12274780d358f332d6e5901953900b8fb22a046ce6d625369fdc8a521c22793d188afbf61500cd3095fc09b761b518560f101" + response = sign_transaction_with_rawTx(test_name, backend, navigator, instructions, rawTx) + + assert(response.data[0] == 0x01 or response.data[0] == 0x00) + assert(response.status == StatusCode.STATUS_OK) + +def test_sign_transaction_eip1559_with_data(test_name, backend, firmware): + rawTx = "02f8d482a4ec820808839b34b4850fbc63d144830204e094004626a008b1acdc4c74ab51644093b155e59a2380b864ba0876520000000000000000000000000000000000000000000000009458660c5b865f23000000000000000000000000e3b72489968f11c15282514f33df24634440393f000000000000000000000000e3b72489968f11c15282514f33df24634440393fc001a0b0799073a2aa771c5e32b88933ff19982dc30f9e4523fde47137ae504793b880a07014a6e3c32a3b34d4118beb298f2200e858599b5e97766dfaa6fea192cde993" + celo = CeloClient(backend) + with pytest.raises(Exception) as exc_info: # Expecting the test to fail + with celo.sign_transaction_with_rawTx_async(ETH_PACKED_DERIVATION_PATH, rawTx): + pass + assert "6a80" in str(exc_info.value), "Expected exception to contain '6a80'" + + + +def test_add_cUSD_as_fee_currency(test_name, backend, navigator): + celo = CeloClient(backend) + data = "0463555344765de816845861e75a25fca122bb6898b8b1282a000000120000a4ec304402201f8217a6310b78bfe63f40e767b1413e7480403603486f8d3b2cfd4aaa8607470220577c04cc84d1e0ad9d344c73b624e0fc36c63d4a5f33654ab0bcd892b068e7a1" + encoded_data = bytes.fromhex(data) + with celo.send_in_chunk_async( + INS.INS_PROVIDE_ERC20_TOKEN_INFORMATION, + encoded_data + ): + pass + + response: bytes = get_async_response(backend) + assert (response.status == StatusCode.STATUS_OK) + +def test_sign_transaction_cip64(test_name, backend, firmware, navigator): + test_add_cUSD_as_fee_currency(test_name, backend, navigator) + + if firmware.device == "nanos": + instructions = get_nano_review_instructions(7) + elif firmware.device.startswith("nano"): + instructions = get_nano_review_instructions(4) + else: + instructions = get_stax_review_instructions(1) + + rawTx = "7bf84382a4ec8084773594008503a11f9db58301688c94da52c9ffebd4d54c94a072776126069d43e74f9e8080c094765DE816845861E75A25FCA122BB6898B8B1282A018080" + response = sign_transaction_with_rawTx(test_name, backend, navigator, instructions, rawTx) + assert(response.data[0] == 0x01 or response.data[0] == 0x00) + assert(response.status == StatusCode.STATUS_OK) diff --git a/tests/python/utils.py b/tests/python/utils.py index 5c6dc8b..e96193b 100644 --- a/tests/python/utils.py +++ b/tests/python/utils.py @@ -12,7 +12,7 @@ def get_nano_review_instructions(num_screen_skip): def get_stax_review_instructions(num_screen_skip): - instructions = [NavIns(NavInsID.USE_CASE_CHOICE_CONFIRM)] + instructions = [NavIns(NavInsID.SWIPE_CENTER_TO_LEFT)] for i in range(num_screen_skip): instructions.append(NavIns(NavInsID.USE_CASE_REVIEW_TAP)) @@ -23,8 +23,8 @@ def get_stax_review_instructions(num_screen_skip): def get_stax_review_instructions_with_warning(num_screen_skip): - instructions = [NavIns(NavInsID.USE_CASE_CHOICE_CONFIRM)] - instructions.append(NavIns(NavInsID.USE_CASE_CHOICE_CONFIRM)) + instructions = [NavIns(NavInsID.SWIPE_CENTER_TO_LEFT)] + instructions.append(NavIns(NavInsID.SWIPE_CENTER_TO_LEFT)) for i in range(num_screen_skip): instructions.append(NavIns(NavInsID.USE_CASE_REVIEW_TAP)) diff --git a/tests/unit/test_tx_parser.c b/tests/unit/test_tx_parser.c index 0244877..ef44186 100644 --- a/tests/unit/test_tx_parser.c +++ b/tests/unit/test_tx_parser.c @@ -3,57 +3,68 @@ #include #include #include +#include #include "../src_common/ethUstream.h" -static void test_celo_tx_invalid_address(void **state) { - (void) state; - - // dest address set to 0xe70e8afef87cc8f0d7a61f58535f6ec99cd860 (19 bytes) - const uint8_t tx_data[] = { - 0xEE, 0x7B, 0x82, 0x05, 0x39, 0x82, 0x52, 0x08, 0x80, 0x80, 0x80, 0x93, - 0xE7, 0x0E, 0x8A, 0xFE, 0xF8, 0x7C, 0xC8, 0xF0, 0xD7, 0xA6, 0x1F, 0x58, - 0x53, 0x5F, 0x6E, 0xC9, 0x9C, 0xD8, 0x60, 0x8A, 0x02, 0x8A, 0x85, - 0x74, 0x25, 0x46, 0x6F, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80 - }; - +static void test_process_tx(uint8_t txType, const uint8_t* tx_data, size_t tx_data_size, const uint8_t* expected_to, int expected_status) { txContext_t context; txContent_t content; cx_sha3_t sha3; initTx(&context, &sha3, &content, NULL, NULL); - assert_int_equal(processTx(&context, tx_data, sizeof(tx_data)), USTREAM_FAULT); + context.txType = txType; + assert_int_equal(processTx(&context, tx_data, tx_data_size), expected_status); + // do not perform other checks if expected_to is NULL + if(expected_to == NULL) { + return; + } + assert_int_equal(content.destinationLength, MAX_ADDRESS); + assert_memory_equal(content.destination, expected_to, MAX_ADDRESS); } -static void test_celo_tx(void **state) { - (void) state; +static void test_process_tx_eip1559(void **state) { + (void) state; const uint8_t tx_data[] = { - 0xEE, 0x7B, 0x82, 0x05, 0x39, 0x82, 0x52, 0x08, 0x80, 0x80, 0x80, 0x94, - 0xE7, 0x0E, 0x8A, 0xFE, 0xF8, 0x7C, 0xC8, 0xF0, 0xD7, 0xA6, 0x1F, 0x58, - 0x53, 0x5F, 0x6E, 0xC9, 0x9C, 0xD8, 0x60, 0xCA, 0x8A, 0x02, 0x8A, 0x85, - 0x74, 0x25, 0x46, 0x6F, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80 + 0xed, 0x82, 0xa4, 0xec, 0x80, 0x84, 0x77, 0x35, 0x94, 0x00, 0x85, 0x02, + 0xcb, 0x41, 0x78, 0x00, 0x82, 0x6a, 0xa4, 0x94, 0xda, 0x52, 0xc9, 0xff, + 0xeb, 0xd4, 0xd5, 0x4c, 0x94, 0xa0, 0x72, 0x77, 0x61, 0x26, 0x06, 0x9d, + 0x43, 0xe7, 0x4f, 0x9e, 0x80, 0x80, 0xc0, 0x01, 0x80, 0x80 }; const uint8_t to[] = { - 0xE7, 0x0E, 0x8A, 0xFE, 0xF8, 0x7C, 0xC8, 0xF0, 0xD7, 0xA6, 0x1F, 0x58, - 0x53, 0x5F, 0x6E, 0xC9, 0x9C, 0xD8, 0x60, 0xCA + 0xda, 0x52, 0xc9, 0xff, 0xeb, 0xd4, 0xd5, 0x4c, 0x94, 0xa0, 0x72, 0x77, + 0x61, 0x26, 0x06, 0x9d, 0x43, 0xe7, 0x4f, 0x9e }; - txContext_t context; - txContent_t content; - cx_sha3_t sha3; + test_process_tx(EIP1559, tx_data, sizeof(tx_data), to, USTREAM_FINISHED); +} - initTx(&context, &sha3, &content, NULL, NULL); - assert_int_equal(processTx(&context, tx_data, sizeof(tx_data)), USTREAM_FINISHED); - assert_int_equal(content.destinationLength, MAX_ADDRESS); - assert_memory_equal(content.destination, to, MAX_ADDRESS); +static void test_process_tx_cip64(void **state) { + (void) state; + const uint8_t tx_data[] = { + 0xf8, 0x43, 0x82, 0xa4, 0xec, 0x80, 0x84, 0x77, 0x35, 0x94, 0x00, 0x85, + 0x03, 0x86, 0xc6, 0x34, 0xf7, 0x83, 0x01, 0x68, 0x8c, 0x94, 0xda, 0x52, + 0xc9, 0xff, 0xeb, 0xd4, 0xd5, 0x4c, 0x94, 0xa0, 0x72, 0x77, 0x61, 0x26, + 0x06, 0x9d, 0x43, 0xe7, 0x4f, 0x9e, 0x80, 0x80, 0xc0, 0x94, 0x76, 0x5d, + 0xe8, 0x16, 0x84, 0x58, 0x61, 0xe7, 0x5a, 0x25, 0xfc, 0xa1, 0x22, 0xbb, + 0x68, 0x98, 0xb8, 0xb1, 0x28, 0x2a, 0x01, 0x80, 0x80 + }; + + const uint8_t to[] = { + 0xda, 0x52, 0xc9, 0xff, 0xeb, 0xd4, 0xd5, 0x4c, 0x94, 0xa0, 0x72, 0x77, + 0x61, 0x26, 0x06, 0x9d, 0x43, 0xe7, 0x4f, 0x9e + }; + + test_process_tx(CIP64, tx_data, sizeof(tx_data), to, USTREAM_FINISHED); } + int main(void) { const struct CMUnitTest tests[] = { - cmocka_unit_test(test_celo_tx), - cmocka_unit_test(test_celo_tx_invalid_address), + cmocka_unit_test(test_process_tx_eip1559), + cmocka_unit_test(test_process_tx_cip64) }; return cmocka_run_group_tests(tests, NULL, NULL); }