threefoldtech / home

Starting point for the threefoldtech organization
https://threefold.io
Apache License 2.0
9 stars 4 forks source link

TFHub - Rent your own node as dedicated #1257

Closed robvanmieghem closed 1 year ago

robvanmieghem commented 2 years ago

Some more info: https://github.com/threefoldtech/threefold_hub/issues/16

https://github.com/threefoldtech/threefold_hub/blob/development/docs/AddingValidators.md

From the threefold connect app: It should be possible to mark a node from a farm you own as dedicated. On such a dedicated node, A Threefold hub validator can be deployed from within the app

Todo spec :

sasha-astiadi commented 2 years ago

investigate which part / components need updates from jimber side @jdelrue

DylanVerstraete commented 2 years ago

This was never intended to work like this. Currently how it's implemented on tfchain is: a farm can be marked as dedicated (by the council). Once this farm is dedicated, every node booted in this farm is indirect a dedicated node.

There is no way to mark nodes in a non-dedicated farm as dedicated.

See https://github.com/threefoldtech/home/issues/1156

robvanmieghem commented 2 years ago

@DylanVerstraete thanks, can you point me to the docs where it is explained why a farmer can not mark its own nodes as dedicated but why this has to be done by the council?

DylanVerstraete commented 2 years ago

@DylanVerstraete thanks, can you point me to the docs where it is explained why a farmer can not mark its own nodes as dedicated but why this has to be done by the council?

Currently there is no public documentation on how a farmer can request to be become a dedicated farm.

robvanmieghem commented 2 years ago

I mainly want to know why this has to go via the council and why a farmer can not mark its own nodes as dedicated.

xmonader commented 2 years ago

https://github.com/threefoldtech/home/issues/1156 @robvanmieghem this has the original discussion and specs

robvanmieghem commented 2 years ago

Why would a node ( and even the entire farm) have to be marked as dedicated?

If you have a RentContract for a node, it is dedicated without the need of it being marked upfront

I don’t get why this marking has to be done.

DylanVerstraete commented 2 years ago

It's marked as dedicated up front so nobody can just deploy a NodeContract and lock the node from being rented. Even a network is coupled to a NodeContract and is free of charge, which will make creating a RentContract fail

robvanmieghem commented 2 years ago

So it's a capacity planning problem

robvanmieghem commented 2 years ago

and why is this on farm level and not per node?

DylanVerstraete commented 2 years ago

and why is this on farm level and not per node?

Did you read the original discussion?

The gist: If ppl can start marking their nodes as dedicated means nobody can use it for deployments unless they rent the entire node. A node uses less power when running idle, so farmers can easily mark all their nodes as dedicated because there is no demand for dedicated nodes (atleast not now) and enjoy having the same rewards AND still run idle.

DylanVerstraete commented 2 years ago

So it's a capacity planning problem

Capacity planning is not managed on chain so I'm not sure which "problem" you are referring to.

robvanmieghem commented 2 years ago

and why is this on farm level and not per node?

Did you read the original discussion?

The gist: If ppl can start marking their nodes as dedicated means nobody can use it for deployments unless they rent the entire node. A node uses less power when running idle, so farmers can easily mark all their nodes as dedicated because there is no demand for dedicated nodes (atleast not now) and enjoy having the same rewards AND still run idle.

Yes I read the original discussion and understand the problem but the currently implemented solution isn't nice ( It's not even done yet as is there is no documentation on how nodes or farms can be made dedicated).

sasha-astiadi commented 2 years ago

@ken-de-moor @sabrinasadik please configure ux / ui spec

sasha-astiadi commented 2 years ago

@robvanmieghem @ken-de-moor @jdelrue please move this forward this week thank you

LeeSmet commented 2 years ago

Essentially, dedicated nodes just mean that a node is "reserved to be reserved", in other words you can't create single deployments on reserved nodes (without reserving the full node first). Marking a node as dedicated is not really required, the initial idea is that a farmer can rent his own node from the app to deploy. In 3.6 (currently on testnet), we extended the rent contracts to also allow a user to create a rent contract on a node which is not used, but also not marked as dedicated. This solves the problem that a user can't mark his own node as dedicated, while still protecting the grid from overzealous marking on users behalf. It should be noted that while we are currently only marking farms as dedicated, if we would mark individual nodes as dedicated, we could only mark already empty nodes as otherwise that would lead to poor user experience, so the requirements to mark a node as dedicated would be that a rent contract could be deployed on it anyhow.

TL;DR: It suffices to create a rent contract on an eligible node, there is no need to mark it as dedicated.

Creating a rent contract

Anyone can create a rent contract on an eligible node (to recall: a node with no active node contracts and no active rent contract). Once a rent contract is created, only the twin owning the rent contract is allowed to create actual node contracts for deployments. Additionally, there can only be 1 active rent contract at a time.

To create a rent contract, the create_rent_contract transaction in the smart contract module needs to be created and submitted to the chain. The only argument is the node_id of the node to rent (https://github.com/threefoldtech/tfchain/blob/development/substrate-node/pallets/pallet-smart-contract/src/lib.rs#L191)

Node eligibility for renting

A node can be rented if it has no active rent contracts and no active node contracts. This can be checked as follows:

Note that these checks are also performed once the transaction to rent the node is submitted, however submitting the transaction requires a small amount of tft which won't be refunded so checking up front is better.

Cancelling the rent contract

This can be done by submitting a generic cancel contract transaction (https://github.com/threefoldtech/tfchain/blob/development/substrate-node/pallets/pallet-smart-contract/src/lib.rs#L160), with as argument the contract id to cancel. Cancelling a rent contract will also cancel all node contracts on the node, as these were covered by the rent contract.

ken-de-moor commented 2 years ago

Clear what to do and investigation was already done. Backend required to do this is not yet entirely live. Once this is live in mainnet we will continue work on this.

sasha-astiadi commented 2 years ago

prio unclear.... is it still specced for 3.7 still? @despiegk According to your document, its not there on 3.7.x https://forum.threefold.io/t/internal-roadmap-3-5-3-6-3-x/2928

xmonader commented 2 years ago

@ken-de-moor why can't you use testnet for this?

ken-de-moor commented 2 years ago

Not on roadmap, unclear about priorities.

rkhamis commented 2 years ago

TFHub feature is on hold as per https://forum.threefold.io/t/gep-suggestion-to-wait-with-deployment-of-validators-l2-closed/3164

I suggest we remove this feature until a consensus is reached about L2 validators

weynandkuijpers commented 2 years ago

Question: with 3.7.1 being rolled out we need to explain how farmers can present their nodes as available for dedicated. I have tried to find documentation beyond what is in this story, but I have not been able to find it. There are community calls planned of which one will have as a topic dedicated nodes.

I'd like to have a complete description/understanding of how a node becomes available as dedicated. If you tell me I will update the manual.

image
LeeSmet commented 2 years ago

There are 2 options:

  1. The farm is marked as dedicated only by the council. This option was already present and hasn't changed. Currently on mainnet no such farm exists however. In this case, all nodes in the farm are marked such that they can only be fully rented.
  2. Introduced in this update, a rent contract can be deployed eagerly on applicable nodes. An applicable node is simply an "empty" node, i.e. one which does not have any active contract. This way, a user can choose to fully reserve the node if nothing is there yet.

In either case, there is no direct control from the farmer (in the first case he could ask the council to mark him as dedicated only, but that is unlikely to happen). In other words, all farmers implicitly support dedicated nodes now.

weynandkuijpers commented 2 years ago

@LeeSmet thank you. @DylanVerstraete sorry to bother you and ask directly. So mainnet not has 50'ish dedicated nodes which in this logic means their are more than 1900 nodes partially used.... Or does it not yet provide a full list?

LeeSmet commented 2 years ago

That depends what you mean by "it". The chain doesn't mark implicit nodes, it just checks if a node is eligeble for renting once a rent contract is attempted to be deployed on it. So tools on top need to check for nodes which don't have any contract active, then show those as rentable.

weynandkuijpers commented 2 years ago

Added the text to the manual - thank you @LeeSmet

despiegk commented 1 year ago

made new issue