Repository navigation
docs: verify contract upgrade cache invalidation already covers #840 - #891
Merged
Merged
Conversation
…it#840 detectContractUpgrade (src/soroban/upgradeDetection.ts) already detects Soroban contract upgrades by Wasm code-hash change and invalidates every contract-scoped cache (method metadata, schema, read, state) on upgrade, with test coverage in src/tests/upgradeDetection.test.ts. No code change needed for Sorokit#840. Closes Sorokit#840
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
Investigated #840 (ContractInvocationCache does not handle Soroban contract upgrades). No code change needed, this is already fully implemented on main.
closes #840
Details
src/soroban/upgradeDetection.ts'sdetectContractUpgradefetches the deployed Wasm, hashes it, and compares against the previously recorded hash for that contract ID (shipped in commit f1e3185).invalidateContractCachesclears every cache keyed to that contract: method metadata (both the external SorokitCache entry and the internal in-memory LRU incontractMetadata.ts), plus the contract-schema, contract-read, and contract-state key prefixes.client.soroban.detectContractUpgrade(contractId, onUpgrade?, timeoutMs?).src/tests/upgradeDetection.test.tsalready covers both the first-seen-hash case and the hash-change/invalidation case.All three acceptance criteria in #840 are met: upgrade detection by code-hash change, cache invalidation on upgrade, and test coverage.
The issue names a
ContractInvocationCacheclass specifically, no such class exists, the same behavior is implemented via prefix-based invalidation against the genericSorokitCacheinterface instead. Functionally equivalent and already covers the acceptance criteria.Validation
npx vitest run src/tests/upgradeDetection.test.tspasses on a clean checkout.