Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

refactor: use TxModalWrapper in ApproveTxModal #3369

Merged
merged 6 commits into from
Feb 1, 2022
Merged

Conversation

katspaugh
Copy link
Member

@katspaugh katspaugh commented Jan 25, 2022

Builds on top of #3297.

ApproveTxModal is very similar to all other modals but needed a few extra props to be passed to TxModalWrapper.

useCanTxExecute

I've reverted parts of #3257.

Namely, the logic that checks the nonce. It caused bugs and was triggered for just 1/1 Safes anyway, so practically useless.

The new logic is that it only checks that either a) there are enough sigs b) there's one sig missing but an owner is executing the tx.

Behavior before this change:
If an owner of a 1/1 safe creates a tx with the nonce out of order, execution checkbox won't be shown.

After this change:
Checkbox is always shown but tx will be put to the queue if nonce is not the current safe nonce.

Nothing changes for n/n+m Safes.

Links

Refactoring rationale and a UI flow diagram: https://kinopio.club/refactoring-tx-modals-SoJbXclHVCFNCK2R36Jsi

@github-actions
Copy link

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Jan 25, 2022

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 1 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@katspaugh katspaugh marked this pull request as draft January 25, 2022 13:22
@github-actions
Copy link

Deployment links

🟠 Rinkeby Mainnet 🟣 Polygon 🟡 BSC Arbitrum 🟢 Gnosis Chain

@github-actions
Copy link

github-actions bot commented Jan 25, 2022

E2E Tests Failed
Check the results here: https://github.com/gnosis/safe-react-e2e-tests/actions/runs/1773221967

Failed tests:

  • ❌ Read-only transaction creation and review Read-only transaction creation and review

Copy link
Member

@iamacook iamacook left a comment

Choose a reason for hiding this comment

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

It's great to see how much code has been removed but I'm cautious of how much state you've removed. I think @DiogoSoaress will give a better insight than me.

@katspaugh katspaugh closed this Jan 25, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jan 25, 2022
@katspaugh katspaugh reopened this Jan 26, 2022
@katspaugh katspaugh force-pushed the approve-modal branch 2 times, most recently from e18204a to d79b192 Compare January 26, 2022 05:36
@katspaugh katspaugh marked this pull request as ready for review January 26, 2022 05:43
@5afe 5afe unlocked this conversation Jan 26, 2022
Copy link
Member

@iamacook iamacook left a comment

Choose a reason for hiding this comment

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

This looks good to me now but I would wait to see if @DiogoSoaress agrees

Base automatically changed from max-fee to dev January 26, 2022 10:15
PR comments

Show only nonce when creating a multisig tx

Revert parametersStatus changes

Partially revert #3257 (it was buggy)

Rm snackbar

Onchain sig or execution
@coveralls
Copy link

coveralls commented Jan 26, 2022

Pull Request Test Coverage Report for Build 1773186236

  • 20 of 27 (74.07%) changed or added relevant lines in 7 files are covered.
  • 96 unchanged lines in 10 files lost coverage.
  • Overall coverage increased (+0.06%) to 33.69%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/logic/hooks/useEstimateTransactionGas.tsx 1 2 50.0%
src/routes/safe/components/Transactions/helpers/TxParametersDetail/index.tsx 1 2 50.0%
src/routes/safe/components/Transactions/TxList/modals/ApproveTxModal.tsx 1 6 16.67%
Files with Coverage Reduction New Missed Lines %
src/logic/hooks/useEstimateTransactionGas.tsx 1 20.54%
src/routes/safe/components/Transactions/helpers/TxModalWrapper/index.tsx 1 53.92%
src/routes/safe/components/Transactions/TxList/ActionModal.tsx 1 5.56%
src/routes/safe/components/Transactions/TxList/TxCollapsed.tsx 1 6.0%
src/routes/safe/components/Transactions/TxList/modals/ApproveTxModal.tsx 2 4.46%
src/routes/safe/components/Transactions/TxList/hooks/useTransactionStatus.ts 3 2.86%
src/logic/hooks/useGetRecommendedNonce.tsx 12 5.0%
src/logic/wallets/getWeb3.ts 18 55.45%
src/logic/safe/store/middleware/notificationsMiddleware.ts 28 30.48%
src/logic/safe/store/actions/createTransaction.ts 29 2.99%
Totals Coverage Status
Change from base Build 1750232774: 0.06%
Covered Lines: 3171
Relevant Lines: 8448

💛 - Coveralls

Copy link
Member

@DiogoSoaress DiogoSoaress left a comment

Choose a reason for hiding this comment

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

👍
One Modal (wrapper) to rule them all.

Copy link
Member

@usame-algan usame-algan left a comment

Choose a reason for hiding this comment

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

LGTM!

@francovenica

This comment has been minimized.

@francovenica
Copy link
Contributor

In a safe 3/x I try to do the last signature to execute the tx, but I get the error that the of "invalid owner provided" even tho I'm connected with an owner of the safe

The safe: https://pr3369--safereact.review-safe.gnosisdev.com/app/rin:0x37A53791b3667c803318D083D339C236781D57D1/transactions/queue
The owner: rin:0xFD71c1ABadBD37F60E4C8F208386dDFC4d2Bf01f

image

@katspaugh
Copy link
Member Author

katspaugh commented Jan 28, 2022

@francovenica you sure those things wouldn't happen on dev?

@francovenica
Copy link
Contributor

The issue with the tx to upgrade the safe is only happening in this PR
01-28-2022_x(4063)

I'll leave the safe in that state with the tx fully signed. you can try to execute it if you want
rin:0x51c125bb0D2FB3394129e4AAa97BbF91e737d9b2

@francovenica
Copy link
Contributor

In a safe 3/x I try to do the last signature to execute the tx, but I get the error that the of "invalid owner provided" even tho I'm connected with an owner of the safe

The safe: https://pr3369--safereact.review-safe.gnosisdev.com/app/rin:0x37A53791b3667c803318D083D339C236781D57D1/transactions/queue The owner: rin:0xFD71c1ABadBD37F60E4C8F208386dDFC4d2Bf01f

This one also only happens in this PR, in dev I don't get the "Invalid owner provided" when I try to confirm with the last owner.
I can make you owner of this safe if you want to try it on your own.

@francovenica
Copy link
Contributor

The issue in the tx builder, of queuing several tx and getting the warning message yes, that one also happens in dev. I'll report it separately

@katspaugh
Copy link
Member Author

@francovenica Diogo and I have fixed the two bugs you found. The root cause was we forgot to pass safeTxGas, so it was 0.

@francovenica
Copy link
Contributor

Both issues were fixed

  • I don't get the warning message for the upgrade safe tx anymore
  • I don't get the warning of "invalid owner" owner anymore.

Looks good to me

@katspaugh katspaugh merged commit f426b05 into dev Feb 1, 2022
@katspaugh katspaugh deleted the approve-modal branch February 1, 2022 08:23
@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2022
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.

None yet

6 participants