DODOEX / ledger-plugin

Apache License 2.0
1 stars 2 forks source link

Ledger Donjon review #8

Open adrienlacombe opened 1 year ago

adrienlacombe commented 1 year ago
junjieit commented 1 year ago

The function handle_swap_dodo_route_proxy_dodo_mutli_swap could have more suggestive names in the switch statement

We are named by method name.

Also when getting an offset from a parameter it one of these functions should be used...

Here is the use of U2BE.

Other than that on PATH_LENGTH it should be checked the length of the array

It means to judge whether the length of msg->parameter is PARAMETER_LENGTH?

Add context->valid = true...

is it necessary to add this?

For the withdraw method there could be a single screen with the name withdraw and the amount For the deposit method there could be a single screen with the name deposit and the amount

Because here is the swap page on the front-end page, swap eth => weth or weth => eth. so there is no single screen display

adrienlacombe commented 1 year ago

The function handle_swap_dodo_route_proxy_dodo_mutli_swap could have more suggestive names in the switch statement

We are named by method name.

This is not a real issue but don’t see the meaning of the names PATH_OFFSET/PATH_LENGTH since the arguments of the method dodoMutliSwap don’t have a argument called path. This would improved readability

Also when getting an offset from a parameter it one of these functions should be used...

Here is the use of U2BE.

For instance https://github.com/LedgerHQ/app-plugin-rarible/commit/60cb195f47c0f68d53917f52e53c1e503b0f4f99

Other than that on PATH_LENGTH it should be checked the length of the array

It means to judge whether the length of msg->parameter is PARAMETER_LENGTH?

For instance checking if it has a meaningful value like != 0

Add context->valid = true...

is it necessary to add this?

Yes, otherwise not sending any parameters would lead to use of “uninitialized” values and therefore wrong information displayed to the user.

For the withdraw method there could be a single screen with the name withdraw and the amount For the deposit method there could be a single screen with the name deposit and the amount

Because here is the swap page on the front-end page, swap eth => weth or weth => eth. so there is no single screen display

adrienlacombe commented 1 year ago