Skip to content

Commit 8c47e17

Browse files
committed
fix(renterd,hostd): contract showing empty renewed from to IDs
1 parent cb55080 commit 8c47e17

File tree

8 files changed

+31
-4
lines changed

8 files changed

+31
-4
lines changed

.changeset/fresh-actors-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'hostd': patch
3+
---
4+
5+
Contracts that have not been renewed from or two another contract no longer show the empty contract ID in the contract ID table cell. Closes https://github.com/SiaFoundation/hostd/issues/524

.changeset/fresh-mice-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'renterd': patch
3+
---
4+
5+
Contracts that have not been renewed from another contract no longer show the empty contract ID in the contract ID table cell.

apps/hostd-e2e/src/specs/contracts.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test, expect } from '@playwright/test'
22
import { navigateToContracts } from '../fixtures/navigate'
33
import { afterTest, beforeTest } from '../fixtures/beforeTest'
4-
import { getContractRowsAll } from '../fixtures/contracts'
4+
import { getContractRows, getContractRowsAll } from '../fixtures/contracts'
55

66
test.beforeEach(async ({ page }) => {
77
await beforeTest(page, {
@@ -27,3 +27,11 @@ test('contracts bulk integrity check', async ({ page }) => {
2727
page.getByText('Integrity checks started for 2 contracts')
2828
).toBeVisible()
2929
})
30+
31+
test('new contracts do not show a renewed from or to contract', async ({
32+
page,
33+
}) => {
34+
await navigateToContracts(page)
35+
await expect(getContractRows(page).getByTestId('renewedFrom')).toBeHidden()
36+
await expect(getContractRows(page).getByTestId('renewedTo')).toBeHidden()
37+
})

apps/hostd/contexts/contracts/columns.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const columns: ContractsTableColumn[] = (
7979
<ArrowUpLeft16 className="scale-75" />
8080
</Text>
8181
<ValueCopyable
82+
testId="renewedFrom"
8283
color="subtle"
8384
size="10"
8485
type="contract"
@@ -95,6 +96,7 @@ export const columns: ContractsTableColumn[] = (
9596
<ArrowDownRight16 className="scale-75" />
9697
</Text>
9798
<ValueCopyable
99+
testId="renewedTo"
98100
color="subtle"
99101
size="10"
100102
value={stripPrefix(renewedTo)}

apps/hostd/contexts/contracts/dataset.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ function getContractFields(c: Contract): ContractData {
9191
renewedFrom: c.renewedFrom,
9292
isRenewedFrom:
9393
c.renewedFrom !==
94-
'fcid:0000000000000000000000000000000000000000000000000000000000000000',
94+
'0000000000000000000000000000000000000000000000000000000000000000',
9595
isRenewedTo:
9696
c.renewedTo !==
97-
'fcid:0000000000000000000000000000000000000000000000000000000000000000',
97+
'0000000000000000000000000000000000000000000000000000000000000000',
9898
}
9999
}

apps/renterd-e2e/src/specs/contracts.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { navigateToContracts } from '../fixtures/navigate'
44
import { afterTest, beforeTest } from '../fixtures/beforeTest'
55
import {
66
getContractRowByIndex,
7+
getContractRows,
78
getContractRowsAll,
89
getContractsSummaryRow,
910
} from '../fixtures/contracts'
@@ -145,3 +146,8 @@ test('contracts bulk blocklist', async ({ page }) => {
145146
await dialog.getByLabel('view allowlist').click()
146147
await expect(dialog.getByText('The allowlist is empty')).toBeVisible()
147148
})
149+
150+
test('new contracts do not show a renewed from', async ({ page }) => {
151+
await navigateToContracts({ page })
152+
await expect(getContractRows(page).getByTestId('renewedFrom')).toBeHidden()
153+
})

apps/renterd/contexts/contracts/columns.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export const columns: ContractsTableColumn[] = [
7777
<ArrowUpLeft16 className="scale-75" />
7878
</Text>
7979
<ValueCopyable
80+
testId="renewedFrom"
8081
color="subtle"
8182
size="10"
8283
type="contract"

apps/renterd/contexts/contracts/dataset.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function useDataset() {
3535
response.data?.map((c) => {
3636
const isRenewed =
3737
c.renewedFrom !==
38-
'fcid:0000000000000000000000000000000000000000000000000000000000000000'
38+
'0000000000000000000000000000000000000000000000000000000000000000'
3939
const startTime = blockHeightToTime(currentHeight, c.startHeight)
4040
const endHeight = c.windowStart
4141
const endTime = blockHeightToTime(currentHeight, endHeight)

0 commit comments

Comments
 (0)