Skip to content

Commit

Permalink
increase URL length to 128
Browse files Browse the repository at this point in the history
  • Loading branch information
janmazak committed Jan 9, 2024
1 parent 7da6898 commit a808584
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cardano-hw-interop-lib",
"version": "3.0.1",
"version": "3.0.2",
"files": [
"dist"
],
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 17 additions & 6 deletions test/integration/__fixtures__/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {
KeyHash,
RequiredSigner,
ProposalProcedure,
DNS_NAME_MAX_LENGTH,
URL_MAX_LENGTH,
} from '../../../src/types'
import {
fromBech32,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
21 changes: 16 additions & 5 deletions test/unit/certificates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
KeyHash,
CddlNonEmptyOrderedSet,
DRepType,
URL_MAX_LENGTH,
DNS_NAME_MAX_LENGTH,
} from '../../src/types'
import {
ipv4ToBuffer,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a808584

Please sign in to comment.