Sf 1.11.0#7242
Conversation
| log.Warn("epochfastforward rounds per epoch too small", "rounds", roundsPerEpoch, "minRoundModulus", minRoundModulus) | ||
| roundsPerEpochUint = minRoundModulus | ||
| } | ||
|
|
Check failure
Code scanning / CodeQL
Incorrect conversion between integer types High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To fix the problem, before converting epochs (int64) to int, explicitly check that its value is within the valid range for int on the current platform.
- The correct range for
intcan be obtained in Go by usingmath.MaxIntandmath.MinInt. - If
epochsis out of range, ignore the input or set it to a default/safe value (e.g., 0 or some reasonable fallback). - Add
import "math"at the top if not already present (it's already imported).
Specifically:
- In
process/block/metablock.go, in the methodepochsFastForward, after parsingepochs, check if it fits into anint(i.e.,epochs >= math.MinInt && epochs <= math.MaxInt). - Only then assign
mp.nrEpochsChanges = int(epochs). Otherwise, log an error/warning, and assign a safe default (e.g., 0).
| @@ -2823,7 +2823,12 @@ | ||
| roundsPerEpochUint = minRoundModulus | ||
| } | ||
|
|
||
| mp.nrEpochsChanges = int(epochs) | ||
| if epochs >= int64(math.MinInt) && epochs <= int64(math.MaxInt) { | ||
| mp.nrEpochsChanges = int(epochs) | ||
| } else { | ||
| log.Error("epochfastforward", "epochs value out of int range", epochs) | ||
| mp.nrEpochsChanges = 0 | ||
| } | ||
| mp.roundsModulus = roundsPerEpochUint | ||
|
|
||
| log.Warn("epochfastforward - forcing epoch start", "round", metaHdr.GetRound(), "epoch", metaHdr.GetEpoch(), "still remaining epoch changes", mp.nrEpochsChanges, "rounds modulus", mp.roundsModulus) |
# Conflicts: # process/sync/baseForkDetector.go
|
❌ Integration Tests completed with failures or errors. 📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
❌ Integration Tests completed with failures or errors. 📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
❌ Integration Tests completed with failures or errors. 📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
❌ Integration Tests completed with failures or errors. 📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
❌ Integration Tests completed with failures or errors. 📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?