Updated contract data warning test

This commit is contained in:
Alexandre Paillier
2022-01-27 14:23:12 +01:00
parent cb373dad68
commit 5df3c48d92
6 changed files with 16 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 903 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 382 B

View File

@@ -2,34 +2,23 @@ import 'core-js/stable';
import 'regenerator-runtime/runtime';
import { expect } from "../jest";
import { TransportStatusError } from "@ledgerhq/errors";
import { waitForAppScreen, zemu } from './test.fixture';
import { waitForAppScreen, zemu, nano_models } from './test.fixture';
import Zemu from '@zondax/zemu';
test('[Nano S] Try to blind sign with setting disabled', zemu("nanos", async (sim, eth) => {
// we can't use eth.signTransaction because it detects that contract data is disabled and fails early
let transport = await sim.getTransport();
let buffer = Buffer.from("058000002c8000003c800000010000000000000000f849208506fc23ac008303dc3194f650c3d88d12db855b8bf7d11be6c55a4e07dcc980a4a1712d6800000000000000000000000000000000000000000000000000000000000acbc7018080", "hex");
let tx = transport.send(0xe0, 0x04, 0x00, 0x00, buffer);
nano_models.forEach(function(model) {
test('[Nano ' + model.letter + '] Try to blind sign with setting disabled', zemu(model, async (sim, eth) => {
// we can't use eth.signTransaction because it detects that contract data is disabled and fails early
let transport = await sim.getTransport();
let buffer = Buffer.from("058000002c8000003c800000010000000000000000f849208506fc23ac008303dc3194f650c3d88d12db855b8bf7d11be6c55a4e07dcc980a4a1712d6800000000000000000000000000000000000000000000000000000000000acbc7018080", "hex");
let tx = transport.send(0xe0, 0x04, 0x00, 0x00, buffer);
await expect(tx).rejects.toEqual(new TransportStatusError(0x6a80));
await expect(tx).rejects.toEqual(new TransportStatusError(0x6a80));
await Zemu.sleep(1000);
await waitForAppScreen(sim);
await sim.navigateAndCompareSnapshots('.', 'nanos_try_to_blind_sign_with_setting_disabled', [1, 0]);
}));
test.skip('[Nano X] Try to blind sign with setting disabled', zemu("nanox", async (sim, eth) => {
// disable blind signing
await sim.navigateAndCompareSnapshots('.', 'nanox_disable_blind_signing', [-2, 0, 0, 3, 0]);
// we can't use eth.signTransaction because it detects that contract data is disabled and fails early
let transport = await sim.getTransport();
let buffer = Buffer.from("058000002c8000003c800000010000000000000000f849208506fc23ac008303dc3194f650c3d88d12db855b8bf7d11be6c55a4e07dcc980a4a1712d6800000000000000000000000000000000000000000000000000000000000acbc7018080", "hex");
let tx = transport.send(0xe0, 0x04, 0x00, 0x00, buffer);
await expect(tx).rejects.toEqual(new TransportStatusError(0x6a80));
await Zemu.sleep(1000);
await waitForAppScreen(sim);
await sim.navigateAndCompareSnapshots('.', 'nanox_try_to_blind_sign_with_setting_disabled', [0]);
}));
await Zemu.sleep(1000);
await waitForAppScreen(sim);
let clicks;
if (model.letter === 'S') clicks = [1, 0];
else clicks = [0];
await sim.navigateAndCompareSnapshots('.', model.name + '_try_to_blind_sign_with_setting_disabled', clicks);
}));
});