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

Fix: warn if tx was already signed by connected wallet #2322

Merged
merged 7 commits into from
Aug 2, 2023
Merged

Conversation

katspaugh
Copy link
Member

@katspaugh katspaugh commented Jul 28, 2023

What it solves

Resolves #2321

Technically, nothing bad will happen if you sign a tx with the same owner twice. It will just overwrite the first signature.
But still good to warn about that.

However, I would keep the Sign button enabled because there can be a situation when a tx is signed locally, but sending it to the backend failed. In this case signing again is helpful.

In addition to that, some small stylistic adjustments in the tx flow.

How this PR fixes it

Shows a warning is the tx has already been signed by the connect wallet.
Screenshot 2023-07-28 at 10 49 06

@github-actions
Copy link

github-actions bot commented Jul 28, 2023

Branch preview

✅ Deploy successful!

https://can_sign--walletweb.review-wallet-web.5afe.dev

@github-actions
Copy link

github-actions bot commented Jul 28, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@katspaugh katspaugh requested a review from iamacook July 28, 2023 10:54
Copy link
Member

@schmanu schmanu left a comment

Choose a reason for hiding this comment

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

I think there is no use-case in letting users double sign a tx. AFAIK we do not change the safe transaction object locally when signing. So it should only pickup the new signature when successfully proposed and updated in the queue.

@@ -64,6 +65,8 @@ const SignForm = ({

return (
<form onSubmit={handleSubmit}>
{hasSigned && <ErrorMessage level="warning">You have already signed this transaction.</ErrorMessage>}
Copy link
Member

Choose a reason for hiding this comment

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

Should we not move it into the CheckWallet component and add a new message there?

Copy link
Member Author

Choose a reason for hiding this comment

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

CheckWallet doesn't know anything about transactions, it only checks the wallet itself.

@katspaugh
Copy link
Member Author

AFAIK we do not change the safe transaction object locally when signing

We do, it's a destructive operation in the SDK. It mutates the signatures map.

@schmanu
Copy link
Member

schmanu commented Jul 31, 2023

We do, it's a destructive operation in the SDK. It mutates the signatures map.

Oh nevermind my comment then. I'll approve :)

@@ -1,5 +1,5 @@
.container {
margin-top: 42px;
margin-top: 10px;
Copy link
Member

Choose a reason for hiding this comment

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

The modal alignment no longer matches:

tx-modal-jump

src/components/tx/SignOrExecuteForm/hooks.ts Show resolved Hide resolved
iamacook and others added 4 commits July 31, 2023 12:47
* Fix: mobile pairing check (#2327)

* Fix: mobile pairing check

* Fix tests

* fix: align transaction links

---------

Co-authored-by: katspaugh <[email protected]>
@francovenica
Copy link
Contributor

Not a big fan of allowing the user to sign again, but if is not harmful and we all agree is fine, then is ok for me.
LGTM

@katspaugh katspaugh merged commit 657da0f into dev Aug 2, 2023
7 checks passed
@katspaugh katspaugh deleted the can-sign branch August 2, 2023 10:06
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tx flow] The same owner can sign tx a few times
4 participants