diff --git a/.changeset/calm-coins-shave.md b/.changeset/calm-coins-shave.md new file mode 100644 index 000000000..0f8327e42 --- /dev/null +++ b/.changeset/calm-coins-shave.md @@ -0,0 +1,5 @@ +--- +'renterd': minor +--- + +The configuration now has zen-specific suggested/default values for number of contract hosts and shard values. diff --git a/.changeset/friendly-dryers-type.md b/.changeset/friendly-dryers-type.md deleted file mode 100644 index fc305893d..000000000 --- a/.changeset/friendly-dryers-type.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'renterd': minor ---- - -Uploading files is now allowed even before enough contracts have formed - if the upload fails the user will see an error. diff --git a/.changeset/great-games-prove.md b/.changeset/great-games-prove.md new file mode 100644 index 000000000..a69b7b7eb --- /dev/null +++ b/.changeset/great-games-prove.md @@ -0,0 +1,5 @@ +--- +'hostd': minor +--- + +The revenue graph is now a bar stack, much more clearly showing earned vs potential revenue. diff --git a/.changeset/healthy-laws-lick.md b/.changeset/healthy-laws-lick.md new file mode 100644 index 000000000..9c0ba762e --- /dev/null +++ b/.changeset/healthy-laws-lick.md @@ -0,0 +1,5 @@ +--- +'hostd': minor +--- + +The metrics graphs now show a y-axis. diff --git a/.changeset/ninety-pots-deny.md b/.changeset/ninety-pots-deny.md new file mode 100644 index 000000000..55598cdb6 --- /dev/null +++ b/.changeset/ninety-pots-deny.md @@ -0,0 +1,5 @@ +--- +'@siafoundation/design-system': minor +--- + +The ChartXY API has been refactored. diff --git a/.changeset/sweet-actors-pretend.md b/.changeset/sweet-actors-pretend.md new file mode 100644 index 000000000..5cd392d7d --- /dev/null +++ b/.changeset/sweet-actors-pretend.md @@ -0,0 +1,5 @@ +--- +'renterd': minor +--- + +The contract list now updates after a contract is deleted. diff --git a/README.md b/README.md index b3d551626..3532c17a5 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ The Sia web libraries provide developers with convenient TypeScript SDKs for usi - [@siafoundation/sia-nodejs](libs/sia-nodejs) - Sia NodeJS client for controlling a v1 `siad`. - [@siafoundation/design-system](libs/design-system) - React-based design system used across Sia apps and websites. - [@siafoundation/data-sources](libs/data-sources) - Data sources used for stats on the website. +- [@siafoundation/fonts](libs/fonts) - Next font configuration for use across apps. - [@siafoundation/units](libs/units) - Methods and types for converting and displaying units. ## Internal diff --git a/apps/explorer/app/layout.tsx b/apps/explorer/app/layout.tsx index 8a60de017..aeec6a159 100644 --- a/apps/explorer/app/layout.tsx +++ b/apps/explorer/app/layout.tsx @@ -2,27 +2,8 @@ import { Layout } from '../components/Layout' import '../config/style.css' import { NextAppSsrAppRouter } from '@siafoundation/design-system' import { appLink } from '../config' -import { IBM_Plex_Sans, IBM_Plex_Mono } from '@next/font/google' -import { cx } from 'class-variance-authority' import Script from 'next/script' - -const sans = IBM_Plex_Sans({ - weight: ['100', '200', '300', '400', '500', '600', '700'], - style: ['normal', 'italic'], - subsets: ['latin'], - variable: '--font-sans', - display: 'swap', - preload: true, -}) - -const mono = IBM_Plex_Mono({ - weight: ['100', '200', '300', '400', '500', '600', '700'], - style: ['normal', 'italic'], - subsets: ['latin'], - variable: '--font-mono', - display: 'swap', - preload: true, -}) +import { rootFontClasses } from '@siafoundation/fonts' export const metadata = { title: 'Explorer', @@ -40,11 +21,7 @@ export default function RootLayout({ children: React.ReactNode }) { return ( - +
{advancedDefaultAutopilot.autopilotContractSet}
.
+ {advancedDefaults?.autopilotContractSet}
.
>
),
hidden: !isAutopilotEnabled || !showAdvanced,
@@ -207,9 +204,9 @@ export function getFields({
same IP subnet. The subnets used are /16 for IPv4, and /64 for IPv6.
>
),
- suggestion: advancedDefaultAutopilot.allowRedundantIPs,
+ suggestion: advancedDefaults?.allowRedundantIPs,
suggestionTip: `Defaults to ${
- advancedDefaultAutopilot.allowRedundantIPs ? 'on' : 'off'
+ advancedDefaults?.allowRedundantIPs ? 'on' : 'off'
}.`,
hidden: !isAutopilotEnabled || !showAdvanced,
validation: {},
@@ -225,12 +222,12 @@ export function getFields({
>
),
units: 'hours',
- suggestion: advancedDefaultAutopilot.maxDowntimeHours,
- suggestionTip: `Defaults to ${advancedDefaultAutopilot.maxDowntimeHours
+ suggestion: advancedDefaults?.maxDowntimeHours,
+ suggestionTip: `Defaults to ${advancedDefaults?.maxDowntimeHours
.toNumber()
.toLocaleString()} which is ${toFixedMax(
new BigNumber(
- hoursInDays(advancedDefaultAutopilot.maxDowntimeHours.toNumber())
+ hoursInDays(advancedDefaults?.maxDowntimeHours.toNumber())
),
1
)} days.`,
@@ -254,8 +251,8 @@ export function getFields({
),
units: 'scans',
decimalsLimit: 0,
- suggestion: advancedDefaultAutopilot.minRecentScanFailures,
- suggestionTip: `Defaults to ${advancedDefaultAutopilot.minRecentScanFailures.toNumber()}.`,
+ suggestion: advancedDefaults?.minRecentScanFailures,
+ suggestionTip: `Defaults to ${advancedDefaults?.minRecentScanFailures.toNumber()}.`,
hidden: !isAutopilotEnabled || !showAdvanced,
validation:
isAutopilotEnabled && showAdvanced
@@ -274,7 +271,7 @@ export function getFields({
<>The threshold after which autopilot will defrag wallet outputs.>
),
units: 'outputs',
- suggestion: advancedDefaultAutopilot.defragThreshold,
+ suggestion: advancedDefaults?.defragThreshold,
suggestionTip: 'Defaults to 1,000.',
hidden: !isAutopilotEnabled || !showAdvanced,
validation:
@@ -290,8 +287,8 @@ export function getFields({
category: 'contractset',
type: 'text',
title: 'Default contract set',
- placeholder: advancedDefaultContractSet.defaultContractSet,
- suggestion: advancedDefaultContractSet.defaultContractSet,
+ placeholder: advancedDefaults?.defaultContractSet,
+ suggestion: advancedDefaults?.defaultContractSet,
suggestionTip: (
<>
Autopilot users will typically want to keep this the same as the
@@ -487,7 +484,7 @@ export function getFields({
),
units: 'blocks',
decimalsLimit: 0,
- suggestion: advancedDefaultGouging.hostBlockHeightLeeway,
+ suggestion: advancedDefaults?.hostBlockHeightLeeway,
suggestionTip: 'The recommended value is 6 blocks.',
hidden: !showAdvanced,
validation: showAdvanced
@@ -600,6 +597,8 @@ export function getFields({
category: 'redundancy',
title: 'Min shards',
description: <>The min amount of shards needed to reconstruct a slab.>,
+ suggestion: advancedDefaults?.minShards,
+ suggestionTip: `Typically ${advancedDefaults?.minShards} shards.`,
units: 'shards',
hidden: !showAdvanced,
validation: showAdvanced
@@ -619,6 +618,8 @@ export function getFields({
category: 'redundancy',
title: 'Total shards',
description: <>The total amount of shards for each slab.>,
+ suggestion: advancedDefaults?.totalShards,
+ suggestionTip: `Typically ${advancedDefaults?.totalShards} shards.`,
units: 'shards',
hidden: !showAdvanced,
validation: showAdvanced
diff --git a/apps/renterd/contexts/config/index.tsx b/apps/renterd/contexts/config/index.tsx
index 36ae3862d..359560d6c 100644
--- a/apps/renterd/contexts/config/index.tsx
+++ b/apps/renterd/contexts/config/index.tsx
@@ -20,10 +20,11 @@ import {
UploadPackingSettings,
useSettingUpdate,
useAutopilotTrigger,
+ useBusState,
} from '@siafoundation/react-renterd'
import { toSiacoins } from '@siafoundation/sia-js'
import { getFields } from './fields'
-import { SettingsData, defaultValues } from './types'
+import { SettingsData, defaultValues, getAdvancedDefaults } from './types'
import {
getRedundancyMultiplier,
getRedundancyMultiplierIfIncluded,
@@ -282,9 +283,14 @@ export function useConfigMain() {
[minShards, totalShards]
)
+ const renterdState = useBusState()
const fields = useMemo(() => {
+ const advancedDefaults = renterdState.data
+ ? getAdvancedDefaults(renterdState.data.network)
+ : undefined
if (averages.data) {
return getFields({
+ advancedDefaults,
isAutopilotEnabled,
showAdvanced,
redundancyMultiplier,
@@ -315,6 +321,7 @@ export function useConfigMain() {
})
}
return getFields({
+ advancedDefaults,
isAutopilotEnabled,
showAdvanced,
redundancyMultiplier,
@@ -322,6 +329,7 @@ export function useConfigMain() {
includeRedundancyMaxUploadPrice,
})
}, [
+ renterdState.data,
isAutopilotEnabled,
showAdvanced,
averages.data,
@@ -394,7 +402,7 @@ export function useConfigMain() {
const mutate = useMutate()
const onValid = useCallback(
async (values: typeof defaultValues) => {
- if (!gouging.data || !redundancy.data) {
+ if (!gouging.data || !redundancy.data || !renterdState.data) {
return
}
try {
@@ -411,7 +419,11 @@ export function useConfigMain() {
const firstTimeSettingConfig = isAutopilotEnabled && !autopilot.data
const autopilotResponse = isAutopilotEnabled
? await autopilotUpdate.put({
- payload: transformUpAutopilot(finalValues, autopilot.data),
+ payload: transformUpAutopilot(
+ renterdState.data.network,
+ finalValues,
+ autopilot.data
+ ),
})
: undefined
@@ -511,6 +523,7 @@ export function useConfigMain() {
}
},
[
+ renterdState.data,
estimatedSpendingPerMonth,
showAdvanced,
isAutopilotEnabled,
diff --git a/apps/renterd/contexts/config/transform.spec.ts b/apps/renterd/contexts/config/transform.spec.ts
index 9271c58ba..122dd9c46 100644
--- a/apps/renterd/contexts/config/transform.spec.ts
+++ b/apps/renterd/contexts/config/transform.spec.ts
@@ -185,6 +185,7 @@ describe('tansforms', () => {
it('up autopilot', () => {
expect(
transformUpAutopilot(
+ 'Mainnet',
{
autopilotContractSet: 'autopilot',
allowanceMonth: new BigNumber('6006'),
@@ -223,10 +224,10 @@ describe('tansforms', () => {
},
})
})
-
it('up autopilot accepts unknown values', () => {
expect(
transformUpAutopilot(
+ 'Mainnet',
{
autopilotContractSet: 'autopilot',
allowanceMonth: new BigNumber('6006'),
@@ -282,6 +283,55 @@ describe('tansforms', () => {
},
})
})
+ it('uses testnet defaults', () => {
+ expect(
+ transformUpAutopilot(
+ 'Zen Testnet',
+ {
+ autopilotContractSet: 'autopilot',
+ allowanceMonth: new BigNumber('6006'),
+ amountHosts: undefined,
+ periodWeeks: new BigNumber('6'),
+ renewWindowWeeks: new BigNumber('2.2301587301587302'),
+ downloadTBMonth: new BigNumber('0.785365448411428571428571428571'),
+ uploadTBMonth: new BigNumber('0.785714285714285714285714285714'),
+ storageTB: new BigNumber('1'),
+ allowRedundantIPs: false,
+ maxDowntimeHours: new BigNumber('1440'),
+ minRecentScanFailures: new BigNumber('10'),
+ defragThreshold: new BigNumber('1000'),
+ },
+ {
+ wallet: {},
+ contracts: {
+ period: 7777,
+ },
+ hosts: {},
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ } as any
+ )
+ ).toEqual({
+ wallet: {
+ defragThreshold: 1000,
+ },
+ hosts: {
+ allowRedundantIPs: false,
+ maxDowntimeHours: 1440,
+ minRecentScanFailures: 10,
+ scoreOverrides: null,
+ },
+ contracts: {
+ set: 'autopilot',
+ amount: 12,
+ allowance: '8408400000000000000000000000',
+ period: 6048,
+ renewWindow: 2248,
+ download: 1099511627776,
+ upload: 1100000000000,
+ storage: 1000000000000,
+ },
+ })
+ })
it('up contractset', () => {
expect(
@@ -462,7 +512,7 @@ describe('tansforms', () => {
expect(settings.downloadTBMonth).toEqual(new BigNumber('92.72'))
// a little different due to rounding
expect(
- transformUpAutopilot(settings, autopilot).contracts.download
+ transformUpAutopilot('Mainnet', settings, autopilot).contracts.download
).toEqual(91088814814815)
settings = transformDown(
@@ -483,7 +533,7 @@ describe('tansforms', () => {
expect(settings.downloadTBMonth).toEqual(new BigNumber('92.72'))
// using the rounded value results in same value
expect(
- transformUpAutopilot(settings, autopilot).contracts.download
+ transformUpAutopilot('Mainnet', settings, autopilot).contracts.download
).toEqual(91088814814815)
})
})
diff --git a/apps/renterd/contexts/config/transform.ts b/apps/renterd/contexts/config/transform.ts
index 4aeed90be..446fa3d40 100644
--- a/apps/renterd/contexts/config/transform.ts
+++ b/apps/renterd/contexts/config/transform.ts
@@ -23,7 +23,7 @@ import {
AutopilotData,
scDecimalPlaces,
SettingsData,
- advancedDefaultAutopilot,
+ getAdvancedDefaultAutopilot,
ConfigAppData,
ContractSetData,
defaultConfigApp,
@@ -46,6 +46,7 @@ const filterUndefinedKeys = (obj: Record