Merge pull request #246 from LedgerHQ/apr/feature/update_zemu

Update to the latest Zemu framework
This commit is contained in:
apaillier-ledger
2022-02-09 09:21:54 +01:00
committed by GitHub
58 changed files with 70 additions and 112 deletions

View File

@@ -15,7 +15,7 @@
"@ledgerhq/hw-app-eth": "^6.5.0",
"@ledgerhq/hw-transport-http": "^4.74.2",
"@ledgerhq/logs": "^5.50.0",
"@zondax/zemu": "^0.21.1",
"@zondax/zemu": "^0.22.1",
"bignumber.js": "^9.0.0",
"bip32-path": "^0.4.2",
"core-js": "^3.7.0",

View File

@@ -0,0 +1 @@
00007.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00007.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00013.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00009.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00009.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00006.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00008.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00009.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00008.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00009.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

View File

@@ -0,0 +1 @@
00005.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00005.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00007.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00009.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00007.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00009.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00005.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00005.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00004.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00004.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00005.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00004.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -0,0 +1 @@
00005.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -11,15 +11,10 @@ nano_models.forEach(function(model) {
);
let clicks;
if (model.letter === 'S') clicks = [8];
else clicks = [6];
if (model.letter === 'S') clicks = 8;
else clicks = 6;
await waitForAppScreen(sim);
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_approve_dai_tokens', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
await sim.navigateAndCompareSnapshots('.', model.name + '_approve_dai_tokens', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "92243511396b65a4faa735a5472ea99b3ce0f7f2338eab426206730bc0ddc57f",

View File

@@ -14,14 +14,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [8];
else clicks = [6];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_deposit_eth_compound_blind', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 8;
else clicks = 6;
await sim.navigateAndCompareSnapshots('.', model.name + '_deposit_eth_compound_blind', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "b5ae3a011eb50e7d1fe9f5e6f6d91ca9f4dfca5f73805fc4866d49e72ead2f5c",

View File

@@ -12,14 +12,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [10];
else clicks = [6];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_112233445566_network', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 10;
else clicks = 6;
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_112233445566_network', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "509981d8dfb66757e25ff47c009b9b5bc5db0f169473e4735f5212b144f1c069",
@@ -39,14 +34,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [10];
else clicks = [6];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_palm_network', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 10;
else clicks = 6;
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_palm_network', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "946700c4972b3da24ddaa95e590ad25a8f905da62e2bd053285a4cc17f93f490",

View File

@@ -12,14 +12,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [7];
else clicks = [5];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_eip1559', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 7;
else clicks = 5;
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_eip1559', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "3d6dfabc6c52374bfa34cb2c433856a0bcd9484870dd1b50249f7164a5fce052",

View File

@@ -16,17 +16,12 @@ test('[Nano ' + model.letter + '] Transfer ERC-1155', zemu(model, async (sim, et
await send_apdu(eth.transport, set_plugin);
await send_apdu(eth.transport, provide_nft_info);
await send_apdu(eth.transport, sign_first);
send_apdu(eth.transport, sign_more);
let sign_promise = send_apdu(eth.transport, sign_more);
await waitForAppScreen(sim, current_screen);
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_erc1155_transfer', [10]);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
// Sleep so it has time to send the response APDU
await Zemu.sleep(500);
await sim.navigateAndCompareSnapshots('.', model.name + '_erc1155_transfer', [10, -1, 0]);
await sign_promise;
}));
test('[Nano ' + model.letter + '] Batch transfer ERC-1155', zemu(model, async (sim, eth) => {
@@ -44,15 +39,10 @@ test('[Nano ' + model.letter + '] Batch transfer ERC-1155', zemu(model, async (s
await send_apdu(eth.transport, sign_first);
await send_apdu(eth.transport, sign_more_1);
await send_apdu(eth.transport, sign_more_2);
send_apdu(eth.transport, sign_more_3);
let sign_promise = send_apdu(eth.transport, sign_more_3);
await waitForAppScreen(sim, current_screen);
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_erc1155_batch_transfer', [8]);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
// Sleep so it has time to send the response APDU
await Zemu.sleep(500);
await sim.navigateAndCompareSnapshots('.', model.name + '_erc1155_batch_transfer', [8, -1, 0]);
await sign_promise;
}));

View File

@@ -16,15 +16,10 @@ test('[Nano ' + model.letter + '] Transfer ERC-721', zemu(model, async (sim, eth
await send_apdu(eth.transport, set_plugin);
await send_apdu(eth.transport, provide_nft_info);
await send_apdu(eth.transport, sign_first);
send_apdu(eth.transport, sign_more);
let sign_promise = send_apdu(eth.transport, sign_more);
await waitForAppScreen(sim, current_screen);
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_erc721_transfer', [8]);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
// Sleep so it has time to send the response APDU
await Zemu.sleep(500);
await sim.navigateAndCompareSnapshots('.', model.name + '_erc721_transfer', [8, -1, 0]);
await sign_promise;
}));

View File

@@ -13,14 +13,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [9];
else clicks = [5];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_ethereum', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 9;
else clicks = 5;
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_ethereum', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "6f389d15320f0501383526ed03de917c14212716f09a262dbc98431086a5db49",
@@ -52,14 +47,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [10];
else clicks = [6];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_ethereum_5234_network', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 10;
else clicks = 6;
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_ethereum_5234_network', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "07a7982dfd16360c96a03467877d0cf9c36f799deff4dace250cdb18e28a3b90",

View File

@@ -12,14 +12,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [10];
else clicks = [6];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_bsc', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 10;
else clicks = 6;
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_bsc', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "f667cc34e9815df4f052fb3463cdbe355fff5c1acf4e919b3539806521a059ad",

View File

@@ -12,14 +12,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [9];
else clicks = [5];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_ethereum_clone', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 9;
else clicks = 5;
await sim.navigateAndCompareSnapshots('.', model.name + '_transfer_ethereum_clone', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "60df850d297e355596f87dc313a742032de4b59c5579186b3d59bdf31402fec0",

View File

@@ -27,14 +27,9 @@ nano_models.forEach(function(model) {
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [14];
else clicks = [10];
// Go to the reject screen
await sim.navigateAndCompareSnapshots('.', model.name + '_starkware_usdt_deposit', clicks);
// Accepting the transaction somehow takes too long for Zemu and takes the same screenshot
// twice, so accept it manually
await sim.clickLeft();
await sim.clickBoth();
if (model.letter === 'S') clicks = 14;
else clicks = 10;
await sim.navigateAndCompareSnapshots('.', model.name + '_starkware_usdt_deposit', [clicks, -1, 0]);
await expect(tx).resolves.toEqual({
"r": "14c368c0d32e399470d6113cf796c5f4cd70300766337d8b0ba71ecad21b3d52",

View File

@@ -2238,10 +2238,10 @@
dependencies:
"@types/yargs-parser" "*"
"@zondax/zemu@^0.21.1":
version "0.21.1"
resolved "https://registry.yarnpkg.com/@zondax/zemu/-/zemu-0.21.1.tgz#528861c8c0908f88d9104406519b5468dd440d91"
integrity sha512-lWsh4ih/BMaEQYbsjXfia1sw2ouXu2nCSNV5QfeCVdvMfmFC9s95imA16P5QwKR1ISAZ55IndwPtmuxTT+xIcA==
"@zondax/zemu@^0.22.1":
version "0.22.1"
resolved "https://registry.yarnpkg.com/@zondax/zemu/-/zemu-0.22.1.tgz#378ea193ccc4836ee5407b01028e9030f70a696e"
integrity sha512-WxX65myug9tyQuoXENO4XujDpTY+guQpc+mzN8rggmIwNqleNDe/HmBc5aeTqNyORBCSJkYpUVv3O9q2xcqzrg==
dependencies:
"@grpc/grpc-js" "^1.3.4"
"@grpc/proto-loader" "^0.6.4"