Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(renterd,hostd): contract showing empty renewed from to IDs #848

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fresh-actors-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hostd': patch
---

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
5 changes: 5 additions & 0 deletions .changeset/fresh-mice-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'renterd': patch
---

Contracts that have not been renewed from another contract no longer show the empty contract ID in the contract ID table cell.
10 changes: 9 additions & 1 deletion apps/hostd-e2e/src/specs/contracts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test'
import { navigateToContracts } from '../fixtures/navigate'
import { afterTest, beforeTest } from '../fixtures/beforeTest'
import { getContractRowsAll } from '../fixtures/contracts'
import { getContractRows, getContractRowsAll } from '../fixtures/contracts'

test.beforeEach(async ({ page }) => {
await beforeTest(page, {
Expand All @@ -27,3 +27,11 @@ test('contracts bulk integrity check', async ({ page }) => {
page.getByText('Integrity checks started for 2 contracts')
).toBeVisible()
})

test('new contracts do not show a renewed from or to contract', async ({
page,
}) => {
await navigateToContracts(page)
await expect(getContractRows(page).getByTestId('renewedFrom')).toBeHidden()
await expect(getContractRows(page).getByTestId('renewedTo')).toBeHidden()
})
2 changes: 2 additions & 0 deletions apps/hostd/contexts/contracts/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const columns: ContractsTableColumn[] = (
<ArrowUpLeft16 className="scale-75" />
</Text>
<ValueCopyable
testId="renewedFrom"
color="subtle"
size="10"
type="contract"
Expand All @@ -95,6 +96,7 @@ export const columns: ContractsTableColumn[] = (
<ArrowDownRight16 className="scale-75" />
</Text>
<ValueCopyable
testId="renewedTo"
color="subtle"
size="10"
value={stripPrefix(renewedTo)}
Expand Down
4 changes: 2 additions & 2 deletions apps/hostd/contexts/contracts/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ function getContractFields(c: Contract): ContractData {
renewedFrom: c.renewedFrom,
isRenewedFrom:
c.renewedFrom !==
'fcid:0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
isRenewedTo:
c.renewedTo !==
'fcid:0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
}
}
6 changes: 6 additions & 0 deletions apps/renterd-e2e/src/specs/contracts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { navigateToContracts } from '../fixtures/navigate'
import { afterTest, beforeTest } from '../fixtures/beforeTest'
import {
getContractRowByIndex,
getContractRows,
getContractRowsAll,
getContractsSummaryRow,
} from '../fixtures/contracts'
Expand Down Expand Up @@ -145,3 +146,8 @@ test('contracts bulk blocklist', async ({ page }) => {
await dialog.getByLabel('view allowlist').click()
await expect(dialog.getByText('The allowlist is empty')).toBeVisible()
})

test('new contracts do not show a renewed from', async ({ page }) => {
await navigateToContracts({ page })
await expect(getContractRows(page).getByTestId('renewedFrom')).toBeHidden()
})
1 change: 1 addition & 0 deletions apps/renterd/contexts/contracts/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export const columns: ContractsTableColumn[] = [
<ArrowUpLeft16 className="scale-75" />
</Text>
<ValueCopyable
testId="renewedFrom"
color="subtle"
size="10"
type="contract"
Expand Down
2 changes: 1 addition & 1 deletion apps/renterd/contexts/contracts/dataset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function useDataset() {
response.data?.map((c) => {
const isRenewed =
c.renewedFrom !==
'fcid:0000000000000000000000000000000000000000000000000000000000000000'
'0000000000000000000000000000000000000000000000000000000000000000'
const startTime = blockHeightToTime(currentHeight, c.startHeight)
const endHeight = c.windowStart
const endTime = blockHeightToTime(currentHeight, endHeight)
Expand Down
Loading