Skip to content

Commit

Permalink
fix: I5-1
Browse files Browse the repository at this point in the history
  • Loading branch information
loicttn committed May 23, 2024
1 parent bf17198 commit 983c579
Show file tree
Hide file tree
Showing 65 changed files with 53 additions and 29 deletions.
36 changes: 18 additions & 18 deletions PLUGIN_SPECIFICATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ Smart contracts covered by the plugin:

For the smart contracts implemented, the functions covered by the plugin are:

| Contract | Function | Selector | Displayed Parameters |
| -------- | ------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| OCV1 | deposit | `0xd0e30db0` | <table><tbody> <tr><td><code>uint tx.value</code></td></tr> </tbody></table> |
| OCV1 | withdraw | `0x0968f264` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | withdrawELFee | `0xbf509bd4` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | withdrawCLFee | `0x2ba03a79` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | batchWithdraw | `0xe8a0c121` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | batchWithdrawELFee | `0xef5e4682` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | batchWithdrawCLFee | `0x0ffab6c2` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV2-N20 | stake | `0x3a4b66f1` | <table><tbody> <tr><td><code>uint tx.value</code></td></tr> </tbody></table> |
| OCV2-N20 | requestExit | `0x721c6513` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV2-N20 | multiClaim | `0xb7ba18c7` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV2-EQ | claim | `0xadcf1163` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| EL-SM | depositIntoStrategy | `0xe7a050aa` | <table><tbody> <tr><td><code>address strategy</code></td></tr> <tr><td><code>address ERC20</code></td></tr></tbody></table> |
| EL-SM | queueWithdrawals | `0x0dd8dd02` | <table><tbody> <tr><td><code>queuedWithdrawalParams.strategies[]</code> as string using an internal mapping</td></tr> </tbody></table> |
| EL-SM | completeQueuedWithdrawals | `0x33404396` | <table><tbody> <tr><td>strategies as string using an internal mapping</td></tr> <tr><td>redelegated or withdrawal action</tr></td> </tbody></table> |
| EL-DM | delegateTo | `0xeea9064b` | <table><tbody> <tr><td><code>address operator</code> or <code>"KILN"</code></td></tr> </tbody></table> |
| EL-DM | undelegate | `0xda8be864` | <table><tbody> <tr><td><code>type ParameterName</code></td></tr> </tbody></table> |
| Contract | Function | Selector | Displayed Parameters |
| -------- | ------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| OCV1 | deposit | `0xd0e30db0` | <table><tbody> <tr><td><code>uint tx.value</code></td></tr> </tbody></table> |
| OCV1 | withdraw | `0x0968f264` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | withdrawELFee | `0xbf509bd4` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | withdrawCLFee | `0x2ba03a79` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | batchWithdraw | `0xe8a0c121` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | batchWithdrawELFee | `0xef5e4682` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV1 | batchWithdrawCLFee | `0x0ffab6c2` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV2-N20 | stake | `0x3a4b66f1` | <table><tbody> <tr><td><code>uint tx.value</code></td></tr> </tbody></table> |
| OCV2-N20 | requestExit | `0x721c6513` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV2-N20 | multiClaim | `0xb7ba18c7` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| OCV2-EQ | claim | `0xadcf1163` | <table><tbody> <tr><td>n/r</td></tr> </tbody></table> |
| EL-SM | depositIntoStrategy | `0xe7a050aa` | <table><tbody> <tr><td><code>address strategy</code></td></tr> <tr><td><code>address ERC20</code></td></tr></tbody></table> |
| EL-SM | queueWithdrawals | `0x0dd8dd02` | <table><tbody> <tr><td><code>queuedWithdrawalParams.strategies[]</code> as string using an internal mapping</td></tr><tr><td><code>queuedWithdrawalParams.withdrawer</code></td></tr> </tbody></table> |
| EL-SM | completeQueuedWithdrawals | `0x33404396` | <table><tbody> <tr><td>strategies as string using an internal mapping</td></tr> <tr><td>redelegated or withdrawal action</tr></td> </tbody></table> |
| EL-DM | delegateTo | `0xeea9064b` | <table><tbody> <tr><td><code>address operator</code> or <code>"KILN"</code></td></tr> </tbody></table> |
| EL-DM | undelegate | `0xda8be864` | <table><tbody> <tr><td><code>type ParameterName</code></td></tr> </tbody></table> |
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ function queueWithdrawals(
Clearsigned:

- strategies: using mapping in `contracts.c`, they are either recognized or displayed as "UNKOWN"
- withdrawer

Shares are confusing for users and would be hard to store properly on the device for display.

Expand Down
4 changes: 2 additions & 2 deletions src/handle_finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ void handle_finalize(ethPluginFinalize_t *msg) {
case KILN_LR_QUEUE_WITHDRAWALS: {
{
lr_queue_withdrawals_t *params = &context->param_data.lr_queue_withdrawals;
// function screen
msg->numScreens = 1;
// function screen + withdrawer
msg->numScreens = 2;
// one screen per withdrawal
msg->numScreens += params->strategies_count;
PRINTF("NUMBER OF STRATEGIES TO DISPLAY: %d\n", params->strategies_count);
Expand Down
1 change: 1 addition & 0 deletions src/kiln_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ typedef struct {
uint8_t qwithdrawals_offsets_checksum_value[CX_KECCAK_256_SIZE];

// -- display
char withdrawer[ADDRESS_STR_LEN];
uint8_t strategies_count;
// list of strategies indexes **INCREMENTED BY 1** to display in the UI
// 0 is reserved for end of array
Expand Down
22 changes: 19 additions & 3 deletions src/provide_parameter/eigenlayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,26 @@ void handle_lr_queue_withdrawals(ethPluginProvideParameter_t *msg, context_t *co

context->next_param = LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_WITHDRAWER;
break;
case LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_WITHDRAWER:
case LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_WITHDRAWER: {
{
uint8_t buffer[ADDRESS_LENGTH];
copy_address(buffer, msg->parameter, sizeof(buffer));
char address_buffer[ADDRESS_STR_LEN];
getEthDisplayableAddress(buffer, address_buffer, sizeof(address_buffer), 0);
// we only support same withdrawer accross all the withdrawals
if (params->withdrawer[0] == '\0') {
memcpy(params->withdrawer, address_buffer, sizeof(params->withdrawer));
} else if (strcmp(params->withdrawer, address_buffer) != 0) {
PRINTF("Unexpected withdrawer address, %s != expected %s\n",
msg->parameter,
params->withdrawer);
msg->result = ETH_PLUGIN_RESULT_ERROR;
return;
}
}
context->next_param = LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_STRATEGIES_LENGTH;
break;
}
case LR_QUEUE_WITHDRAWALS__QWITHDRAWALS_STRATEGIES_LENGTH: {
// get number of item to parse
U2BE_from_parameter(msg->parameter, &params->current_item_count);
Expand Down Expand Up @@ -337,8 +354,7 @@ void handle_lr_queue_withdrawals(ethPluginProvideParameter_t *msg, context_t *co

uint8_t strategy_index = find_lr_known_strategy(address_buffer);
params->strategies[params->strategies_count] =
(strategy_index != UNKNOWN_LR_STRATEGY) ? strategy_index + 1
: UNKNOWN_LR_STRATEGY;
(strategy_index != UNKNOWN_LR_STRATEGY) ? strategy_index : UNKNOWN_LR_STRATEGY;

PRINTF("STRATEGY #: %d STRATEGY: %d\n", params->strategies_count, strategy_index);
}
Expand Down
12 changes: 9 additions & 3 deletions src/query_contract_ui/eigenlayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,26 @@ bool queue_withdrawals_ui(ethQueryContractUI_t *msg, context_t *context) {
ret = true;
break;

case 1:
strlcpy(msg->title, "Withdrawer", msg->titleLength);
strlcpy(msg->msg, params->withdrawer, msg->msgLength);
ret = true;
break;

default: {
{
// removing the first screen to current screen index
// to get the index of the withdrawal
uint8_t withdrawal_index = msg->screenIndex - 1;
uint8_t withdrawal_index = msg->screenIndex - 2;

if (withdrawal_index < params->strategies_count) {
strlcpy(msg->title, "Strategy", msg->titleLength);
uint8_t strategy = params->strategies[withdrawal_index];

if (strategy == UNKNOWN_LR_STRATEGY || strategy - 1 >= LR_STRATEGIES_COUNT) {
if (strategy == UNKNOWN_LR_STRATEGY || strategy >= LR_STRATEGIES_COUNT) {
strlcpy(msg->msg, "UNKNOWN", msg->msgLength);
} else {
strlcpy(msg->msg, lr_tickers[strategy - 1], msg->msgLength);
strlcpy(msg->msg, lr_tickers[strategy], msg->msgLength);
}
}

Expand Down
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_1_2_dimension/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_1_2_dimension/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_1_2_dimension/00005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_1_2_dimension/00006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_1_2_dimension/00007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanos_lrQueueWithdrawals_2_3_dimension/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_1_2_dimension/00003.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_1_2_dimension/00004.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_1_2_dimension/00005.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_1_2_dimension/00006.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_1_2_dimension/00007.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00003.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00004.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00005.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00006.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00007.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00008.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00009.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00010.png
Binary file modified tests/snapshots/nanox_lrQueueWithdrawals_2_3_dimension/00011.png
6 changes: 3 additions & 3 deletions tests/src/lrQueueWithdrawals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ nano_models.forEach(function (model) {
}
);
const tx = eth.signTransaction("44'/60'/0'/0", serializedTx, resolution);
const right_clicks = model.letter === 'S' ? 6 : 6;
const right_clicks = model.letter === 'S' ? 9 : 7;

await waitForAppScreen(sim);
await sim.navigateAndCompareSnapshots(
Expand Down Expand Up @@ -100,7 +100,7 @@ nano_models.forEach(function (model) {
}
);
const tx = eth.signTransaction("44'/60'/0'/0", serializedTx, resolution);
const right_clicks = model.letter === 'S' ? 10 : 10;
const right_clicks = model.letter === 'S' ? 13 : 11;

await waitForAppScreen(sim);
await sim.navigateAndCompareSnapshots(
Expand Down Expand Up @@ -156,7 +156,7 @@ nano_models.forEach(function (model) {
}
);
const tx = eth.signTransaction("44'/60'/0'/0", serializedTx, resolution);
const right_clicks = model.letter === 'S' ? 10 : 10;
const right_clicks = model.letter === 'S' ? 13 : 11;

await waitForAppScreen(sim);
await sim.navigateAndCompareSnapshots(
Expand Down

0 comments on commit 983c579

Please sign in to comment.