-
Notifications
You must be signed in to change notification settings - Fork 29
chore: add lock in localmngr #726
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
Conversation
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 pull request adds mutex locking to the LocalEOTSManager to prevent race conditions in signing operations. The changes ensure thread-safe access to prevent double signing with the same nonce.
- Added mutex locks to
SignEOTSandSignBatchEOTSmethods to protect critical sections - Replaced
getEOTSPrivKeycalls with direct key store access to avoid lock contention - Added detailed comments explaining the purpose of the locking mechanism
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
eotsmanager/localmanager.go
Outdated
| if err != nil { | ||
| return nil, err | ||
| } | ||
| _, pubRand := lm.getRandomnessPair(privKey, chainID, height) |
Copilot
AI
Oct 14, 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 getRandomnessPair method returns two values (privRand, pubRand) but only pubRand is being captured. This discards the private randomness value that may be needed elsewhere.
eotsmanager/localmanager.go
Outdated
| return nil, fmt.Errorf("failed to get EOTS private key: %w", err) | ||
| } | ||
|
|
||
| privRand, _ := lm.getRandomnessPair(privKey, chainID, height) |
Copilot
AI
Oct 14, 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 getRandomnessPair method returns two values (privRand, pubRand) but only privRand is being captured. This discards the public randomness value that may be needed elsewhere.
| privRand, _ := lm.getRandomnessPair(privKey, chainID, height) | |
| privRand, pubRand := lm.getRandomnessPair(privKey, chainID, height) |
eotsmanager/localmanager.go
Outdated
| if err != nil { | ||
| return nil, fmt.Errorf("failed to get private randomness: %w", err) | ||
| } | ||
| privRand, _ := lm.getRandomnessPair(privKey, chainID, height) |
Copilot
AI
Oct 14, 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 getRandomnessPair method returns two values (privRand, pubRand) but only privRand is being captured. This discards the public randomness value that may be needed elsewhere.
| privRand, _ := lm.getRandomnessPair(privKey, chainID, height) | |
| privRand, pubRand := lm.getRandomnessPair(privKey, chainID, height) |
eotsmanager/localmanager.go
Outdated
| return nil, fmt.Errorf("failed to get EOTS private key: %w", err) | ||
| } | ||
|
|
||
| privRand, _ := lm.getRandomnessPair(privKey, chainID, height) |
Copilot
AI
Oct 14, 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 getRandomnessPair method returns two values (privRand, pubRand) but only privRand is being captured. This discards the public randomness value that may be needed elsewhere.
| privRand, _ := lm.getRandomnessPair(privKey, chainID, height) | |
| privRand, pubRand := lm.getRandomnessPair(privKey, chainID, height) |
_V4-CORE-005_ (cherry picked from commit 069b9ab)
_V4-CORE-005_<hr>This is an automatic backport of pull request #726 done by [Mergify](https://mergify.com). Co-authored-by: Lazar <12626340+Lazar955@users.noreply.github.com>
V4-CORE-005