Skip to content

Commit

Permalink
q
Browse files Browse the repository at this point in the history
- Remove unwanted contract validation
- Early exit for check it node is rented and not in dedicated farm
- Remove the check only if dedicated filter is ON
  • Loading branch information
samaradel committed Feb 23, 2025
1 parent b77977f commit f1c65fe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,26 +303,8 @@ export default {
const nodeInputValidateTask = useAsync<boolean, string, [NodeInfo | undefined]>(
async node => {
try {
if (node && node.rentContractId !== 0) {
const { state } = await gridStore.grid.contracts.get({
id: node?.rentContractId,
});
if (state.gracePeriod) {
const err = `You can't deploy on node ${node.nodeId}, its rent contract is in grace period.`;
throw err;
}
}
} catch (error) {
const err = normalizeError(
error,
"Something went wrong while checking status of the node. Please check your connection and try again.",
);
throw err;
}
const nodeCapacityValid = await checkNodeCapacityPool(gridStore, node, props.filters);
const rentContractValid = props.filters.dedicated ? await validateRentContract(gridStore, node) : true;
const rentContractValid = await validateRentContract(gridStore, node);
if (node && !isNodeValid(props.getFarm, node!, props.selectedMachines, filters.value)) {
throw `Node (${node.nodeId}) is not valid.`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,8 @@ export default {
});
async function handleNodeClick() {
try {
if (props.status === "Init" && props.node) {
ctx.emit("node:select", props.node as NodeInfo);
}
if (props.node?.dedicated && props.node.rentContractId === 0) return false;
await validateRentContract(gridStore, props.node as NodeInfo);
} catch (error) {
return error;
if (props.status === "Init" && props.node) {
ctx.emit("node:select", props.node as NodeInfo);
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/playground/src/utils/nodeSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export async function validateRentContract(
if (!node || !node.nodeId) {
throw "Node ID is required.";
}
if (node.dedicated && node.rentedByTwinId === 0 && !node.inDedicatedFarm) return true;

try {
if (node.dedicated && node.rentedByTwinId === 0 && node.inDedicatedFarm) {
Expand Down

0 comments on commit f1c65fe

Please sign in to comment.