refactor(smart-wallet): test UpgradeDisconnection correctly #9012
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.
closes: #XXXX
refs: #8998 (review)
Description
The current smartWallet code, in one place, tests whether an object is an UpgradeDisconnection by
err.upgradeMessage === 'vat upgraded'
. But the official test tests only the contents oferr.name
. Thus, this test can make errors of both inclusion and exclusion. This PR replaces that with the official predicate.Despite the seemingly significant change, I classify this PR as a refactor because I manually looked for all occurrences of
'vatUpgraded'
,'vat upgraded'
,makeUpgradeDisconnection
, andisUpgradeDisconnection
, and verified that the change made by this PR is unlikely to actually have any observable effect on anything. Rather, it is protection against cases that may arise in the future.Security Considerations
The wrong test might possible open a security vulnerability on our current system, but probably not. It is hard to image.
After this PR, we won't need to worry about this discrepancy even in theory, or wrt future code.
Scaling Considerations
none
Documentation Considerations
none
Testing Considerations
To the degree this is a pure refactoring, there's nothing to test. We could test for behavior under the discrepancy we're fixing here. But this PR does not do so. Reviewers, are you ok without that test?
Upgrade Considerations
Should be none. Hard to imagine otherwise. Reviewers, am I possibly missing anything?