fix(auth): add mutex-protected atomic metadata updates#328
Merged
Conversation
Add a dedicated metadata mutex to serialise read-modify-write cycles on user metadata, preventing concurrent coin activations from overwriting each other's state. Introduces updateActiveUserMetadataKey for atomic single-key transforms and migrates setOrRemoveActiveUserKeyValue to use it. Also updates bundled coins config to master branch (aceacfb).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
CharlVS
added a commit
to GLEECBTC/gleec-wallet
that referenced
this pull request
Mar 21, 2026
Points to GLEECBTC/komodo-defi-sdk-flutter#328 which adds mutex-protected atomic metadata updates to prevent concurrent coin activations from overwriting each other's state.
Merged
4 tasks
Contributor
|
Visit the preview URL for this PR (updated for commit fbce69f): https://komodo-playground--pr328-fix-metadata-race-w2lazcx9.web.app (expires Sat, 28 Mar 2026 17:37:52 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 2bfedd77fdea45b25ba7c784416e81f177aa5c47 |
CharlVS
added a commit
that referenced
this pull request
Mar 23, 2026
The IAuthService interface gained updateActiveUserMetadataKey in #328 but the _FakeAuthService in the Trezor auth tests was not updated, causing a compilation error.
1 task
CharlVS
added a commit
to GLEECBTC/gleec-wallet
that referenced
this pull request
Mar 23, 2026
…3454) * chore(sdk): roll submodule for metadata race fix Points to GLEECBTC/komodo-defi-sdk-flutter#328 which adds mutex-protected atomic metadata updates to prevent concurrent coin activations from overwriting each other's state. * fix(coins): use atomic metadata updates for coin activation Batch-write all asset IDs to wallet metadata in a single call before launching parallel activations, then pass addToWalletMetadata: false to avoid N concurrent read-modify-write cycles that caused last-write-wins data loss. Migrate addActivatedCoins/removeActivatedCoins to use the new updateActiveUserKeyValue API for atomic single-key transforms. * chore(sdk): roll submodule to dev (9532870) Includes fix(auth): add mutex-protected atomic metadata updates (#328). * chore(sdk): advance submodule to 317719d for WASM valueOrNull fix The merge from dev picked the fix/metadata-race side's SDK pointer (9532870, #328 only) instead of dev's pointer (317719d) which also includes #329 — the reified generics fix for _traverseJson that prevents valueOrNull<List<String>> from silently returning null in WASM/minified release builds. * chore(sdk): bump submodule for trezor test compilation fix Points to fix/trezor-test-missing-method (ea99ec6) which adds the missing updateActiveUserMetadataKey stub to _FakeAuthService in trezor_auth_service_test.dart. * chore(sdk): roll submodule to dev (c70beed) Includes #328 (atomic metadata updates), #329 (reified generics for WASM), and #330 (trezor test compilation fix). * ci: trigger CI rebuild * chore(sdk): bump submodule to dev after bundled coins commit merge Points sdk at 869dd00 (komodo-defi-sdk-flutter dev), including PR #331.
CharlVS
added a commit
that referenced
this pull request
Apr 1, 2026
Add a dedicated metadata mutex to serialise read-modify-write cycles on user metadata, preventing concurrent coin activations from overwriting each other's state. Introduces updateActiveUserMetadataKey for atomic single-key transforms and migrates setOrRemoveActiveUserKeyValue to use it. Also updates bundled coins config to master branch (aceacfb).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_metadataMutextoKdfAuthServicethat serialises all read-modify-write cycles on user metadata, preventing concurrent coin activations from overwriting each other's state.updateActiveUserMetadataKeyonIAuthService/KomodoDefiAuthfor atomic single-key transforms, and migratessetOrRemoveActiveUserKeyValueto use it internally.masterbranch (aceacfb).Test plan
setOrRemoveActiveUserKeyValuestill works correctly for setting/removing individual keysupdateActiveUserKeyValuecorrectly applies transforms and persists results