-
Notifications
You must be signed in to change notification settings - Fork 215
Fix bitmap #6921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bitmap #6921
Conversation
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
| return result | ||
| } | ||
|
|
||
| func UnsetBitInBitmap(index int, bitmap []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses a bug fix in the bitmap generation and update logic used in block processing and associated testing. Key changes include:
- Updating tests in processor_test.go to cover the UnsetBitInBitmap functionality.
- Modifying the CreateNewBlock and updatePreviousProofAndAddonHeader flows in processor.go to invoke UnsetBitInBitmap for non-managed validators.
- Adjusting configuration parameters and timing in chainSimulator.go and jail_test.go to better reflect the desired simulator behavior.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| node/chainSimulator/process/processor_test.go | Added tests to check bitmap manipulation functions |
| node/chainSimulator/process/processor.go | Updated bitmap handling in block creation and signature logic |
| node/chainSimulator/chainSimulator.go | Changed consensus configuration and increased sleep duration |
| integrationTests/chainSimulator/staking/jail/jail_test.go | Increased epoch transitions to simulate multi-epoch behavior |
Comments suppressed due to low confidence (1)
node/chainSimulator/process/processor.go:317
- [nitpick] Replacing header.GetPubKeysBitmap() with a hardcoded []byte{1} might not be intended; please verify that this change correctly reflects the intended signature behavior.
[]byte{1},
| } | ||
|
|
||
| func UnsetBitInBitmap(index int, bitmap []byte) error { | ||
| if len(bitmap) < index/8 { |
Copilot
AI
Apr 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The boundary check in UnsetBitInBitmap may be off by one; consider using 'if index/8 >= len(bitmap)' to correctly validate the bitmap length.
| if len(bitmap) < index/8 { | |
| if index/8 >= len(bitmap) { |
| } | ||
|
|
||
| func UnsetBitInBitmap(index int, bitmap []byte) error { | ||
| if len(bitmap) < index/8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if index%8 is not 0, i think expected bitmap size has to be higher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
|
||
| func UnsetBitInBitmap(index int, bitmap []byte) error { | ||
| if len(bitmap) < index/8 { | ||
| return errors.New("bitmap too short") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have ErrWrongSizeBitmap is errors/common
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| headerHash, | ||
| header.GetEpoch(), | ||
| header.GetPubKeysBitmap(), | ||
| []byte{1}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
|
📊 MultiversX Automated Test Report: View Report 🔄 Build Details:
🚀 Environment Variables:
|
Reasoning behind the pull request
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?