From a80858466c8853f3b687e170755543348a15b838 Mon Sep 17 00:00:00 2001 From: Jan Mazak Date: Tue, 9 Jan 2024 16:38:30 +0100 Subject: [PATCH] increase URL length to 128 --- CHANGELOG.md | 3 ++- package.json | 2 +- src/types.ts | 4 ++-- test/integration/__fixtures__/transactions.ts | 23 ++++++++++++++----- test/unit/certificates.test.ts | 21 +++++++++++++---- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e136fe8..3e4f2f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [3.0.0] - [December 21th 2023] +## [3.0.2] - [December 21th 2023] ### Added @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed - credential types are generalized +- URL and DNS name max length changed to 128 ### Fixed diff --git a/package.json b/package.json index d51c844..d9df305 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cardano-hw-interop-lib", - "version": "3.0.1", + "version": "3.0.2", "files": [ "dist" ], diff --git a/src/types.ts b/src/types.ts index 9761727..6570495 100644 --- a/src/types.ts +++ b/src/types.ts @@ -43,8 +43,8 @@ export const IPV4_LENGTH = 4 export const IPV6_LENGTH = 16 export const ASSET_NAME_MAX_LENGTH = 32 -export const URL_MAX_LENGTH = 64 -export const DNS_NAME_MAX_LENGTH = 64 +export const URL_MAX_LENGTH = 128 +export const DNS_NAME_MAX_LENGTH = 128 export const PORT_MAX_SIZE = 65535 diff --git a/test/integration/__fixtures__/transactions.ts b/test/integration/__fixtures__/transactions.ts index fda5724..3eed902 100644 --- a/test/integration/__fixtures__/transactions.ts +++ b/test/integration/__fixtures__/transactions.ts @@ -21,6 +21,8 @@ import { KeyHash, RequiredSigner, ProposalProcedure, + DNS_NAME_MAX_LENGTH, + URL_MAX_LENGTH, } from '../../../src/types' import { fromBech32, @@ -474,11 +476,17 @@ export const ValidTransactionBodyTestCases: ValidTransactionBodyTestCase[] = [ { type: RelayType.SINGLE_HOST_NAME, port: null, - dnsName: toMaxLenString('address.vacuumlabs.com', 64), + dnsName: toMaxLenString( + 'address.vacuumlabs.com', + DNS_NAME_MAX_LENGTH, + ), }, { type: RelayType.MULTI_HOST_NAME, - dnsName: toMaxLenString('another.address.vacuumlabs.com', 64), + dnsName: toMaxLenString( + 'another.address.vacuumlabs.com', + DNS_NAME_MAX_LENGTH, + ), }, { type: RelayType.SINGLE_HOST_ADDRESS, @@ -488,7 +496,10 @@ export const ValidTransactionBodyTestCases: ValidTransactionBodyTestCase[] = [ }, ], poolMetadata: { - url: toMaxLenString('https://pool-metadata.vacuumlabs.com', 64), + url: toMaxLenString( + 'https://pool-metadata.vacuumlabs.com', + URL_MAX_LENGTH, + ), metadataHash: toFixLenBuffer( 'E318D62E3D5CC3CC23CA1123438E439D7AAC6C6C423320F670D159726AC9D11F', 32, @@ -883,7 +894,7 @@ export const ValidTransactionBodyTestCases: ValidTransactionBodyTestCase[] = [ ], ], anchor: { - url: toMaxLenString('https://shorturl.at/xMS15', 64), + url: toMaxLenString('https://shorturl.at/xMS15', URL_MAX_LENGTH), dataHash: toFixLenBuffer( '6f890de0c6e418e6526e2b1aa821850cb87aee94a6d77dc2a2e440116abc8e09', 32, @@ -972,7 +983,7 @@ export const ValidTransactionBodyTestCases: ValidTransactionBodyTestCase[] = [ }, deposit: toUint(2000000), anchor: { - url: toMaxLenString('https://google.com', 64), + url: toMaxLenString('https://google.com', URL_MAX_LENGTH), dataHash: toFixLenBuffer( '339ec66289039dbf9fa803be62b2b4f294b51adb719d7feef3f35619b3aee73e', 32, @@ -989,7 +1000,7 @@ export const ValidTransactionBodyTestCases: ValidTransactionBodyTestCase[] = [ ), }, anchor: { - url: toMaxLenString('https://yahoo.com', 64), + url: toMaxLenString('https://yahoo.com', URL_MAX_LENGTH), dataHash: toFixLenBuffer( 'a248769f4e4f23a2984548e7ee53cbe00c0596b54206bdac1023d485138a3e07', 32, diff --git a/test/unit/certificates.test.ts b/test/unit/certificates.test.ts index 2de4850..aac4259 100644 --- a/test/unit/certificates.test.ts +++ b/test/unit/certificates.test.ts @@ -10,6 +10,8 @@ import { KeyHash, CddlNonEmptyOrderedSet, DRepType, + URL_MAX_LENGTH, + DNS_NAME_MAX_LENGTH, } from '../../src/types' import { ipv4ToBuffer, @@ -183,11 +185,17 @@ const ValidCertificatesTestCases: ValidParseTestCase< { type: RelayType.SINGLE_HOST_NAME, port: null, - dnsName: toMaxLenString('address.vacuumlabs.com', 64), + dnsName: toMaxLenString( + 'address.vacuumlabs.com', + URL_MAX_LENGTH, + ), }, { type: RelayType.MULTI_HOST_NAME, - dnsName: toMaxLenString('another.address.vacuumlabs.com', 64), + dnsName: toMaxLenString( + 'another.address.vacuumlabs.com', + DNS_NAME_MAX_LENGTH, + ), }, { type: RelayType.SINGLE_HOST_ADDRESS, @@ -197,7 +205,10 @@ const ValidCertificatesTestCases: ValidParseTestCase< }, ], poolMetadata: { - url: toMaxLenString('https://pool-metadata.vacuumlabs.com', 64), + url: toMaxLenString( + 'https://pool-metadata.vacuumlabs.com', + URL_MAX_LENGTH, + ), metadataHash: toFixLenBuffer( 'E318D62E3D5CC3CC23CA1123438E439D7AAC6C6C423320F670D159726AC9D11F', 32, @@ -233,7 +244,7 @@ const ValidCertificatesTestCases: ValidParseTestCase< }, deposit: toUint(0), anchor: { - url: toMaxLenString('address.vacuumlabs.com', 64), + url: toMaxLenString('address.vacuumlabs.com', URL_MAX_LENGTH), dataHash: toFixLenBuffer( 'E318D62E3D5CC3CC23CA1123438E439D7AAC6C6C423320F670D159726AC9D11F', 32, @@ -261,7 +272,7 @@ const ValidCertificatesTestCases: ValidParseTestCase< ), }, anchor: { - url: toMaxLenString('address.vacuumlabs.com', 64), + url: toMaxLenString('address.vacuumlabs.com', URL_MAX_LENGTH), dataHash: toFixLenBuffer( 'E318D62E3D5CC3CC23CA1123438E439D7AAC6C6C423320F670D159726AC9D11F', 32,