diff --git a/src/Ada.ts b/src/Ada.ts index 1c5f2454..aae568a4 100644 --- a/src/Ada.ts +++ b/src/Ada.ts @@ -180,6 +180,9 @@ export class Ada { ] this.transport.decorateAppAPIMethods(this, methods, scrambleKey) this._send = async (params: SendParams): Promise => { + if (params.data.length > 255) { + throw new Error('APDU too large, likely a bug') + } let response = await wrapConvertDeviceStatusError(this.transport.send)( CLA, params.ins, diff --git a/src/types/internal.ts b/src/types/internal.ts index aa381c2f..ba9a6c50 100644 --- a/src/types/internal.ts +++ b/src/types/internal.ts @@ -69,8 +69,8 @@ export const SCRIPT_DATA_HASH_LENGTH = 32 export const DATUM_HASH_LENGTH = 32 export const ANCHOR_HASH_LENGTH = 32 -export const MAX_URL_LENGTH = 64 -export const MAX_DNS_NAME_LENGTH = 64 +export const MAX_URL_LENGTH = 128 +export const MAX_DNS_NAME_LENGTH = 128 export type ParsedInput = { txHashHex: FixLenHexString diff --git a/test/integration/__fixtures__/signTx.ts b/test/integration/__fixtures__/signTx.ts index fce704de..1167d9fa 100644 --- a/test/integration/__fixtures__/signTx.ts +++ b/test/integration/__fixtures__/signTx.ts @@ -931,7 +931,7 @@ export const testsConwayWithCertificates: SignTxTestCase[] = [ keyPath: str_to_path("1852'/1815'/0'/4/0"), }, anchor: { - url: 'www.vacuumlabs.com', + url: 'x'.repeat(128), // max url length in anchor hashHex: '1afd028b504c3668102b129b37a86c09a2872f76741dc7a68e2149c8deadbeef', }, @@ -951,20 +951,20 @@ export const testsConwayWithCertificates: SignTxTestCase[] = [ signingMode: TransactionSigningMode.ORDINARY_TRANSACTION, additionalWitnessPaths: [], txBody: - 'a500818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182582b82d818582183581c9e1c71de652ec8b85fec296f0685ca3988781c94a2e1a5d89d92f45fa0001a0d0c25611a002dd2e802182a030a0482830f8200581ccf737588be6e9edeb737eb2e6d06e5cbd292bd8ee32e410c0bba1ba682727777772e76616375756d6c6162732e636f6d58201afd028b504c3668102b129b37a86c09a2872f76741dc7a68e2149c8deadbeef830f8200581ccf737588be6e9edeb737eb2e6d06e5cbd292bd8ee32e410c0bba1ba6f6', + 'a500818258203b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b700018182582b82d818582183581c9e1c71de652ec8b85fec296f0685ca3988781c94a2e1a5d89d92f45fa0001a0d0c25611a002dd2e802182a030a0482830f8200581ccf737588be6e9edeb737eb2e6d06e5cbd292bd8ee32e410c0bba1ba6827880787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787858201afd028b504c3668102b129b37a86c09a2872f76741dc7a68e2149c8deadbeef830f8200581ccf737588be6e9edeb737eb2e6d06e5cbd292bd8ee32e410c0bba1ba6f6', expectedResult: { txHashHex: - '1817433dfe1082c43c67375977e08b6cf7654161b9f8227bdae79f962cd5d391', + '5b6d2cc6f1401d783dd5012200337aa2df4407e28267c4ea7d39914adacde25d', witnesses: [ { path: str_to_path("1852'/1815'/0'/0/0"), witnessSignatureHex: - '84ee1d069b3b851330a2c1bd4c2423500551400c53182a36792f1559148409bdda2ccaf0bdfc9a7885042092b9e316b12d21e3912cc47579f190df8a80b28c04', + '82f826cea558d08e833e3657f6afaba0175813a7de5bda7c0e075f4b08a2833a6e61f7a2587d9b88e919b4b4aa465cc689a6a611c8cf96fe1249f47ffd22ba05', }, { path: str_to_path("1852'/1815'/0'/4/0"), witnessSignatureHex: - '6d2a387455c55590c3ea9f5432dbb55ecdded67db163d53ba5ac3ad4ad30a4a715990866440ba164ba790bf24c86192d4d68c86382a299cd5de56f8293fe540a', + '6eff66993a624cb218bf84dbdd3481212b4586bf1d8ef0a9c6e5bf32c977afbb1e09a1c0f3810f6828b17f9d4f3acee7d59af098e98d46d9a95d5d60fd9a8f07', }, ], auxiliaryDataSupplement: null, diff --git a/test/integration/__fixtures__/signTxPoolRegistrationRejects.ts b/test/integration/__fixtures__/signTxPoolRegistrationRejects.ts index b152ae89..188ef726 100644 --- a/test/integration/__fixtures__/signTxPoolRegistrationRejects.ts +++ b/test/integration/__fixtures__/signTxPoolRegistrationRejects.ts @@ -180,7 +180,7 @@ export const invalidPoolMetadataTestCases: TestCaseRejectShelley[] = [ ...defaultPoolRegistration, metadata: { metadataUrl: - 'https://www.vacuumlabs.com/aaaaaaaaaaaaaaaaaaaaaaaasampleUrl.json', + 'a'.repeat(129), metadataHashHex: 'cdb714fd722c24aeb10c93dbb0ff03bd4783441cd5ba2a8b6f373390520535bb', },