From 0aa4e97a3546e9f4e8aac71363605bd2b142437f Mon Sep 17 00:00:00 2001 From: "pwnh4 (@loicttn)" Date: Tue, 30 Apr 2024 00:02:41 +0200 Subject: [PATCH] fix: nits --- src/contracts.c | 4 +- src/dbg/debug.h | 5 - src/dbg/printf.c | 567 ------------------ src/handle_finalize.c | 5 + src/handle_init_contract.c | 6 - src/handle_query_contract_id.c | 30 - src/kiln_plugin.h | 21 +- src/provide_parameter/eigenlayer.c | 6 +- src/provide_parameter/provide_parameter.h | 2 +- src/query_contract_ui/eigenlayer.c | 2 +- tests/src/lrCompleteQueuedWithdrawals.test.js | 6 +- tests/src/lrDepositIntoStrategy.test.js | 2 +- tests/src/withdraw.test.js | 1 - tests/src/withdrawCL.test.js | 23 +- tests/src/withdrawEL.test.js | 23 +- 15 files changed, 50 insertions(+), 653 deletions(-) delete mode 100644 src/dbg/debug.h delete mode 100644 src/dbg/printf.c diff --git a/src/contracts.c b/src/contracts.c index 10963f0..ae42509 100644 --- a/src/contracts.c +++ b/src/contracts.c @@ -53,7 +53,7 @@ static const uint32_t KILN_LR_QUEUE_WITHDRAWALS_SELECTOR = 0x0dd8dd02; static const uint32_t KILN_LR_COMPLETE_QUEUED_WITHDRAWALS_SELECTOR = 0x33404396; // --- cast sig "delegateTo(address,(bytes,uint256),bytes32)" static const uint32_t KILN_LR_DELEGATE_TO_SELECTOR = 0xeea9064b; -// -- cast sig "undelegate(address)" +// --- cast sig "undelegate(address)" static const uint32_t KILN_LR_UNDELEGATE_SELECTOR = 0xda8be864; const char lr_strategy_addresses[LR_STRATEGIES_COUNT][ADDRESS_STR_LEN] = { @@ -120,4 +120,4 @@ const uint32_t KILN_SELECTORS[NUM_SELECTORS] = { KILN_LR_COMPLETE_QUEUED_WITHDRAWALS_SELECTOR, KILN_LR_DELEGATE_TO_SELECTOR, KILN_LR_UNDELEGATE_SELECTOR, -}; \ No newline at end of file +}; diff --git a/src/dbg/debug.h b/src/dbg/debug.h deleted file mode 100644 index 06f63df..0000000 --- a/src/dbg/debug.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -#include - -// Printf that uses speculos semi-hosting features. -void semihosted_printf(const char *format, ...); \ No newline at end of file diff --git a/src/dbg/printf.c b/src/dbg/printf.c deleted file mode 100644 index 7ef63c3..0000000 --- a/src/dbg/printf.c +++ /dev/null @@ -1,567 +0,0 @@ -#include "stdint.h" -#include -#include - -#if !defined(MIN) -#define MIN(x, y) ((x) < (y) ? (x) : (y)) -#endif // MIN - -// Prints the null terminated string pointed by `buf`. -static void debug_write(const char *buf) { - asm volatile( - "movs r0, #0x04\n" - "movs r1, %0\n" - "svc 0xab\n" ::"r"(buf) - : "r0", "r1"); -} - -// Prints a single character `c`. -static void printc(char c) { - char buf[2]; - - buf[0] = c; - buf[1] = 0; - debug_write(buf); -} - -// Prints `size` characters of `str. -static void prints(const char *str, uint16_t size) { - char buf[64]; - - while (size > 0) { - uint8_t written = MIN(sizeof(buf) - 1, size); - - memcpy(buf, str, written); - buf[written] = 0; - debug_write(buf); - - if (written >= size) { - size = 0; - } else { - size -= written; - str += written; - } - } -} - -static const char g_pcHex[] = { - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'a', - 'b', - 'c', - 'd', - 'e', - 'f', -}; - -static const char g_pcHex_cap[] = { - '0', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - 'A', - 'B', - 'C', - 'D', - 'E', - 'F', -}; - -void semihosted_printf(const char *format, ...) { - unsigned long ulIdx, ulValue, ulPos, ulCount, ulBase, ulNeg, ulStrlen, ulCap; - char *pcStr, pcBuf[16], cFill; - va_list vaArgP; - char cStrlenSet; - - // - // Check the arguments. - // - if (format == 0) { - return; - } - - // - // Start the varargs processing. - // - va_start(vaArgP, format); - - // - // Loop while there are more characters in the string. - // - while (*format) { - // - // Find the first non-% character, or the end of the string. - // - for (ulIdx = 0; (format[ulIdx] != '%') && (format[ulIdx] != '\0'); ulIdx++) { - } - - // - // Write this portion of the string. - // - prints(format, ulIdx); - - // - // Skip the portion of the string that was written. - // - format += ulIdx; - - // - // See if the next character is a %. - // - if (*format == '%') { - // - // Skip the %. - // - format++; - - // - // Set the digit count to zero, and the fill character to space - // (i.e. to the defaults). - // - ulCount = 0; - cFill = ' '; - ulStrlen = 0; - cStrlenSet = 0; - ulCap = 0; - ulBase = 10; - - // - // It may be necessary to get back here to process more characters. - // Goto's aren't pretty, but effective. I feel extremely dirty for - // using not one but two of the beasts. - // - again: - - // - // Determine how to handle the next character. - // - switch (*format++) { - // - // Handle the digit characters. - // - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': { - // - // If this is a zero, and it is the first digit, then the - // fill character is a zero instead of a space. - // - if ((format[-1] == '0') && (ulCount == 0)) { - cFill = '0'; - } - - // - // Update the digit count. - // - ulCount *= 10; - ulCount += format[-1] - '0'; - - // - // Get the next character. - // - goto again; - } - - // - // Handle the %c command. - // - case 'c': { - // - // Get the value from the varargs. - // - ulValue = va_arg(vaArgP, unsigned long); - - // - // Print out the character. - // - prints((char *) &ulValue, 1); - - // - // This command has been handled. - // - break; - } - - // - // Handle the %d command. - // - case 'd': { - // - // Get the value from the varargs. - // - ulValue = va_arg(vaArgP, unsigned long); - - // - // Reset the buffer position. - // - ulPos = 0; - - // - // If the value is negative, make it positive and indicate - // that a minus sign is needed. - // - if ((long) ulValue < 0) { - // - // Make the value positive. - // - ulValue = -(long) ulValue; - - // - // Indicate that the value is negative. - // - ulNeg = 1; - } else { - // - // Indicate that the value is positive so that a minus - // sign isn't inserted. - // - ulNeg = 0; - } - - // - // Set the base to 10. - // - ulBase = 10; - - // - // Convert the value to ASCII. - // - goto convert; - } - - // - // Handle ths %.*s command - // special %.*H or %.*h format to print a given length of hex digits (case: H UPPER, - // h lower) - // - case '.': { - // ensure next char is '*' and next one is 's' - if (format[0] == '*' && - (format[1] == 's' || format[1] == 'H' || format[1] == 'h')) { - // skip '*' char - format++; - - ulStrlen = va_arg(vaArgP, unsigned long); - cStrlenSet = 1; - - // interpret next char (H/h/s) - goto again; - } - - // does not support %.2x for example - goto error; - } - - case '*': { - if (*format == 's') { - ulStrlen = va_arg(vaArgP, unsigned long); - cStrlenSet = 2; - goto again; - } - - goto error; - } - - case '-': // -XXs - { - cStrlenSet = 0; - // read a number of space to post pad with ' ' the string to display - goto again; - } - - // - // Handle the %s command. - // %H and %h also - case 'H': - ulCap = 1; // uppercase base 16 - ulBase = 16; - goto case_s; - case 'h': - ulCap = 0; - ulBase = 16; // lowercase base 16 - goto case_s; - case 's': - case_s : { - // - // Get the string pointer from the varargs. - // - pcStr = va_arg(vaArgP, char *); - - // - // Determine the length of the string. (if not specified using .*) - // - switch (cStrlenSet) { - // compute length with strlen - case 0: - for (ulIdx = 0; pcStr[ulIdx] != '\0'; ulIdx++) { - } - break; - - // use given length - case 1: - ulIdx = ulStrlen; - break; - - // printout prepad - case 2: - // if string is empty, then, ' ' padding - if (pcStr[0] == '\0') { - // padd ulStrlen white space - do { - prints(" ", 1); - } while (ulStrlen-- > 0); - - goto s_pad; - } - goto error; // unsupported if replicating the same string multiple - // times - case 3: - // skip '-' still buggy ... - goto again; - } - - // - // Write the string. - // - switch (ulBase) { - default: - prints(pcStr, ulIdx); - break; - case 16: { - unsigned char nibble1, nibble2; - for (ulCount = 0; ulCount < ulIdx; ulCount++) { - nibble1 = (pcStr[ulCount] >> 4) & 0xF; - nibble2 = pcStr[ulCount] & 0xF; - switch (ulCap) { - case 0: - printc(g_pcHex[nibble1]); - printc(g_pcHex[nibble2]); - break; - case 1: - printc(g_pcHex_cap[nibble1]); - printc(g_pcHex_cap[nibble2]); - break; - } - } - break; - } - } - - s_pad: - // - // Write any required padding spaces - // - if (ulCount > ulIdx) { - ulCount -= ulIdx; - while (ulCount--) { - prints(" ", 1); - } - } - // - // This command has been handled. - // - break; - } - - // - // Handle the %u command. - // - case 'u': { - // - // Get the value from the varargs. - // - ulValue = va_arg(vaArgP, unsigned long); - - // - // Reset the buffer position. - // - ulPos = 0; - - // - // Set the base to 10. - // - ulBase = 10; - - // - // Indicate that the value is positive so that a minus sign - // isn't inserted. - // - ulNeg = 0; - - // - // Convert the value to ASCII. - // - goto convert; - } - - // - // Handle the %x and %X commands. Note that they are treated - // identically; i.e. %X will use lower case letters for a-f - // instead of the upper case letters is should use. We also - // alias %p to %x. - // - case 'X': - ulCap = 1; - __attribute__((fallthrough)); - case 'x': - case 'p': { - // - // Get the value from the varargs. - // - ulValue = va_arg(vaArgP, unsigned long); - - // - // Reset the buffer position. - // - ulPos = 0; - - // - // Set the base to 16. - // - ulBase = 16; - - // - // Indicate that the value is positive so that a minus sign - // isn't inserted. - // - ulNeg = 0; - - // - // Determine the number of digits in the string version of - // the value. - // - convert: - for (ulIdx = 1; - (((ulIdx * ulBase) <= ulValue) && (((ulIdx * ulBase) / ulBase) == ulIdx)); - ulIdx *= ulBase, ulCount--) { - } - - // - // If the value is negative, reduce the count of padding - // characters needed. - // - if (ulNeg) { - ulCount--; - } - - // - // If the value is negative and the value is padded with - // zeros, then place the minus sign before the padding. - // - if (ulNeg && (cFill == '0')) { - // - // Place the minus sign in the output buffer. - // - pcBuf[ulPos++] = '-'; - - // - // The minus sign has been placed, so turn off the - // negative flag. - // - ulNeg = 0; - } - - // - // Provide additional padding at the beginning of the - // string conversion if needed. - // - if ((ulCount > 1) && (ulCount < 16)) { - for (ulCount--; ulCount; ulCount--) { - pcBuf[ulPos++] = cFill; - } - } - - // - // If the value is negative, then place the minus sign - // before the number. - // - if (ulNeg) { - // - // Place the minus sign in the output buffer. - // - pcBuf[ulPos++] = '-'; - } - - // - // Convert the value into a string. - // - for (; ulIdx; ulIdx /= ulBase) { - if (!ulCap) { - pcBuf[ulPos++] = g_pcHex[(ulValue / ulIdx) % ulBase]; - } else { - pcBuf[ulPos++] = g_pcHex_cap[(ulValue / ulIdx) % ulBase]; - } - } - - // - // Write the string. - // - prints(pcBuf, ulPos); - - // - // This command has been handled. - // - break; - } - - // - // Handle the %% command. - // - case '%': { - // - // Simply write a single %. - // - prints(format - 1, 1); - - // - // This command has been handled. - // - break; - } - - error: - // - // Handle all other commands. - // - default: { - // - // Indicate an error. - // - prints("ERROR", 5); - - // - // This command has been handled. - // - break; - } - } - } - } - - // - // End the varargs processing. - // - va_end(vaArgP); -} \ No newline at end of file diff --git a/src/handle_finalize.c b/src/handle_finalize.c index 29c397c..841bcc4 100644 --- a/src/handle_finalize.c +++ b/src/handle_finalize.c @@ -29,6 +29,10 @@ void handle_finalize(ethPluginFinalize_t *msg) { case KILN_V1_BATCH_WITHDRAW_EL: case KILN_V1_BATCH_WITHDRAW_CL: case KILN_V1_REQUEST_EXIT: + msg->numScreens = 1; + msg->result = ETH_PLUGIN_RESULT_OK; + break; + case KILN_V2_STAKE: case KILN_V2_REQUEST_EXIT: case KILN_V2_MULTICLAIM: @@ -36,6 +40,7 @@ void handle_finalize(ethPluginFinalize_t *msg) { msg->numScreens = 1; msg->result = ETH_PLUGIN_RESULT_OK; break; + case KILN_LR_DEPOSIT_INTO_STRATEGY: msg->numScreens = 3; msg->result = ETH_PLUGIN_RESULT_OK; diff --git a/src/handle_init_contract.c b/src/handle_init_contract.c index 30d1228..e6d79b5 100644 --- a/src/handle_init_contract.c +++ b/src/handle_init_contract.c @@ -44,18 +44,12 @@ void handle_init_contract(ethPluginInitContract_t *msg) { switch (context->selectorIndex) { case KILN_V1_DEPOSIT: - break; - case KILN_V1_WITHDRAW: case KILN_V1_WITHDRAW_EL: case KILN_V1_WITHDRAW_CL: - break; - case KILN_V1_BATCH_WITHDRAW: case KILN_V1_BATCH_WITHDRAW_EL: case KILN_V1_BATCH_WITHDRAW_CL: - break; - case KILN_V1_REQUEST_EXIT: break; diff --git a/src/handle_query_contract_id.c b/src/handle_query_contract_id.c index 0bf1e16..b03e6ad 100644 --- a/src/handle_query_contract_id.c +++ b/src/handle_query_contract_id.c @@ -24,57 +24,27 @@ void handle_query_contract_id(ethQueryContractID_t *msg) { switch (context->selectorIndex) { case KILN_V1_DEPOSIT: - strlcpy(msg->version, "Native Staking", msg->versionLength); - break; - case KILN_V1_WITHDRAW: case KILN_V1_WITHDRAW_EL: case KILN_V1_WITHDRAW_CL: - strlcpy(msg->version, "Native Staking", msg->versionLength); - break; - case KILN_V1_BATCH_WITHDRAW: case KILN_V1_BATCH_WITHDRAW_EL: case KILN_V1_BATCH_WITHDRAW_CL: - strlcpy(msg->version, "Native Staking", msg->versionLength); - break; - case KILN_V1_REQUEST_EXIT: strlcpy(msg->version, "Native Staking", msg->versionLength); break; case KILN_V2_STAKE: - strlcpy(msg->version, "Pooled Staking", msg->versionLength); - break; - case KILN_V2_REQUEST_EXIT: - strlcpy(msg->version, "Pooled Staking", msg->versionLength); - break; - case KILN_V2_MULTICLAIM: - strlcpy(msg->version, "Pooled Staking", msg->versionLength); - break; - case KILN_V2_CLAIM: strlcpy(msg->version, "Pooled Staking", msg->versionLength); break; case KILN_LR_DEPOSIT_INTO_STRATEGY: - strlcpy(msg->version, "EigenLayer", msg->versionLength); - break; - case KILN_LR_QUEUE_WITHDRAWALS: - strlcpy(msg->version, "EigenLayer", msg->versionLength); - break; - case KILN_LR_COMPLETE_QUEUED_WITHDRAWALS: - strlcpy(msg->version, "EigenLayer", msg->versionLength); - break; - case KILN_LR_DELEGATE_TO: - strlcpy(msg->version, "EigenLayer", msg->versionLength); - break; - case KILN_LR_UNDELEGATE: strlcpy(msg->version, "EigenLayer", msg->versionLength); break; diff --git a/src/kiln_plugin.h b/src/kiln_plugin.h index 88178b8..f102aa5 100644 --- a/src/kiln_plugin.h +++ b/src/kiln_plugin.h @@ -43,7 +43,7 @@ // // V2 selectors // --- 8. stake() -// --- 9. requestExit(shares_count) +// --- 9. requestExit(shares_amount) // --- 10. multiClaim(exit_queues, ticket_ids, cask_ids) // --- 11. claim(uint256[],uint32[],uint16) // @@ -86,6 +86,7 @@ typedef enum { // globals #define LR_STRATEGIES_COUNT 11 +#define UNKNOW_LR_ERC20 255 #define UNKNOW_LR_STRATEGY 255 #define MAX_DISPLAYABLE_LR_STRATEGIES_COUNT (LR_STRATEGIES_COUNT * 3) #define ERC20_DECIMALS 18 @@ -100,14 +101,15 @@ extern const char lr_kiln_operator_address[ADDRESS_STR_LEN]; // Parameters and state machines for EigenLayer parsing typedef enum { - LR_DEPOSIT_INTO_STRATEGY_STRATEGY = 0, + LR_DEPOSIT_INTO_STRATEGY_UNEXPECTED_PARAMETER = 0, + LR_DEPOSIT_INTO_STRATEGY_STRATEGY, LR_DEPOSIT_INTO_STRATEGY_TOKEN, LR_DEPOSIT_INTO_STRATEGY_AMOUNT, - LR_DEPOSIT_INTO_STRATEGY_UNEXPECTED_PARAMETER, } lr_deposit_into_strategy_parameters; typedef enum { - LR_QUEUE_WITHDRAWALS_QWITHDRAWALS_OFFSET = 0, + LR_QUEUE_WITHDRAWALS_UNEXPECTED_PARAMETER = 0, + LR_QUEUE_WITHDRAWALS_QWITHDRAWALS_OFFSET, LR_QUEUE_WITHDRAWALS_QWITHDRAWALS_LENGTH, LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_STRUCT_OFFSET, LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_STRATEGIES_OFFSET, @@ -117,11 +119,11 @@ typedef enum { LR_QUEUE_WITHDRAWALS__QWITHDRAWALS__STRATEGIES_ITEM, LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_SHARES_LENGTH, LR_QUEUE_WITHDRAWALS__QWITHDRAWALS__SHARES_ITEM, - LR_QUEUE_WITHDRAWALS_UNEXPECTED_PARAMETER } lr_queue_withdrawals_parameters; typedef enum { - LRCQW_WITHDRAWALS_OFFSET = 0, + LRCQW_UNEXPECTED_PARAMETER = 0, + LRCQW_WITHDRAWALS_OFFSET, LRCQW_TOKENS_OFFSET, LRCQW_MIDDLEWARE_TIMES_INDEXES_OFFSET, LRCQW_RECEIVE_AS_TOKENS_OFFSET, @@ -152,20 +154,17 @@ typedef enum { LRCQW_RECEIVE_AS_TOKENS_LENGTH, LRCQW_RECEIVE_AS_TOKENS__ITEMS, - - LRCQW_UNEXPECTED_PARAMETER - } lr_complete_queued_withdrawals_parameters; typedef enum { - LR_DELEGATE_TO_OPERATOR = 0, + LR_DELEGATE_TO_UNEXPECTED_PARAMETER = 0, + LR_DELEGATE_TO_OPERATOR, LR_DELEGATE_TO_SIGNATURE_OFFSET, LR_DELEGATE_TO_APPROVER_SALT, LR_DELEGATE_TO_SIGNATURE_SIG_OFFSET, LR_DELEGATE_TO_SIGNATURE_EXPIRY, LR_DELEGATE_TO_SIGNATURE_SIG_LENGTH, LR_DELEGATE_TO_SIGNATURE_SIG_ITEMS, - LR_DELEGATE_TO_UNEXPECTED_PARAMETER } lr_delegate_to_parameters; // **************************************************************************** diff --git a/src/provide_parameter/eigenlayer.c b/src/provide_parameter/eigenlayer.c index 171da3d..f5d58cc 100644 --- a/src/provide_parameter/eigenlayer.c +++ b/src/provide_parameter/eigenlayer.c @@ -34,11 +34,11 @@ bool compare_addresses(const char a[ADDRESS_STR_LEN], const char b[ADDRESS_STR_L /** * @brief If address is a known erc20, update lr display context with its name - * otherwise set it to unkwown (UNKNOW_LR_STRATEGY) + * otherwise set it to unkwown (UNKNOW_LR_ERC20) * * @param address: address to compare * - * @returns index of the erc20 in the context or UNKNOW_LR_STRATEGY if not found + * @returns index of the erc20 in the context or UNKNOW_LR_ERC20 if not found */ uint8_t find_lr_known_erc20(const char address[ADDRESS_STR_LEN]) { for (size_t i = 0; i < LR_STRATEGIES_COUNT; i++) { @@ -47,7 +47,7 @@ uint8_t find_lr_known_erc20(const char address[ADDRESS_STR_LEN]) { } } // if unknown erc20, indicate it - return UNKNOW_LR_STRATEGY; + return UNKNOW_LR_ERC20; } /** diff --git a/src/provide_parameter/provide_parameter.h b/src/provide_parameter/provide_parameter.h index 63c41d6..6ac5634 100644 --- a/src/provide_parameter/provide_parameter.h +++ b/src/provide_parameter/provide_parameter.h @@ -23,4 +23,4 @@ void handle_lr_deposit_into_strategy(ethPluginProvideParameter_t *msg, context_t *context); void handle_lr_queue_withdrawals(ethPluginProvideParameter_t *msg, context_t *context); void handle_lr_complete_queued_withdrawals(ethPluginProvideParameter_t *msg, context_t *context); -void handle_lr_delegate_to(ethPluginProvideParameter_t *msg, context_t *context); \ No newline at end of file +void handle_lr_delegate_to(ethPluginProvideParameter_t *msg, context_t *context); diff --git a/src/query_contract_ui/eigenlayer.c b/src/query_contract_ui/eigenlayer.c index ac65260..efe9350 100644 --- a/src/query_contract_ui/eigenlayer.c +++ b/src/query_contract_ui/eigenlayer.c @@ -47,7 +47,7 @@ bool deposit_into_strategy_ui(ethQueryContractUI_t *msg, context_t *context) { amountToString(params->erc20_amount_to_display, sizeof(params->erc20_amount_to_display), ERC20_DECIMALS, - params->erc20_to_display == UNKNOW_LR_STRATEGY || + params->erc20_to_display == UNKNOW_LR_ERC20 || params->erc20_to_display >= LR_STRATEGIES_COUNT ? "UNKNOWN" : lr_tickers[params->erc20_to_display], diff --git a/tests/src/lrCompleteQueuedWithdrawals.test.js b/tests/src/lrCompleteQueuedWithdrawals.test.js index c0adb91..c290600 100644 --- a/tests/src/lrCompleteQueuedWithdrawals.test.js +++ b/tests/src/lrCompleteQueuedWithdrawals.test.js @@ -5,7 +5,7 @@ import { ethers } from 'ethers'; import { parseEther } from 'ethers/lib/utils'; import { ledgerService } from '@ledgerhq/hw-app-eth'; -const contractAddr = '0x858646372cc42e1a627fce94aa7a7033e7cf075a'; // delegation manager +const contractAddr = '0x858646372cc42e1a627fce94aa7a7033e7cf075a'; // strategy manager const abi_path = `../cal/abis/${contractAddr}.json`; const abi = require(abi_path); @@ -66,6 +66,10 @@ nano_models.forEach(function (model) { '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704', // cbETH '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', // stETH ], + [ + '0xBe9895146f7AF43049ca1c1AE358B0541Ea49704', // cbETH + '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', // stETH + ], ], [0, 0], [false, false] diff --git a/tests/src/lrDepositIntoStrategy.test.js b/tests/src/lrDepositIntoStrategy.test.js index 3ac1f24..3491634 100644 --- a/tests/src/lrDepositIntoStrategy.test.js +++ b/tests/src/lrDepositIntoStrategy.test.js @@ -108,7 +108,7 @@ nano_models.forEach(function (model) { const { data } = await contract.populateTransaction.depositIntoStrategy( '0x298aFB19A105D59E74658C4C334Ff360BadE6dd2', // mETH strategy - '0x1e68238ce926dec62b3fbc99ab06eb1d85ce0270', // sfrxETH erc20 + '0x1e68238ce926dec62b3fbc99ab06eb1d85ce0270', // unknown erc20 '420000000000000' ); diff --git a/tests/src/withdraw.test.js b/tests/src/withdraw.test.js index fa210e1..d2de4d9 100644 --- a/tests/src/withdraw.test.js +++ b/tests/src/withdraw.test.js @@ -26,7 +26,6 @@ nano_models.forEach(function (model) { const validatorAddress = '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'; - const deadline = Number(1632843280); const { data } = await contract.populateTransaction.withdraw( validatorAddress diff --git a/tests/src/withdrawCL.test.js b/tests/src/withdrawCL.test.js index 3729230..855fca9 100644 --- a/tests/src/withdrawCL.test.js +++ b/tests/src/withdrawCL.test.js @@ -1,5 +1,5 @@ -import "core-js/stable"; -import "regenerator-runtime/runtime"; +import 'core-js/stable'; +import 'regenerator-runtime/runtime'; import { waitForAppScreen, zemu, @@ -7,26 +7,25 @@ import { nano_models, SPECULOS_ADDRESS, txFromEtherscan, -} from "./test.fixture"; -import { ethers } from "ethers"; -import { parseEther, parseUnits } from "ethers/lib/utils"; -import { ledgerService } from "@ledgerhq/hw-app-eth"; +} from './test.fixture'; +import { ethers } from 'ethers'; +import { parseEther, parseUnits } from 'ethers/lib/utils'; +import { ledgerService } from '@ledgerhq/hw-app-eth'; -const contractAddr = "0xe8ff2a04837aac535199eecb5ece52b2735b3543"; +const contractAddr = '0xe8ff2a04837aac535199eecb5ece52b2735b3543'; -const pluginName = "Kiln" +const pluginName = 'Kiln'; const abi_path = `../cal/abis/${contractAddr}.json`; const abi = require(abi_path); nano_models.forEach(function (model) { test( - "[Nano " + model.letter + "] Withdraw CL", + '[Nano ' + model.letter + '] Withdraw CL', zemu(model, async (sim, eth) => { const contract = new ethers.Contract(contractAddr, abi); const validatorAddress = - "0x8905410ae09a0b89d6af7296e2d0ae19adb672744f600d8da9b6293259641aa6e316bee60936cc1459b3f8697343d0f0"; - const deadline = Number(1632843280); + '0x8905410ae09a0b89d6af7296e2d0ae19adb672744f600d8da9b6293259641aa6e316bee60936cc1459b3f8697343d0f0'; const { data } = await contract.populateTransaction.withdrawCLFee( validatorAddress @@ -53,7 +52,7 @@ nano_models.forEach(function (model) { await waitForAppScreen(sim); - await sim.navigateAndCompareSnapshots(".", model.name + "_withdrawCL", [ + await sim.navigateAndCompareSnapshots('.', model.name + '_withdrawCL', [ right_clicks, 0, ]); diff --git a/tests/src/withdrawEL.test.js b/tests/src/withdrawEL.test.js index 87f25e5..70a22c4 100644 --- a/tests/src/withdrawEL.test.js +++ b/tests/src/withdrawEL.test.js @@ -1,5 +1,5 @@ -import "core-js/stable"; -import "regenerator-runtime/runtime"; +import 'core-js/stable'; +import 'regenerator-runtime/runtime'; import { waitForAppScreen, zemu, @@ -7,26 +7,25 @@ import { nano_models, SPECULOS_ADDRESS, txFromEtherscan, -} from "./test.fixture"; -import { ethers } from "ethers"; -import { parseEther, parseUnits } from "ethers/lib/utils"; -import { ledgerService } from "@ledgerhq/hw-app-eth"; +} from './test.fixture'; +import { ethers } from 'ethers'; +import { parseEther, parseUnits } from 'ethers/lib/utils'; +import { ledgerService } from '@ledgerhq/hw-app-eth'; -const contractAddr = "0xe8ff2a04837aac535199eecb5ece52b2735b3543"; +const contractAddr = '0xe8ff2a04837aac535199eecb5ece52b2735b3543'; -const pluginName = "Kiln"; +const pluginName = 'Kiln'; const abi_path = `../cal/abis/${contractAddr}.json`; const abi = require(abi_path); nano_models.forEach(function (model) { test( - "[Nano " + model.letter + "] Withdraw EL", + '[Nano ' + model.letter + '] Withdraw EL', zemu(model, async (sim, eth) => { const contract = new ethers.Contract(contractAddr, abi); const validatorAddress = - "0x8905410ae09a0b89d6af7296e2d0ae19adb672744f600d8da9b6293259641aa6e316bee60936cc1459b3f8697343d0f0"; - const deadline = Number(1632843280); + '0x8905410ae09a0b89d6af7296e2d0ae19adb672744f600d8da9b6293259641aa6e316bee60936cc1459b3f8697343d0f0'; const { data } = await contract.populateTransaction.withdrawELFee( validatorAddress @@ -53,7 +52,7 @@ nano_models.forEach(function (model) { await waitForAppScreen(sim); - await sim.navigateAndCompareSnapshots(".", model.name + "_withdrawEL", [ + await sim.navigateAndCompareSnapshots('.', model.name + '_withdrawEL', [ right_clicks, 0, ]);