Function: removeBLSPublicKeyWithSignature()
The function removes a BLS public key from the network using an aggregated BLS signature, allowing the service node to exit and release the staked amount.
The difference between this function and removeBLSPublicKeyAfterWaitTime
is that it does not require setting the leaveRequestTimestamp
in _serviceNodes
beforehand through initiateRemoveBLSPublicKey
.
Inputs
blsPubkey
Validation: The
blsPubKey
must be the BLS public key of a preregistered ServiceNode.Impact: The BLS public key of the ServiceNode to be removed.
timestamp
Validation: The timestamp must be within the seconds specified by
signatureExpiry
from the currentblock.timestamp
.Impact: A parameter necessary to check the validity period of the
blsSignature
.
blsSignature
Validation: N/A.
Impact: A parameter necessary to verify the
encodedMessage
generated inremoveBLSPublicKeyWithSignature
.
ids
Validation: The length of
ids
must not exceed 1/3 of the total number of signers, and under no circumstances can the length ofids
exceed 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
hashToField
before 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
), updates the verification key, and verifies theencodedMessage
(Hm
) with theblsSignature
.
_removeBLSPublicKey(serviceNodeID, _serviceNodes[serviceNodeID].deposit) -> serviceNodeDelete(serviceNodeID)
External/Internal? Internal.
Argument control:
serviceNodeID
.Impact: Deletes the specified data from
_serviceNodes
andserviceNodeIDs
— also removes the specified public key from_aggregatePubKey
.
_removeBLSPublicKey(serviceNodeID, _serviceNodes[serviceNodeID].deposit) -> updateBLSNonSignerThreshold()
External/Internal? Internal.
Argument control:
serviceNodeID
.Impact: Updates the number of signers that can be excluded from BLS signature aggregation.