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

Plot 2.0 #1772

Merged
merged 52 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
adbe9ba
Adding new bladebit options
ChiaMineJP Apr 19, 2023
6d67713
Fixed incorrect bladebit option name
ChiaMineJP Apr 22, 2023
b442f43
Implemented harvester latency graph
ChiaMineJP Apr 25, 2023
a03e25d
Updated graph feel
ChiaMineJP Apr 26, 2023
71f58b0
Made Card component more customizable
ChiaMineJP Apr 27, 2023
4d3cade
Checkpoint
ChiaMineJP May 3, 2023
cb6a559
Checkpoint
ChiaMineJP May 12, 2023
e75713d
Checkpoint
ChiaMineJP May 14, 2023
dee0e94
Checkpoint
ChiaMineJP May 15, 2023
966da99
Removed redundant APIs
ChiaMineJP May 20, 2023
19d0ffd
Updated for bladebit3 support
ChiaMineJP May 21, 2023
f831b66
Implemented harvester setting page
ChiaMineJP May 22, 2023
c312d6d
Removed donut chart when it seems useless
ChiaMineJP May 22, 2023
420aca0
Added several harvester settings
ChiaMineJP May 24, 2023
2514506
Fixed an issue where harvester restart button didn't work
ChiaMineJP May 24, 2023
8314ea5
Popup message after restarting harvester completes
ChiaMineJP May 25, 2023
8376587
Trying to fix totalFarmSize bug
ChiaMineJP May 25, 2023
9c105d0
Introduced `GiBe`, `TiBe`, ... for effective netspace.
ChiaMineJP May 25, 2023
b231bc7
Updated design
ChiaMineJP May 26, 2023
580a470
Update harvester compression earnings label
ChiaMineJP May 27, 2023
dc3b2d5
Updated sidebar menus
ChiaMineJP May 27, 2023
9317a55
Now `totalEffectivePlotSize` is taken from `getHarvestersSummary` API
ChiaMineJP May 28, 2023
b33a351
Updated farm icon
ChiaMineJP May 28, 2023
bfad0a6
Do not show harvester summary when the harvester has no plots to harvest
ChiaMineJP May 28, 2023
ab9cc18
`BigNumer` -> `BigNumber`
ChiaMineJP Jun 4, 2023
58273ee
Removed unused file
ChiaMineJP Jun 4, 2023
2f5ca46
Added `averageBlockTime` to `getBlockchainState` FullNode RPC API res…
ChiaMineJP Jun 4, 2023
3d80d8f
Updated Farmer RPC APIs
ChiaMineJP Jun 4, 2023
04f0364
Implemented new farm page
ChiaMineJP Jun 4, 2023
2dbdf3b
Deleted unused farmer components
ChiaMineJP Jun 4, 2023
1451e0f
Fixed an issue where earned space did not show correct value
ChiaMineJP Jun 5, 2023
31496b4
Renamed `farm.svg` -> `Farm.svg`
ChiaMineJP Jun 5, 2023
8fee87c
Fixed a minor issue
ChiaMineJP Jun 7, 2023
5059c8a
Modified farmer health label
ChiaMineJP Jun 8, 2023
458fc7a
Implemented plot filter status badge
ChiaMineJP Jun 11, 2023
7ca5371
Fixed an issue where plot filter status could not be calculated after…
ChiaMineJP Jun 12, 2023
d571508
Added tooltips to pool health items
ChiaMineJP Jun 12, 2023
7503c33
Upgraded binomial cdf and implemented reset button
ChiaMineJP Jun 15, 2023
573271e
Implemented partial stats reset button
ChiaMineJP Jun 18, 2023
212a734
Updated texts
ChiaMineJP Jun 18, 2023
59439ab
Renamed endpoint names
ChiaMineJP Jun 18, 2023
24264e2
Disable restart harvester button if no config changes are confirmed
ChiaMineJP Jun 18, 2023
ac2c94c
Updated package-lock.json
ChiaMineJP Jul 6, 2023
02f8139
Fixed an issue where bladebit plotter was not appeared as an availabl…
ChiaMineJP Jul 8, 2023
d3d8356
Reverted some plotNFT changes
ChiaMineJP Jul 9, 2023
515b138
WIP: Implementing new add plot page
ChiaMineJP Jul 9, 2023
9a415d5
Minor updates
ChiaMineJP Jul 10, 2023
7222214
Correct Farm.svg attributes
wallentx Jul 12, 2023
3c01239
Renamed decompresser -> decompressor
ChiaMineJP Jul 13, 2023
ae363c6
Merge pull request #1895 from Chia-Network/wallentx/farmsvg
ChiaMineJP Jul 13, 2023
7e86157
Implemented farmer/pool pk auto popolation
ChiaMineJP Jul 13, 2023
7bf5640
Renamed `get_keys_for_plot` -> `get_keys_for_plotting`
ChiaMineJP Jul 18, 2023
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
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function useGetTotalHarvestersSummaryQuery() {
let plots = new BigNumber(0);
let plotsProcessed = new BigNumber(0);
let totalPlotSize = new BigNumber(0);
let totalEffectivePlotSize = new BigNumber(0);
let plotFilesTotal = new BigNumber(0);
let initialized = !!data?.length;
let initializedHarvesters = 0;
Expand All @@ -22,6 +23,7 @@ export default function useGetTotalHarvestersSummaryQuery() {
failedToOpenFilenames = failedToOpenFilenames.plus(harvester.failedToOpenFilenames);
noKeyFilenames = noKeyFilenames.plus(harvester.noKeyFilenames);
totalPlotSize = totalPlotSize.plus(harvester.totalPlotSize);
totalEffectivePlotSize = totalEffectivePlotSize.plus(harvester.totalEffectivePlotSize);
plots = plots.plus(harvester.plots);

if (harvester.syncing) {
Expand All @@ -45,6 +47,7 @@ export default function useGetTotalHarvestersSummaryQuery() {
plots,
plotsProcessed,
totalPlotSize,
totalEffectivePlotSize,
plotFilesTotal,
initialized,
initializedHarvesters,
Expand All @@ -63,6 +66,7 @@ export default function useGetTotalHarvestersSummaryQuery() {
harvesters: data?.length ?? 0,
plotsProcessed: memoized.plotsProcessed,
totalPlotSize: memoized.totalPlotSize,
totalEffectivePlotSize: memoized.totalEffectivePlotSize,
plotFilesTotal: memoized.plotFilesTotal,
initializedHarvesters: memoized.initializedHarvesters,
};
Expand Down
4 changes: 4 additions & 0 deletions packages/api-react/src/hooks/useService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export default function useService(
}).unwrap();

refetch();
} catch (e) {
console.error(e);
} finally {
setIsStarting(false);
}
Expand All @@ -99,6 +101,8 @@ export default function useService(
}).unwrap();

refetch();
} catch (e) {
console.error(e);
} finally {
setIsStopping(false);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/api-react/src/services/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export const clientApi = apiWithTag.injectEndpoints({
}),

clientStartService: mutation(build, Client, 'startService'),

clientStopService: mutation(build, Client, 'stopService'),
}),
});

export const { useCloseMutation, useGetStateQuery, useClientStartServiceMutation } = clientApi;
export const { useCloseMutation, useGetStateQuery, useClientStartServiceMutation, useClientStopServiceMutation } =
clientApi;
65 changes: 42 additions & 23 deletions packages/api-react/src/services/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const daemonApi = apiWithTag.injectEndpoints({
installed,
canInstall,
bladebitMemoryWarning,
cudaSupport,
} = plotters[plotterName] as PlotterApi;

if (!plotterName.startsWith('bladebit')) {
Expand All @@ -123,24 +124,11 @@ export const daemonApi = apiWithTag.injectEndpoints({

// if (plotterName.startsWith('bladebit'))
const majorVersion = typeof version === 'string' ? +version.split('.')[0] : 0;
if (majorVersion > 1) {
const bbDisk = PlotterName.BLADEBIT_DISK;
availablePlotters[bbDisk] = {
displayName,
version: `${version} (Disk plot)`,
options: optionsForPlotter(bbDisk),
defaults: defaultsForPlotter(bbDisk),
installInfo: {
installed,
canInstall,
bladebitMemoryWarning,
},
};

if (majorVersion <= 1) {
const bbRam = PlotterName.BLADEBIT_RAM;
availablePlotters[bbRam] = {
displayName,
version: `${version} (RAM plot)`,
version: typeof version === 'string' ? `${version} (RAM plot)` : version,
options: optionsForPlotter(bbRam),
defaults: defaultsForPlotter(bbRam),
installInfo: {
Expand All @@ -149,17 +137,45 @@ export const daemonApi = apiWithTag.injectEndpoints({
bladebitMemoryWarning,
},
};
} else {
const bbRam = PlotterName.BLADEBIT_RAM;
availablePlotters[bbRam] = {
return;
}
const bbDisk = PlotterName.BLADEBIT_DISK;
availablePlotters[bbDisk] = {
displayName,
version: `${version} (Disk plot)`,
options: optionsForPlotter(bbDisk),
defaults: defaultsForPlotter(bbDisk),
installInfo: {
installed,
canInstall,
bladebitMemoryWarning,
},
};

const bbRam = PlotterName.BLADEBIT_RAM;
availablePlotters[bbRam] = {
displayName,
version: `${version} (RAM plot)`,
options: optionsForPlotter(bbRam),
defaults: defaultsForPlotter(bbRam),
installInfo: {
installed,
canInstall,
bladebitMemoryWarning,
},
};
if (cudaSupport) {
const bbCuda = PlotterName.BLADEBIT_CUDA;
availablePlotters[bbCuda] = {
displayName,
version: `${version} (RAM plot)`,
options: optionsForPlotter(bbRam),
defaults: defaultsForPlotter(bbRam),
version: `${version} (CUDA plot)`,
options: optionsForPlotter(bbCuda),
defaults: defaultsForPlotter(bbCuda),
installInfo: {
installed: false,
canInstall: false,
installed,
canInstall,
bladebitMemoryWarning,
cudaSupport,
},
};
}
Expand All @@ -177,6 +193,8 @@ export const daemonApi = apiWithTag.injectEndpoints({
transformResponse: (response) => response.version,
providesTags: [{ type: 'RunningServices', id: 'LIST' }],
}),

getKeysForPlotting: query(build, Daemon, 'getKeysForPlotting'),
}),
});

Expand All @@ -192,6 +210,7 @@ export const {
useMigrateKeyringMutation,
useUnlockKeyringMutation,
useGetVersionQuery,
useGetKeysForPlottingQuery,

useGetPlottersQuery,
useStopPlottingMutation,
Expand Down
74 changes: 69 additions & 5 deletions packages/api-react/src/services/farmer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const apiWithTag = api.enhanceEndpoints({
'HarvestersSummary',
'HarvesterPlotsKeysMissing',
'HarvesterPlotsDuplicates',
'MissingSignagePoints',
'FilterChallengeStat',
'partialStats',
paninaro marked this conversation as resolved.
Show resolved Hide resolved
],
});

Expand All @@ -32,7 +35,12 @@ export const farmerApi = apiWithTag.injectEndpoints({
providesTags: [{ type: 'Harvesters', id: 'LIST' }],
onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [
{
command: 'onHarvesterChanged',
command: 'onHarvesterUpdated',
service: Farmer,
endpoint: 'getHarvesters',
},
{
command: 'onHarvesterRemoved',
service: Farmer,
endpoint: 'getHarvesters',
},
Expand Down Expand Up @@ -231,25 +239,75 @@ export const farmerApi = apiWithTag.injectEndpoints({
{ type: 'Pools', id: 'LIST' },
]
: [{ type: 'Pools', id: 'LIST' }],
onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [
{
command: 'onSubmittedPartial',
service: Farmer,
endpoint: 'getPoolState',
},
{
command: 'onFailedPartial',
service: Farmer,
endpoint: 'getPoolState',
},
]),
}),

getPartialStatsOffset: query(build, Farmer, 'getPartialStatsOffset', {
providesTags: ['partialStats'],
}),

resetPartialStats: mutation(build, Farmer, 'resetPartialStats', {
invalidatesTags: ['partialStats'],
}),

setPayoutInstructions: mutation(build, Farmer, 'setPayoutInstructions', {
invalidatesTags: (_result, _error, { launcherId }) => [{ type: 'PayoutInstructions', id: launcherId }],
}),

getFarmingInfo: query(build, Farmer, 'getFarmingInfo', {
getNewFarmingInfo: query(build, Farmer, 'getNewFarmingInfo', {
paninaro marked this conversation as resolved.
Show resolved Hide resolved
onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [
{
command: 'onFarmingInfoChanged',
service: Farmer,
endpoint: 'getNewFarmingInfo',
},
]),
}),

getMissingSignagePoints: query(build, Farmer, 'getMissingSignagePoints', {
providesTags: ['MissingSignagePoints'],
onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [
{
command: 'onNewSignagePoint',
service: Farmer,
endpoint: 'getMissingSignagePoints',
},
]),
}),

resetMissingSignagePoints: mutation(build, Farmer, 'resetMissingSignagePoints', {
invalidatesTags: ['MissingSignagePoints'],
}),

getFilterChallengeStat: query(build, Farmer, 'getFilterChallengeStat', {
providesTags: ['FilterChallengeStat'],
onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [
{
command: 'onFarmingInfoChanged',
service: Farmer,
endpoint: 'getFarmingInfo',
endpoint: 'getFilterChallengeStat',
},
]),
}),

resetFilterChallengeStat: mutation(build, Farmer, 'resetFilterChallengeStat', {
invalidatesTags: ['FilterChallengeStat'],
}),
}),
});

// TODO add new farming info query and event for last_attepmtp_proofs
// TODO add new farming info query and event for last_attempt_proofs

export const {
useFarmerPingQuery,
Expand All @@ -268,5 +326,11 @@ export const {
useGetSignagePointsQuery,
useGetPoolStateQuery,
useSetPayoutInstructionsMutation,
useGetFarmingInfoQuery,
useGetNewFarmingInfoQuery,
useGetMissingSignagePointsQuery,
useResetMissingSignagePointsMutation,
useGetFilterChallengeStatQuery,
useResetFilterChallengeStatMutation,
useGetPartialStatsOffsetQuery,
useResetPartialStatsMutation,
} = farmerApi;
25 changes: 24 additions & 1 deletion packages/api-react/src/services/harvester.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Harvester } from '@chia-network/api';

import api, { baseQuery } from '../api';
import onCacheEntryAddedInvalidate from '../utils/onCacheEntryAddedInvalidate';
import { query, mutation } from '../utils/reduxToolkitEndpointAbstractions';
import { apiWithTag } from './farmer';

const apiWithTag2 = apiWithTag.enhanceEndpoints({
addTagTypes: ['Plots', 'PlotDirectories'],
addTagTypes: ['Plots', 'PlotDirectories', 'harvesterConfig'],
paninaro marked this conversation as resolved.
Show resolved Hide resolved
});

export const harvesterApi = apiWithTag2.injectEndpoints({
Expand Down Expand Up @@ -71,6 +73,24 @@ export const harvesterApi = apiWithTag2.injectEndpoints({
{ type: 'PlotDirectories', id: dirname },
],
}),

getHarvesterConfig: query(build, Harvester, 'getHarvesterConfig', {
providesTags: ['harvesterConfig'],
}),

updateHarvesterConfig: mutation(build, Harvester, 'updateHarvesterConfig', {
invalidatesTags: ['harvesterConfig'],
}),

getFarmingInfo: query(build, Harvester, 'getFarmingInfo', {
onCacheEntryAdded: onCacheEntryAddedInvalidate(baseQuery, api, [
{
command: 'onFarmingInfoChanged',
service: Harvester,
endpoint: 'getFarmingInfo',
},
]),
}),
}),
});

Expand All @@ -81,4 +101,7 @@ export const {
useGetPlotDirectoriesQuery,
useAddPlotDirectoryMutation,
useRemovePlotDirectoryMutation,
useGetFarmingInfoQuery,
useGetHarvesterConfigQuery,
useUpdateHarvesterConfigMutation,
} = harvesterApi;
Loading
Loading