Skip to content

Conversation

cody-littley
Copy link
Contributor

Why are these changes needed?

Auditor Finding

Finding #5 (Note): Under provisioned slice capacity for batchData

  • The code allocates batchData with capacity len(rawBundles), but when running multiple operator quorums, each rawBundle may expand into multiple node.BundleToStore entries. Because actual entries can exceed len(rawBundles), Go automatically reslices—and reallocates—the underlying slice, degrading performance. [Code] and [Code]
  • Recommendation: Compute the total expected number of BundleToStore elements up‐front (for example, by summing len(rb.Bundles) for each rb in rawBundles), then use that sum for make([]*node.BundleToStore, 0, total) to eliminate unnecessary reallocations.

Response

Although the issue is minor, I agree with the auditor's assessment. This PR fixes the issue.

Signed-off-by: Cody Littley <[email protected]>
@cody-littley cody-littley self-assigned this May 8, 2025
@cody-littley cody-littley requested a review from litt3 May 8, 2025 15:13
@cody-littley cody-littley changed the title Fix auditor finding 5. fix: auditor finding 5 May 9, 2025
@cody-littley cody-littley merged commit 310cf24 into master May 9, 2025
15 of 16 checks passed
@cody-littley cody-littley deleted the litt-audit-f5 branch May 9, 2025 15:05
ethenotethan pushed a commit that referenced this pull request May 14, 2025
Fix auditor finding 5.

Signed-off-by: Cody Littley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants