Skip to content
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

refactor(smart-wallet): test UpgradeDisconnection correctly #9012

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

erights
Copy link
Member

@erights erights commented Feb 29, 2024

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 of err.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, and isUpgradeDisconnection, 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?

@erights erights self-assigned this Feb 29, 2024
@erights erights force-pushed the markm-test-UpgradeDisconnection-correctly branch from baeb7c0 to c31a19b Compare February 29, 2024 00:14
@erights erights marked this pull request as ready for review February 29, 2024 00:25
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you point out it's not strictly a refactor but it's close enough.

As of today anything the logic can assumed to be equivalent.

@erights erights added the automerge:squash Automatically squash merge label Feb 29, 2024
Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I don't think you missed anything.

@mergify mergify bot merged commit 1fe256a into master Feb 29, 2024
82 checks passed
@mergify mergify bot deleted the markm-test-UpgradeDisconnection-correctly branch February 29, 2024 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants