Skip to content

Commit b2c39a1

Browse files
Merge pull request #537 from LedgerHQ/feat/apa/remove_stark
Remove Starkware support
2 parents 87c7b98 + 726ffc1 commit b2c39a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+320
-3750
lines changed

doc/eth_contract_support_embedded.adoc

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ Application version 1.3.0 - 05th of July 2020
66
## 1.3.0
77
- Initial release
88

9-
## About
9+
## About
1010

1111
This document described how a specific device UI for a smart contract can be added in the current version of the Ethereum application, before plugins are added
1212

1313
## Standard support
1414

15-
The applications already includes dedicated UI support for those specific contract calls :
15+
The applications already includes dedicated UI support for those specific contract calls :
1616

1717
* ERC 20 approve(address, uint256) - implementation in *src_features/erc20_approval*
1818
* ERC 20 transfer(address, uint256) - implementation in *src_features/signTx*
1919

2020
## Requirements
2121

22-
The following data is necessary for a specific contract support
22+
The following data is necessary for a specific contract support
2323

2424
* Smart contract ABI (at least for calls that are to be supported by the application)
2525

26-
The following data is optional for a specific contract support
26+
The following data is optional for a specific contract support
2727

2828
* Contract address (can be optional if supported by multiple instances)
2929

@@ -38,60 +38,11 @@ The first four bytes of the call data for a function call specifies the function
3838
The following online tool can be used to compute selectors https://emn178.github.io/online-tools/keccak_256.html
3939

4040

41-
## Limitations
42-
43-
* The total number of parameters of a contract call is 4 (as defined in *src/shared_context.h* for tokenContext_t.data, each parameter being encoded as an uint256). Additional parameters can be supported if not required to handle the displaying logic (see "Also handle exception that only need to process the beginning of data" in *src_features/signTx/logic_signTx.c* for CONTRACT_STARKWARE_VERIFY_ESCAPE and CONTRACT_STARKWARE_REGISTER)
44-
45-
* Non fixed size types (dynamic sized byte sequences, dynamic sized strings, variable length arrays) are not directly supported
46-
47-
## Sample implementation of a function call
48-
49-
This example describes how to implement a specific UI for a contract call. This exemple is using Starkex token deposit - *deposit(uint256 tokenId, uint256 vaultId, uint256 quantizedAmount)*
50-
51-
52-
* Implement the specific UI logic in a new *src_features* subdirectory - note that strings.common.maxFee will be provisioned with the maximum fee to pay for this call
53-
54-
```
55-
See src_features/stark_contract_deposit for this example
56-
```
57-
58-
* Compute the selector
59-
60-
61-
```
62-
keccak-256("deposit(uint256,uint256,uint256)") = 00aeef8a...
63-
```
64-
65-
* Add an entry to the contract_call_t enum of *src/shared_context.h* for this function call
66-
67-
```
68-
CONTRACT_STARKWARE_DEPOSIT_TOKEN
69-
```
70-
71-
* Check for the selector being called and the arguments size in *src_features/signTx/logic_signTx.c* customProcessor function - additional logic can be applied (quantumSet in this example)
72-
73-
```C
74-
if ((context->currentFieldLength == STARKWARE_DEPOSIT_TOKEN_DATA_SIZE) &&
75-
(memcmp(context->workBuffer, STARKWARE_DEPOSIT_TOKEN_ID, 4) == 0) &&
76-
quantumSet) {
77-
contractProvisioned = CONTRACT_STARKWARE_DEPOSIT_TOKEN;
78-
}
79-
```
80-
81-
* Call the dedicated UI at the end of the transaction parsing in *src_features/signTx/logic_signTx.c* finalizeParsing function
82-
83-
```C
84-
if (contractProvisioned == CONTRACT_STARKWARE_DEPOSIT_TOKEN) {
85-
ux_flow_init(0, ux_approval_starkware_deposit_flow, NULL);
86-
return;
87-
}
88-
```
89-
9041
## Using ERC 20 token tickers
9142

9243
A UI implementation might want to convert an ERC 20 token contract address to a ticker for easier validation
9344

94-
2 tickers can be temporarily provisioned to the application by using the PROVIDE ERC 20 TOKEN INFORMATION APDU, described in *src_features/provideErc20TokenInformation* - the UI can then iterate on the provisioned tickers to display relevant information to the user
45+
2 tickers can be temporarily provisioned to the application by using the PROVIDE ERC 20 TOKEN INFORMATION APDU, described in *src_features/provideErc20TokenInformation* - the UI can then iterate on the provisioned tickers to display relevant information to the user
9546

9647
The same mechanism will be extended to support well known contract addresses in the future
9748

doc/eth_starkware_extensions.adoc

Lines changed: 0 additions & 348 deletions
This file was deleted.

0 commit comments

Comments
 (0)