Skip to content

Commit

Permalink
fixing ed25591 derivation and updating test
Browse files Browse the repository at this point in the history
  • Loading branch information
jleni committed May 28, 2020
1 parent 4daf17f commit b711fb7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ include $(BOLOS_SDK)/Makefile.defines
APPNAME = "Zcash"
APPVERSION_M=2
APPVERSION_N=0
APPVERSION_P=1
APPVERSION_P=2

APPPATH = "44'/133'"
APP_LOAD_PARAMS = --appFlags 0x200 --delete $(COMMON_LOAD_PARAMS) --path ${APPPATH} --path "44'/1'"
Expand Down
6 changes: 1 addition & 5 deletions app/src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,7 @@ void crypto_fillSaplingSeed(uint8_t *sk) {
0x80000000,
};

// FIXME: Zemu/Speculos still does not emulate the derivation correctly
// FIXME: so the seed that is generated is still fixed
// This is fine for Milestone 1

os_perso_derive_node_bip32_seed_key(HDW_ED25519_SLIP10, CX_CURVE_Ed25519,
os_perso_derive_node_bip32_seed_key(HDW_NORMAL, CX_CURVE_Ed25519,
path, HDPATH_LEN_DEFAULT,
sk,
NULL,
Expand Down
11 changes: 5 additions & 6 deletions tests_zemu/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ describe('Basic checks', function () {
console.log(addr)
expect(addr.return_code).toEqual(0x9000);

// FIXME: Ed25519 hd derivation in the emulator so the seed generated by the emulated SDK API is fixed for now
const expected_addr_raw = "cf99b502893ec7f2a2d275857abfea9848ca284e20530c410bfc133322a84d8326129c9dd39829bf65cd41";
const expected_addr = "zs1e7vm2q5f8mrl9gkjwkzh40l2npyv52zwypfscsgtlsfnxg4gfkpjvy5unhfes2dlvhx52ywndr";
const expected_addr_raw = "30fac80e962eb83353ff39d8f4fc255bc3464d0d842a257f849682f4903c11f16ab174aaabe27ff7f60269";
const expected_addr = "zs1xravsr5k96urx5ll88v0flp9t0p5vngdss4z2luyj6p0fypuz8ck4vt54247yllh7cpxjjcxsv";

const addr_raw = addr.address_raw.toString('hex');
expect(addr_raw).toEqual(expected_addr_raw);
Expand All @@ -116,16 +115,16 @@ describe('Basic checks', function () {
await sim.start(sim_options);
const app = new ZCashApp(sim.getTransport());

const addrRequest = app.showAddressAndPubKey("m/44'/133'/5'/0'/0'");
const addrRequest = app.showAddressAndPubKey("m/44'/133'/5'/0'/1");
await Zemu.sleep(1000);
await sim.clickBoth();

const addr = await addrRequest;
console.log(addr)
expect(addr.return_code).toEqual(0x9000);

const expected_addr_raw = "cf99b502893ec7f2a2d275857abfea9848ca284e20530c410bfc133322a84d8326129c9dd39829bf65cd41";
const expected_addr = "zs1e7vm2q5f8mrl9gkjwkzh40l2npyv52zwypfscsgtlsfnxg4gfkpjvy5unhfes2dlvhx52ywndr";
const expected_addr_raw = "30fac80e962eb83353ff39d8f4fc255bc3464d0d842a257f849682f4903c11f16ab174aaabe27ff7f60269";
const expected_addr = "zs1xravsr5k96urx5ll88v0flp9t0p5vngdss4z2luyj6p0fypuz8ck4vt54247yllh7cpxjjcxsv";

const addr_raw = addr.address_raw.toString('hex');
expect(addr_raw).toEqual(expected_addr_raw);
Expand Down

0 comments on commit b711fb7

Please sign in to comment.