Skip to content

Commit

Permalink
temp+fix: mark transactions as failed for cancelled / unknown smart t…
Browse files Browse the repository at this point in the history
…ransactions (#12664)

## **Description**
Resolves an issue with stuck transactions for some users who used smart
transactions, which was caused by having [this
PR](#12274) in the
7.36.0 release even when it was marked for 7.37.0 by metamaskbot.

## **Related issues**

Fixes:

## **Manual testing steps**

1. Cancelled transaction stuck thanks to super low gas settings
2. All other submitted transactions afterwards as well with the
invalid_nonce error.
3. Upgrade to 7.37.1 and see all cancelled tx
4. Try a new tx

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

https://consensys.slack.com/archives/C084S32G337/p1734034013370979

### **After**

https://consensys.slack.com/archives/C084S32G337/p1734039388196979

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
runway-github[bot] authored Dec 20, 2024
1 parent ea18201 commit 5f06d40
Show file tree
Hide file tree
Showing 61 changed files with 1,557 additions and 269 deletions.
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,80 @@

## Current Main Branch

## 7.37.1 - Dec 12, 2024
### Added
- [#12427](https://github.com/MetaMask/metamask-mobile/pull/12427): feat: implement remote feature flag controller (#12427)
- [#12650](https://github.com/MetaMask/metamask-mobile/pull/12650): fix: fix swaps button on asset overview page for multichain feature (#12650)
- [#12507](https://github.com/MetaMask/metamask-mobile/pull/12507): feat: activate portfolio view (#12507)
- [#12540](https://github.com/MetaMask/metamask-mobile/pull/12540): feat: migrate Base network RPC from https://mainnet.base.org to base-… (#12540)
- [#12505](https://github.com/MetaMask/metamask-mobile/pull/12505): feat: add aggregated portfolio balance cross chains (#12505)
- [#12417](https://github.com/MetaMask/metamask-mobile/pull/12417): feat: multichain detect tokens feat (#12417)
- [#12490](https://github.com/MetaMask/metamask-mobile/pull/12490): feat: 7.37.0 (#12490)
- [#12419](https://github.com/MetaMask/metamask-mobile/pull/12419): feat: upgrade transaction controller to get incoming transactions using accounts API (#12419)
- [#12537](https://github.com/MetaMask/metamask-mobile/pull/12537): feat: enable ledger clear signing feature (#12537)
- [#12622](https://github.com/MetaMask/metamask-mobile/pull/12622): feat: Hide the smart transaction status page if we return a txHash asap (#12622)
- [#12623](https://github.com/MetaMask/metamask-mobile/pull/12623): chore: update bug template to include feature branches (#12623)
- [#12244](https://github.com/MetaMask/metamask-mobile/pull/12244): feat(ci): Expo (#12244)
- [#12459](https://github.com/MetaMask/metamask-mobile/pull/12459): feat: upgrade profile-sync-controller to 1.0.0 (#12459)
- [#12294](https://github.com/MetaMask/metamask-mobile/pull/12294): feat: Add Bitcoin accounts (Flask Only) (#12294)
- [#12243](https://github.com/MetaMask/metamask-mobile/pull/12243): feat: cicd e2e label requirements + pr automation (#12243)
- [#12495](https://github.com/MetaMask/metamask-mobile/pull/12495): feat: Support gas fee flows in swaps (#12495)
- [#12431](https://github.com/MetaMask/metamask-mobile/pull/12431): feat: multi chain asset list (#12431)

### Changed
- [#12538](https://github.com/MetaMask/metamask-mobile/pull/12538): chore: Chore/12435 mvp handle engine does not exist (#12538)
- [#12617](https://github.com/MetaMask/metamask-mobile/pull/12617): docs: Update README.md with new expo instructions (#12617)
- [#12559](https://github.com/MetaMask/metamask-mobile/pull/12559): test: move remaining modal pages and selectors to their respective folders (#12559)
- [#12556](https://github.com/MetaMask/metamask-mobile/pull/12556): test: remove redundent tests in quarantine folder (#12556)
- [#12558](https://github.com/MetaMask/metamask-mobile/pull/12558): test: Create e2e tag for multi chain (#12558)
- [#12531](https://github.com/MetaMask/metamask-mobile/pull/12531): test: Move files to Wallet folder (#12531)
- [#12511](https://github.com/MetaMask/metamask-mobile/pull/12511): test: Move files to Onboarding folder (#12511)
- [#12512](https://github.com/MetaMask/metamask-mobile/pull/12512): test: address regression pipeline slow down (#12512)
- [#12513](https://github.com/MetaMask/metamask-mobile/pull/12513): ci: disable security e2e tests (#12513)
- [#12491](https://github.com/MetaMask/metamask-mobile/pull/12491): chore: chore/7.37.0-Changelog (#12491)
- [#12602](https://github.com/MetaMask/metamask-mobile/pull/12602): chore: Additional e2e test to support `PortfolioView` (#12602)
- [#12321](https://github.com/MetaMask/metamask-mobile/pull/12321): refactor: remove global network from transaction controller (#12321)
- [#12536](https://github.com/MetaMask/metamask-mobile/pull/12536): test: fix mock server (#12536)
- [#12288](https://github.com/MetaMask/metamask-mobile/pull/12288): test: add e2e test for security alert api (#12288)
- [#12597](https://github.com/MetaMask/metamask-mobile/pull/12597): test(3615): additional e2e scenarios editing permissions and non permitted networks (#12597)
- [#12488](https://github.com/MetaMask/metamask-mobile/pull/12488): test(3615): add new e2e test for initial dapp connection and non permitted flow (#12488)
- [#12532](https://github.com/MetaMask/metamask-mobile/pull/12532): refactor: de-anonymize insensitive properties of swaps events (#12532)
- [#12485](https://github.com/MetaMask/metamask-mobile/pull/12485): chore: Stop suppressing pod install failures (#12485)
- [#12574](https://github.com/MetaMask/metamask-mobile/pull/12574): chore: Add option to skip pod install setup step (#12574)
- [#12609](https://github.com/MetaMask/metamask-mobile/pull/12609): chore: update user storage E2E framework (#12609)
- [#12569](https://github.com/MetaMask/metamask-mobile/pull/12569): chore: transfer ownership of auth & profile sync E2E from notifications to identity (#12569)
- [#12534](https://github.com/MetaMask/metamask-mobile/pull/12534): chore: change ownership of profile sync from notifications to identity (#12534)
- [#12543](https://github.com/MetaMask/metamask-mobile/pull/12543): chore: Decrease hot and cold start app to wallet view time (#12543)
- [#12428](https://github.com/MetaMask/metamask-mobile/pull/12428): chore: Add eth hd keyring and key tree to decrease unlock time (#12428)
- [#12555](https://github.com/MetaMask/metamask-mobile/pull/12555): chore: Update accounts packages (#12555)
- [#12563](https://github.com/MetaMask/metamask-mobile/pull/12563): chore: cicd e2e hardening (#12563)
- [#12554](https://github.com/MetaMask/metamask-mobile/pull/12554): chore: fail status when on no labels for retro-label changes (#12554)
- [#12295](https://github.com/MetaMask/metamask-mobile/pull/12295): chore: use getShares contract method from stake-sdk for unstake all flow (#12295)
- [#12551](https://github.com/MetaMask/metamask-mobile/pull/12551): chore: Bump Snaps packages (#12551)

### Fixed
- [#12659](https://github.com/MetaMask/metamask-mobile/pull/12659): fix: fix token details navigation (#12659)
- [#12624](https://github.com/MetaMask/metamask-mobile/pull/12624): fix: add new translations (#12624)
- [#12373](https://github.com/MetaMask/metamask-mobile/pull/12373): fix: circular dependencies engine-network-handleNetworkSwitch (#12373)
- [#12663](https://github.com/MetaMask/metamask-mobile/pull/12663): fix: disable flaky tests on incoming-transactions.spec (#12663)
- [#12598](https://github.com/MetaMask/metamask-mobile/pull/12598): fix: disable mock poc test (#12598)
- [#12230](https://github.com/MetaMask/metamask-mobile/pull/12230): fix: Jest timer error in unit test (#12230)
- [#12626](https://github.com/MetaMask/metamask-mobile/pull/12626): fix: fix flaky test (#12626)
- [#12372](https://github.com/MetaMask/metamask-mobile/pull/12372): fix: abstract out circular dependencies between engine and networks util (#12372)
- [#12641](https://github.com/MetaMask/metamask-mobile/pull/12641): fix: fix network selector (#12641)
- [#12637](https://github.com/MetaMask/metamask-mobile/pull/12637): fix: fix native tokens filter when all networks is selected (#12637)
- [#12529](https://github.com/MetaMask/metamask-mobile/pull/12529): fix: fix NFTs disappearing after killing app (#12529)
- [#12562](https://github.com/MetaMask/metamask-mobile/pull/12562): fix: Move `AssetPollingProvider` from Root to Nav/Main/index.js (#12562)
- [#12607](https://github.com/MetaMask/metamask-mobile/pull/12607): fix: e2e regression gas api (#12607)
- [#12460](https://github.com/MetaMask/metamask-mobile/pull/12460): fix: add source when local PPOM fails (#12460)
- [#12199](https://github.com/MetaMask/metamask-mobile/pull/12199): fix: 10967 User able to add Ledger account with existing account name (#12199)
- [#12566](https://github.com/MetaMask/metamask-mobile/pull/12566): fix(12527): sdk connection with unknown url causes a bug (#12566)
- [#12405](https://github.com/MetaMask/metamask-mobile/pull/12405): fix(431-2): active network icon has too much margin and adding optional prop (#12405)
- [#12591](https://github.com/MetaMask/metamask-mobile/pull/12591): fix: add resolution for express to fix failing audit on path-to-regexp (#12591)
- [#12567](https://github.com/MetaMask/metamask-mobile/pull/12567): fix: update input handling in useInputHandler to support BACK key functionality (#12567)
- [#12630](https://github.com/MetaMask/metamask-mobile/pull/12630): fix: hide tokens without balance for multichain (#12630)


## 7.37.0 - Nov 28, 2024
### Added
- [#12091](https://github.com/MetaMask/metamask-mobile/pull/12091): feat: 2020 Add a performance test for iOS in Bitrise (#12091)
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ android {
applicationId "io.metamask"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName "7.37.0"
versionCode 1512
versionName "7.38.0"
versionCode 1521
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy 'react-native-camera', 'general'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
8 changes: 7 additions & 1 deletion app/components/UI/Tokens/TokenList/TokenListFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
import {
selectChainId,
selectIsAllNetworks,
selectIsPopularNetwork,
} from '../../../../../selectors/networkController';
import { TokenI } from '../../types';
import { selectUseTokenDetection } from '../../../../../selectors/preferencesController';
Expand All @@ -48,12 +49,15 @@ const getDetectedTokensCount = (
isAllNetworksSelected: boolean,
allTokens: TokenI[],
filteredTokens: TokenI[] | undefined,
isPopularNetworks: boolean,
): number => {
if (!isPortfolioEnabled) {
return filteredTokens?.length ?? 0;
}

return isAllNetworksSelected ? allTokens.length : filteredTokens?.length ?? 0;
return isAllNetworksSelected && isPopularNetworks
? allTokens.length
: filteredTokens?.length ?? 0;
};

export const TokenListFooter = ({
Expand All @@ -75,6 +79,7 @@ export const TokenListFooter = ({
const isTokenDetectionEnabled = useSelector(selectUseTokenDetection);
const chainId = useSelector(selectChainId);
const isAllNetworks = useSelector(selectIsAllNetworks);
const isPopularNetworks = useSelector(selectIsPopularNetwork);

const styles = createStyles(colors);

Expand Down Expand Up @@ -103,6 +108,7 @@ export const TokenListFooter = ({
isAllNetworks,
allDetectedTokens,
detectedTokens,
isPopularNetworks,
);

const areTokensDetected = tokenCount > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TokenFilterBottomSheet } from './TokenFilterBottomSheet';
import { useSelector } from 'react-redux';
import Engine from '../../../../core/Engine';
import {
selectAllPopularNetworkConfigurations,
selectChainId,
selectNetworkConfigurations,
} from '../../../../selectors/networkController';
Expand Down Expand Up @@ -102,6 +103,8 @@ describe('TokenFilterBottomSheet', () => {
return {}; // default to show all networks
} else if (selector === selectNetworkConfigurations) {
return mockNetworks; // default to show all networks
} else if (selector === selectAllPopularNetworkConfigurations) {
return mockNetworks; // default to show all networks
}
return null;
});
Expand All @@ -114,14 +117,14 @@ describe('TokenFilterBottomSheet', () => {
it('renders correctly with the default option (All Networks) selected', () => {
const { queryByText } = render(<TokenFilterBottomSheet />);

expect(queryByText('All Networks')).toBeTruthy();
expect(queryByText('Popular networks')).toBeTruthy();
expect(queryByText('Current Network')).toBeTruthy();
});

it('sets filter to All Networks and closes bottom sheet when first option is pressed', async () => {
const { queryByText } = render(<TokenFilterBottomSheet />);

fireEvent.press(queryByText('All Networks'));
fireEvent.press(queryByText('Popular networks'));

await waitFor(() => {
expect(
Expand Down Expand Up @@ -152,6 +155,8 @@ describe('TokenFilterBottomSheet', () => {
return { '0x1': true }; // filter by current network
} else if (selector === selectNetworkConfigurations) {
return mockNetworks;
} else if (selector === selectAllPopularNetworkConfigurations) {
return mockNetworks;
}
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useRef, useMemo } from 'react';
import { useSelector } from 'react-redux';
import {
selectChainId,
selectNetworkConfigurations,
selectIsAllNetworks,
selectAllPopularNetworkConfigurations,
} from '../../../../selectors/networkController';
import { selectTokenNetworkFilter } from '../../../../selectors/preferencesController';
import BottomSheet, {
Expand All @@ -29,7 +29,7 @@ enum FilterOption {

const TokenFilterBottomSheet = () => {
const sheetRef = useRef<BottomSheetRef>(null);
const allNetworks = useSelector(selectNetworkConfigurations);
const allNetworks = useSelector(selectAllPopularNetworkConfigurations);
const { colors } = useTheme();
const styles = createStyles(colors);

Expand Down Expand Up @@ -79,7 +79,9 @@ const TokenFilterBottomSheet = () => {
verticalAlignment={VerticalAlignment.Center}
>
<Text style={styles.bottomSheetText}>
{strings('wallet.all_networks')}
{`${strings('app_settings.popular')} ${strings(
'app_settings.networks',
)}`}
</Text>
</ListItemSelect>
<ListItemSelect
Expand Down
2 changes: 1 addition & 1 deletion app/components/UI/Tokens/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ exports[`Tokens Portfolio View should match the snapshot when portfolio view is
}
}
>
All Networks
Ethereum Main Network
</Text>
<SvgMock
color="#141618"
Expand Down
32 changes: 16 additions & 16 deletions app/components/UI/Tokens/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useState, LegacyRef, useMemo, useEffect } from 'react';
import React, { useRef, useState, LegacyRef, useMemo } from 'react';
import { Hex } from '@metamask/utils';
import { View, Text } from 'react-native';
import ActionSheet from '@metamask/react-native-actionsheet';
Expand All @@ -15,6 +15,7 @@ import Logger from '../../../util/Logger';
import {
selectChainId,
selectIsAllNetworks,
selectIsPopularNetwork,
selectNetworkConfigurations,
} from '../../../selectors/networkController';
import {
Expand Down Expand Up @@ -138,10 +139,15 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {
const multiChainMarketData = useSelector(selectTokenMarketData);
const multiChainTokenBalance = useSelector(selectTokensBalances);
const multiChainCurrencyRates = useSelector(selectCurrencyRates);
const isPopularNetwork = useSelector(selectIsPopularNetwork);

const styles = createStyles(colors);

const tokensList = useMemo((): TokenI[] => {
// if it is not popular network, display tokens only for current network
const filteredAssetsParam = isPopularNetwork
? tokenNetworkFilter
: { [currentChainId]: true };
if (isPortfolioViewEnabled()) {
// MultiChain implementation
const allTokens = Object.values(
Expand Down Expand Up @@ -183,7 +189,7 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {
const filteredAssets = filterAssets(tokensToDisplay, [
{
key: 'chainId',
opts: tokenNetworkFilter,
opts: filteredAssetsParam,
filterCallback: 'inclusive',
},
]);
Expand Down Expand Up @@ -289,6 +295,7 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {
tokens,
// Dependencies for multichain implementation
selectedAccountTokensChains,
isPopularNetwork,
tokenNetworkFilter,
currentChainId,
multiChainCurrencyRates,
Expand Down Expand Up @@ -404,15 +411,6 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {
const onActionSheetPress = (index: number) =>
index === 0 ? removeToken() : null;

useEffect(() => {
const { PreferencesController } = Engine.context;
if (isTestNet(currentChainId)) {
PreferencesController.setTokenNetworkFilter({
[currentChainId]: true,
});
}
}, [currentChainId]);

return (
<View
style={styles.wrapper}
Expand All @@ -425,20 +423,22 @@ const Tokens: React.FC<TokensI> = ({ tokens }) => {
testID={WalletViewSelectorsIDs.TOKEN_NETWORK_FILTER}
label={
<Text style={styles.controlButtonText} numberOfLines={1}>
{isAllNetworks
? strings('wallet.all_networks')
{isAllNetworks && isPopularNetwork
? `${strings('app_settings.popular')} ${strings(
'app_settings.networks',
)}`
: networkName ?? strings('wallet.current_network')}
</Text>
}
isDisabled={isTestNet(currentChainId)}
isDisabled={isTestNet(currentChainId) || !isPopularNetwork}
onPress={showFilterControls}
endIconName={IconName.ArrowDown}
style={
isTestNet(currentChainId)
isTestNet(currentChainId) || !isPopularNetwork
? styles.controlButtonDisabled
: styles.controlButton
}
disabled={isTestNet(currentChainId)}
disabled={isTestNet(currentChainId) || !isPopularNetwork}
/>
<View style={styles.controlButtonInnerWrapper}>
<ButtonIcon
Expand Down
39 changes: 39 additions & 0 deletions app/components/Views/Asset/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Asset should not display swaps button if the asset is not allowed 1`] = `
<View
style={
{
"backgroundColor": "#ffffff",
"flex": 1,
}
}
>
<View
style={
{
"backgroundColor": "#ffffff",
"flex": 1,
}
}
>
<View
style={
{
"alignItems": "center",
"justifyContent": "center",
"paddingBottom": 24,
}
}
>
<ActivityIndicator
size="small"
style={
{
"alignSelf": "center",
}
}
/>
</View>
</View>
</View>
`;

exports[`Asset should render correctly 1`] = `
<View
style={
Expand Down
Loading

0 comments on commit 5f06d40

Please sign in to comment.