Open hats-bug-reporter[bot] opened 4 months ago
Github username: -- Twitter username: -- Submission hash (on-chain): 0x333ee24524b9daf8df70c802935d2d6d9a8592abce5bb294ce5b29d18c5baa37 Severity: low
Description: Description\ The _updateKeyPair, _setMinWitnessSignatures and _setWitnessPublicKeys functions do not emit an event, although they should.
Recommendations\ Add events to these functions.
Attachments
Proof of Concept (PoC) File
ContractSigningKeyPair private _keyPair; mapping(bytes => bool) public witnessPublicKeysSet; uint8 public minWitnessSignatures; constructor() { _updateKeyPair(); } function _updateKeyPair() internal { (bytes memory publicKey, bytes memory privateKey) = Sapphire.generateSigningKeyPair( Sapphire.SigningAlg.Secp256k1PrehashedKeccak256, Sapphire.randomBytes(32, abi.encodePacked(block.number, msg.sender)) ); _keyPair.publicKey = publicKey; _keyPair.privateKey = privateKey; } function _setMinWitnessSignatures(uint8 _min) internal { minWitnessSignatures = _min; } function _setWitnessPublicKeys(WitnessActivation[] memory _witnesses) internal { for (uint i = 0; i < _witnesses.length; i++) { witnessPublicKeysSet[_witnesses[i].publicKey] = _witnesses[i].isActive; } }
Revised Code File (Optional)
event UpdateKeyPair(bytes indexed publicKey, bytes indexed privateKey); event SetMinWitnessSignatures(uint8 indexed minWitnessSignatures); event SetWitnessPublicKeys(WitnessActivation[] indexed witnesses); ContractSigningKeyPair private _keyPair; mapping(bytes => bool) public witnessPublicKeysSet; uint8 public minWitnessSignatures; constructor() { _updateKeyPair(); } function _updateKeyPair() internal { (bytes memory publicKey, bytes memory privateKey) = Sapphire.generateSigningKeyPair( Sapphire.SigningAlg.Secp256k1PrehashedKeccak256, Sapphire.randomBytes(32, abi.encodePacked(block.number, msg.sender)) ); _keyPair.publicKey = publicKey; _keyPair.privateKey = privateKey; emit UpdateKeyPair(_keyPair.publicKey, _keyPair.privateKey); } function _setMinWitnessSignatures(uint8 _min) internal { minWitnessSignatures = _min; emit SetMinWitnessSignatures(minWitnessSignatures); } function _setWitnessPublicKeys(WitnessActivation[] memory _witnesses) internal { for (uint i = 0; i < _witnesses.length; i++) { witnessPublicKeysSet[_witnesses[i].publicKey] = _witnesses[i].isActive; } emit SetWitnessPublicKeys(_witnesses); }
Informational
Github username: -- Twitter username: -- Submission hash (on-chain): 0x333ee24524b9daf8df70c802935d2d6d9a8592abce5bb294ce5b29d18c5baa37 Severity: low
Description: Description\ The _updateKeyPair, _setMinWitnessSignatures and _setWitnessPublicKeys functions do not emit an event, although they should.
Recommendations\ Add events to these functions.
Attachments
Proof of Concept (PoC) File
Revised Code File (Optional)