-
Notifications
You must be signed in to change notification settings - Fork 14
[RFC 004 DF] Disqualification Flow
Qualification Sample is a special sample of supernodes which collectively make a decision whether or not a supernode (SN) is qualified to participate in an authorization sample and submits a disqualification transaction to the blockchain in case the supernode is not qualified.
There are two types of SN qualification samples:
- Authorization Qualification Sample effectively is the currently active authorization sample. It's purpose is to filter out supernodes from the authorization sample that did not satisfy the authorization sample requirements.
- Blockchain-based Qualification Sample is selected from the current Blockchain-based List. The sample makes a decision about qualification of all (or a random subset of) supernodes from Full Blockchain-based List. The decision is driven by sending special "ping" requests to the supernodes in question. Supernodes that haven't responded to these requests are disqualified from participation in authorization samples over a number of blocks.
Disqualification Transaction is a special type of transaction which reports a supernode that isn't meeting its criteria for participation in authorizations. The disqualification transaction has the following attributes:
- The transaction cannot contain any key images.
- The transaction has zero mining fee.
- Field transaction_extra of the transaction must contain:
- Data for validating qualification sample. This data can vary depending on the qualification sample which generates disqualification transaction.
- List of public identification keys of supernodes from the qualification sample voted for disqualification.
- List of public identification keys of supernodes to be disqualified. The list must contain at least one value.
- List of signatures from all supernodes, voting for disqualification. Each signature must be created based on the disqualification transaction hash, qualification sample validation data (i), and the list of public identification keys of qualification supernodes (ii). Signature signs by supernode private identification key.
To validate the disqualification transaction, each supernode which participates in the Authorization Qualification Sample should:
- check if the disqualification transaction contains key images. If the disqualification transaction contains key images, it should be rejected.
- check if the disqualification transaction is the zero-fee transaction. If the disqualification transaction isn't a zero-fee transaction, it should be rejected.
- check correctness of the data for validation qualification sample. If data is incorrect, the disqualification transaction should be rejected.
- check correctness of qualification supernodes added to the transaction. For this, supernode should
- select the qualification sample using qualification sample data
- validate public identification keys of qualification supernodes, added to the disqualification transaction, with the selected qualification sample.
- check correctness of the list of supernodes to be disqualified.
To validate a disqualification transaction, graftnode should:
- check if the disqualification transaction contains key images. If the disqualification transaction contains key images, it should be rejected.
- check if the disqualification transaction is the zero-fee transaction. If the disqualification transaction isn't a zero-fee transaction, it should be rejected.
- check correctness of the data for validation qualification sample (the data depends on the type of qualification sample). If data is incorrect, the disqualification transaction should be rejected.
- check correctness of qualification supernodes if they were added to the transaction. For this, graftnode should
- select the qualification sample using qualification sample data,
- validate public identification keys of qualification supernodes, which added to the disqualification transaction, with the selected qualification sample.
- check correctness of the list of supernodes to be disqualified. Depending on the type of the disqualification transaction, this validation can differ:
- for the disqualification transaction from Authorization Disqualification Sample, disqualified supernodes should be part of the authorization sample. To validate them, graftnode should
- select the qualification sample using qualification sample data,
- validate if disqualified-to-be supernodes are a part of the selected qualification sample.
- for the disqualification transaction from Blockchain-based Disqualification Sample, disqualified supernodes should be part of the Full Blockchain-based List or next Blockchain-based List. To validate them, graftnode should
- select the Full Blockchain-based List or next Blockchain-based List using qualification sample data,
- validate if disqualified-to-be supernodes are a part of the selected list.
- for the disqualification transaction from Authorization Disqualification Sample, disqualified supernodes should be part of the authorization sample. To validate them, graftnode should
- validate signatures of qualification supernodes. If some of these signatures are invalid, the disqualification transaction should be rejected.
Authorization Sample Qualification Flow is used by Authorization Sample to provide authorization supernode qualification after RTA Transaction validation and consists of the following steps:
-
Authorization Qualification Sample Initialization
- After a supernode from the authorization sample successfully submits RTA transaction to the blockchain, it checks signatures in the RTA Transaction and adds all public identification keys of unresponsive supernodes to Disqualification List, and all public identification keys of active supernodes to Authorization Qualification Sample.
- In case a supernode in the authorization sample reaches validation timeout state, the supernode creates a "status fail" message, adds signatures in the RTA Transaction, as well as collects all public identification keys of authorization sample supernodes that missed validation to Disqualification List.
-
Disqualification Transaction Creation To create a disqualification transaction, supernode should add the following data to the transaction:
- Qualification sample validation data: payment block number, payment block hash and RTA payment ID.
- The list of public identification keys of active supernodes from Authorization Qualification Sample. In this case, active supernode means an authorization supernode sent its signature for RTA Transaction validation.
- The list of public identification keys of supernodes from Disqualification List.
-
Disqualification Transaction Signing
- After disqualification transaction creation, supernode signs it as a regular transaction, using empty randomly created wallet.
- Then supernode encrypts transaction for supernodes from Authorization Qualification Sample using Multiple Recipients Message Encryption and multicasts it over the network.
- When each supernode in the Authorization Qualification Sample receives disqualification transaction, it
- validates the transaction,
- signs if everything is correct,
- encrypts it for supernodes from Authorization Qualification Sample using Multiple Recipients Message Encryption, and
- multicasts to the network.
- Supernode issued disqualification transaction collects the signatures; and, upon receiving signatures from all supernodes from Authorization Qualification Sample, sends disqualification transaction to the blockchain.
Blockchain-based List Qualification Flow is used by current Blockchain-based List to provide supernode disqualification for supernodes from Full Blockchain-based List. Blockchain-based List Qualification Flow consists of the following steps:
- Blockchain-based List Qualification Sample Initialization
- Since Blockchain-based Qualification Sample is always based on the current Blockchain-based List, the qualification process starts upon a new active Blockchain-based List is selected.
- Blockchain-based Qualification Sample is selected, using a random and fixed subset of supernodes from the current Blockchain-based List, based on the block hash of the next (or few next) Blockchain-based List(s) to be validated.
- The Qualification Candidates List -- the list of the supernodes to be checked for disqualification -- is selected randomly, using a fixed subset of supernodes from the next (or few next)Blockchain-based List(s) based on block hash(es) corresponding to the Blockchain-based List(s).
- Qualification Poll
- To vote for disqualification of a supernode, qualification supernode should poll all supernodes, validated by the current qualification sample. For this, qualification supernode:
- creates "ping" request including qualification supernode public identification key and data for validation qualification sample,
- signs message using qualification supernode private identification key,
- encrypts the message for all supernodes, validated by the current qualification sample, using Multiple Recipients Message Encryption, and
- multicasts "ping" request over the network.
- When supernode receives "ping" request, it:
- decrypts "ping" request,
- selects a qualification sample,
- validates if qualification supernode which sent "ping" request may participate in the qualification sample.
- If "ping" request validation passes, the supernode:
- creates "ping" response with its public identification key, current blockchain height and the hash of the last block in the blockchain,
- signs it using private identification key,
- encrypts it for the qualification supernode, which sent "ping" request, using Multiple Recipients Message Encryption, and
- unicasts it to this qualification supernode.
- To vote for disqualification of a supernode, qualification supernode should poll all supernodes, validated by the current qualification sample. For this, qualification supernode:
- Disqualification Voting
- Qualification supernode waits for "ping" responses from supernodes to-be-validated during some period of time, after that the qualification supernode:
- collects all responses from supernodes,
- validates responses by checking the public identification key, current blockchain height and hash of the last block in the blockchain that come in the response, as well as a signature that signed this response,
- gets the list of supernodes missed sending "ping" response or failed response validation,
- creates disqualification request; the request contains data for validation qualification sample, creator's public identification key, and the list of public identification keys of supernodes to be disqualified (Disqualification List),
- signs it using qualification supernode private identification key,
- encrypts a request for all supernodes in the qualification sample, using Multiple Recipients Message Encryption, and
- multicasts it over the network.
- When qualification supernode receives disqualification request, it:
- decrypts disqualification requests,
- validates data for selection qualification sample,
- validates that the requester is eligible to participate in a qualification sample,
- validates the signature of the requester,
- validates that supernodes from the list of disqualified supernodes in the disqualification request are in both Disqualification CandidatesList and Disqualification List of this supernode,
- if all validations passed, supernode accepts disqualification request and stores it.
- Qualification supernode waits for "ping" responses from supernodes to-be-validated during some period of time, after that the qualification supernode:
- Disqualification Transaction Processing After a supernode in the qualification sample receives disqualification requests from all other supernodes in the qualification sample, it: 1. collects all supernodes, voted for disqualification by all supernodes in the qualification sample, into Disqualification List, 2. creates disqualification transaction: block number and block hash for Blockchain-based List selection, (if needed) block number and block hash for validated Blockchain-based List, and the list of public identification keys of supernodes from Disqualification List, 3. signs transaction and 4. sends it to the blockchain.
SDP - Supernode Disqualification Period - The number of blocks during which disqualification rules affecting at the supernode if it was added to the disqualification transaction.
ADS - Average Disqualification Score - The value computed as an average of all disqualification scores of some supernode in the Blockchain-based Qualification List.
AAoS - Accumulated Age of stake - The value determines the reliability of the stake, based on the stake amount, number of blocks, passed after stake activation (as usual AoS) and average disqualification score (ADS),
AoS = StakeAmount * StakeTxBlockNumber * (1 - ADS)
.
To form a blockchain-based disqualification list at a block, graftnode performs the following operations:
- Gets three block numbers: current block height (called BlockHeight), a block number for the block we build Blockchain-based Disqualification List for (called BDListBlockNumber), and a block number which is less than BDListBlockNumber on Supernode Disqualification Period (SDP) (called SDPBlockNumber).
- Scans all blocks in the blockchain from SDPBlockNumber to BDListBlockNumber, and
- collects all disqualification transactions,
- checks all disqualified supernodes in all disqualification transactions,
- checks type of disqualification transaction,
- computes the disqualification score for each disqualified supernode as
where(DTBlockNumber - SDPBlockNumber) / (2 * (BDListBlockNumber - SDPBlockNumber)),
DTBlockNumber
is block number of the block that contains corresponding disqualification transaction, and 5. adds each disqualified supernode to the blockchain-based disqualification list with the following data: 1. supernode public identification key, 2. supernode disqualification score, 3. type of disqualification transaction, 4. block number of the block which includes corresponding disqualification transaction. 6. If disqualified supernode already presents in the blockchain-based disqualification list, simply adds new data to the related item in the list without duplicating the supernode entry itself. - Scans all blocks in the blockchain from BDListBlockNumber to BlockHeight, and
- collects all disqualification transactions,
- checks all disqualified supernodes in all disqualification transactions,
- checks type of disqualification transaction,
- computes the disqualification score for each disqualified supernode as
where0.5 + (DTBlockNumber - BDListBlockNumber) / (2 * (BlockHeight - BDListBlockNumber)),
DTBlockNumber
is block number of the block which includes corresponding disqualification transaction, and 5. adds each disqualified supernode to the blockchain-based disqualification list with the following data: 1. supernode public identification key, 2. supernode disqualification score, 3. type of disqualification transaction, 4. block number of the block which includes corresponding disqualification transaction. 6. If disqualified supernode already presents in the blockchain-based disqualification list, simply adds new data to the related item in the list without duplicating the supernode entry itself.
To form the current blockchain-based list from the Full Blockchain-based List for some block, graftnode performs the following operations:
- Gets block hash (hexadecimal encoded) for the block we build Blockchain-based List for, and splits it into bytes.
- Gets Blockchain-based List or the previous block hash:
- Sorts previous Blockchain-based List by accumulated age of stake (AAoS).
- Gets first PBLSize bytes from the split block hash and selects PBLSize supernodes from it, using these one-byte numbers as indexes. If selected supernode is already taken, increase the index by one and check next supernode in the list until it found unselected supernode. Then graftnode moves to the next one-byte number and searches for next supernode.
- Gets Full Blockchain-based List:
- Sorts Full Blockchain-based List by accumulated age of stake (AAoS).
- Gets next RBLSize bytes from the split block hash and selects RBLSize supernodes from it, using these one-byte numbers as indexes. If selected supernode is already taken, increase the index by one and check next supernode in the list until it found unselected supernode. Then graftnode moves to the next one-byte number and searches for next supernode.
- Joins both sublists into one list.