Function: liquidateBLSPublicKeyWithSignature()
The function removes a service node by liquidating its node from the network, rewarding the caller and transferring the remaining funds according to predefined ratios, after validating the provided BLS signature and ensuring the network's approval for the liquidation.
Inputs
blsPubkeyValidation: The
blsPubKeymust be the BLS public key of a preregistered ServiceNode.Impact: The BLS public key of the ServiceNode to be removed.
timestampValidation: The timestamp must be within the seconds specified by
signatureExpiryfrom the currentblock.timestamp.Impact: A parameter necessary to check the validity period of the
blsSignature.
blsSignatureValidation: N/A.
Impact: A parameter necessary to verify the
encodedMessagegenerated inliquidateBLSPublicKeyWithSignature.
idsValidation: The length of
idsmust not exceed 1/3 of the total number of signers, and under no circumstances can the length ofidsexceed 300, which can be adjusted bysetBLSNonSignerThresholdMax.Impact: The IDs of the signers to be excluded from the BLS public-key aggregation.
Branches and code coverage (including function calls)
Intended branches
Negative behavior
Function call analysis
BN256G2.hashToG2(BN256G2.hashToField(string(encodedMessage)))External/Internal? External.
Argument control: Value is hashed with
hashToFieldbefore passing as an argument.Impact: Hash computation before BLS signature verification.
validateSignatureOrRevert(ids, blsSignature, Hm) -> Pairing.pairing2(BN256G1.P1(), signature, BN256G1.negate(pubkey), hashToVerify)External/Internal? Internal.
Argument control:
ids,blsSignature, andHm.Impact: Aggregates the excluded signers (
ids) and verifies theencodedMessage(Hm) with theblsSignature.
_removeBLSPublicKey(serviceNodeID, deposit - liquidatorAmount - poolAmount) -> serviceNodeDelete(serviceNodeID)External/Internal? Internal.
Argument control:
serviceNodeID.Impact: Deletes the specified data from
_serviceNodesandserviceNodeIDs— also removes the specified public key from_aggregatePubKey.
_removeBLSPublicKey(serviceNodeID, deposit - liquidatorAmount - poolAmount) -> updateBLSNonSignerThreshold()External/Internal? Internal.
Argument control:
serviceNodeID.Impact: Updates the number of signers that can be excluded from BLS signature aggregation.
SafeERC20.safeTransfer(designatedToken, msg.sender, liquidatorAmount)External/Internal? External.
Argument control: N/A.
Impact: Transfers the
liquidatorAmountofdesignatedTokento the address that executed theliquidateBLSPublicKeyWithSignaturefunction.
SafeERC20.safeTransfer(designatedToken, address(foundationPool), poolAmount)External/Internal? External.
Argument control: N/A.
Impact: Transfers the
poolAmountofdesignatedTokento thefoundationPool.