fix(simapp): concurrent map writes when calling GetSigners (backport #21073)#21126
Conversation
(cherry picked from commit de0708b)
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
julienrbrt
left a comment
There was a problem hiding this comment.
We only need to backport simapp changes
|
@julienrbrt your pull request is missing a changelog! |
Description
Whenever GetSigners is called and the
getSignerFnhasn't been set for the message type, it will set it on an internal map. If this is called in 2 or more places at the same time it will cause a concurrent map write issue.To avoid this, developers must call
interfaceRegistry.SigningContext().Validate()when creating the app (depinject users don't need this as it's being done when providing the interfaceRegistry).Also, a write only mutex has been added as a defensive measure in case there's any unhandled case (most likely because of a misconfiguration, or usage of multiple instances of SigningContexts). This shouldn't add any overhead to well configured binaries, and little to misconfigured ones.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
included the correct type prefix in the PR title, you can find examples of the prefixes below:
confirmed
!in the type prefix if API or client breaking changetargeted the correct branch (see PR Targeting)
provided a link to the relevant issue or specification
reviewed "Files changed" and left comments if necessary
included the necessary unit and integration tests
added a changelog entry to
CHANGELOG.mdupdated the relevant documentation or specification, including comments for documenting Go code
confirmed all CI checks have passed
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
x/txmodule to reflect recent improvements and enhancements.This is an automatic backport of pull request #21073 done by [Mergify](https://mergify.com).