Root + Impact
[L-3] Missing events-logging for protocol crictical update functions.
Description
The WeatherNft::updateFunctionsGasLimit
,WeatherNft::updateSubId
,
WeatherNft::updateSource
,WeatherNft::updateEncryptedSecretsURL
,
WeatherNft::updateKeeperGaslimit
functions lacks important events logging
which becomes impossible for frontend to trace the important states updated
of protocol.
Impact:
Due to lack of missing events logging ,frontend data tracing and fetching becomes impossible.
Recommended Mitigation
+event functiongaslimitupdated(uint32 oldgaslimit, uint32 newgaslimit);
+event SubIdUpdated(uint64 oldSubId, uint64 newSubId);
+event SourceUpdated(string oldSource, string newSource);
+event EncryptedSecretsURLUpdated(bytes oldEncryptedSecretsURL, bytes newEncryptedSecretsURL);
+event updateKeeperGaslimitupdated(uint32 oldgaslimit,uint32 newgaslimit);
Revised Code:
function updateFunctionsGasLimit(uint32 newGaslimit) external onlyOwner {
emit functiongaslimitupdated (s_functionsConfig.gasLimit,newGaslimit);
s_functionsConfig.gasLimit = newGaslimit;
}
function updateSubId(uint64 newSubId) external onlyOwner {
emit SubIdUpdated(s_functionsConfig.subId, newSubId);
s_functionsConfig.subId = newSubId;
}
function updateSource(string memory newSource) external onlyOwner {
emit SourceUpdated(s_functionsConfig.source, newSource);
s_functionsConfig.source = newSource;
}
function updateEncryptedSecretsURL(
bytes memory newEncryptedSecretsURL
) external onlyOwner {
emit EncryptedSecretsURLUpdated(s_functionsConfig.encryptedSecretsURL, newEncryptedSecretsURL);
s_functionsConfig.encryptedSecretsURL = newEncryptedSecretsURL;
}
function updateKeeperGaslimit(uint32 newGaslimit) external onlyOwner {
emit updateKeeperGaslimitupdated(s_upkeepGaslimit,newGaslimit);
s_upkeepGaslimit = newGaslimit;
}