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

Confirm only a tx that wasn't already confirmed #301

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

dan437
Copy link
Collaborator

@dan437 dan437 commented Mar 19, 2024

Description

When used outside of Swaps, the TransactionController usually confirms completed smart transactions, unless a user closes a browser before a smart transaction is completed. We only want to call the confirmExternalTransaction function if a transaction wasn't already confirmed.

@dan437 dan437 requested a review from a team as a code owner March 19, 2024 14:20
Copy link

socket-security bot commented Mar 19, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@ethersproject/[email protected] None 0 498 kB ricmoo
npm/@ethersproject/[email protected] None 0 61 kB ricmoo
npm/@ethersproject/[email protected] None 0 82.2 kB ricmoo
npm/@ethersproject/[email protected] None 0 33.1 kB ricmoo
npm/@ethersproject/[email protected] None 0 11.3 kB ricmoo
npm/@ethersproject/[email protected] None 0 30.1 kB ricmoo
npm/@ethersproject/[email protected] None 0 143 kB ricmoo
npm/@ethersproject/[email protected] None 0 18.7 kB ricmoo
npm/@ethersproject/[email protected] None 0 257 kB ricmoo
npm/@ethersproject/[email protected] None 0 6.09 kB ricmoo
npm/@ethersproject/[email protected] None 0 47.5 kB ricmoo
npm/@ethersproject/[email protected] None 0 31 kB ricmoo
npm/@ethersproject/[email protected] network +1 1.32 MB ricmoo
npm/@ethersproject/[email protected] None 0 17.3 kB ricmoo
npm/@ethersproject/[email protected] None 0 29.6 kB ricmoo
npm/@ethersproject/[email protected] None 0 21.7 kB ricmoo
npm/@ethersproject/[email protected] None 0 244 kB ricmoo
npm/@ethersproject/[email protected] None 0 119 kB ricmoo
npm/@ethersproject/[email protected] None 0 89.6 kB ricmoo
npm/@ethersproject/[email protected] network 0 128 kB ricmoo
npm/@metamask/[email protected] None +1 518 kB metamaskbot
npm/@metamask/[email protected] None +1 850 kB lgbot
npm/@metamask/[email protected] None 0 77.3 kB lgbot
npm/@metamask/[email protected] None 0 592 kB lgbot
npm/@metamask/[email protected] None 0 616 kB lgbot
npm/@metamask/[email protected] None 0 86.8 kB metamaskbot
npm/@metamask/[email protected] None 0 228 kB lgbot
npm/@metamask/[email protected] Transitive: environment, network +5 1.33 MB metamaskbot
npm/@metamask/[email protected] None 0 180 kB mcmire
npm/@metamask/[email protected] network +2 2.12 MB metamaskbot
npm/@types/[email protected] None 0 13.8 kB types
npm/[email protected] None 0 9.98 kB junderw
npm/[email protected] None 0 12.7 kB lgbot
npm/[email protected] None +2 2.18 MB silentcicero
npm/[email protected] None 0 24.7 kB silentcicero
npm/[email protected] None 0 2.22 kB sindresorhus
npm/[email protected] None 0 52.9 kB emn178
npm/[email protected] None 0 24.4 kB ai
npm/[email protected] None +1 73.8 kB metamaskbot
npm/[email protected] None 0 429 kB silentcicero
npm/[email protected] None 0 2.94 kB stevemao
npm/[email protected] None 0 1.4 kB sindresorhus

🚮 Removed packages: npm/@types/[email protected]

View full report↗︎

src/SmartTransactionsController.ts Outdated Show resolved Hide resolved
src/SmartTransactionsController.ts Show resolved Hide resolved
@dan437 dan437 force-pushed the confirm-only-unconfirmed-tx branch from 8d28dff to 1c1b657 Compare March 19, 2024 15:16
infiniteflower
infiniteflower previously approved these changes Mar 19, 2024
Copy link

socket-security bot commented Mar 20, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSource
New author npm/[email protected]
Network access npm/@ethersproject/[email protected]
Network access npm/@ethersproject/[email protected]
Network access npm/@ethersproject/[email protected]
Network access npm/@ethersproject/[email protected]
Unstable ownership npm/@metamask/[email protected]
Network access npm/@metamask/[email protected]

View full report↗︎

Next steps

What is new author?

A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.

Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

What is unstable ownership?

A new collaborator has begun publishing package versions. Package stability and security risk may be elevated.

Try to reduce the amount of authors you depend on to reduce the risk to malicious actors gaining access to your supply chain. Packages should remove inactive collaborators with publishing rights from packages on npm.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@@ -126,6 +136,7 @@ export default class SmartTransactionsController extends StaticIntervalPollingCo
getNonceLock: any;
provider: Provider;
confirmExternalTransaction: any;
getTransactions: any;
Copy link
Contributor

@infiniteflower infiniteflower Mar 20, 2024

Choose a reason for hiding this comment

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

Can we make this type the same as this.getRegularTransactions, if they are indeed the same type?

@dan437 dan437 force-pushed the confirm-only-unconfirmed-tx branch from f2d7638 to b90d084 Compare March 26, 2024 15:58
Add "getTransactions" to a test file

Update types

Update types

Update a test

Remove a comment

Refactor logic for checking a confirmed transaction

Update a condition

Update a check if a transaction needs confirmation

Add a check

Update type for "minedHash", refactoring
@dan437 dan437 force-pushed the confirm-only-unconfirmed-tx branch from b90d084 to 56d6df3 Compare March 26, 2024 16:00
@dan437 dan437 merged commit 075e1a5 into main Mar 27, 2024
14 checks passed
@dan437 dan437 deleted the confirm-only-unconfirmed-tx branch March 27, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants