From ad2bcd7c88ef8c4c73e960894b77946181147285 Mon Sep 17 00:00:00 2001 From: Marko Bencun Date: Fri, 11 Oct 2024 09:38:14 +0200 Subject: [PATCH] ethereum: remove Goerli testnet Goerli testnet shut down April 2020. --- CHANGELOG.md | 1 + README.md | 2 -- backend/accounts.go | 8 +++----- backend/accounts_test.go | 4 +--- backend/backend.go | 7 ------- backend/backend_test.go | 1 - backend/coins/coin/codes.go | 3 --- backend/coins/eth/account_test.go | 2 +- backend/config/accounts_test.go | 2 +- backend/config/config.go | 2 +- backend/handlers/handlers.go | 2 -- backend/rates/gecko.go | 1 - backend/rates/rates.go | 4 +--- frontends/web/src/api/account.ts | 4 ++-- frontends/web/src/components/amount/amount.test.tsx | 2 +- frontends/web/src/components/icon/logo.tsx | 1 - frontends/web/src/routes/account/utils.ts | 3 +-- .../components/incoming-pairing/incoming-pairing.tsx | 2 +- frontends/web/src/utils/walletconnect.ts | 4 ---- 19 files changed, 14 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 318c7191f5..a3934ea6bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased - Android: enable export logs feature +- Remove support for deprecated the Ethereum Goerli network # 4.45.0 - Bundle BitBox02 firmware version v9.21.0 diff --git a/README.md b/README.md index dc8bcaf0a0..3528309dea 100644 --- a/README.md +++ b/README.md @@ -189,8 +189,6 @@ Get Bitcoin Testnet coins here: https://coinfaucet.eu/en/btc-testnet/ Get Litecoin Testnet coins here: https://tltc.bitaps.com/ -Get Ethereum Goerli coins here: https://goerlifaucet.com/ - Get Ethereum Sepolia coins here: https://faucet.sepolia.dev/ In case any of the Ethereum faucets are not working, you can try others from here: https://faucetlink.to (some require account creation) diff --git a/backend/accounts.go b/backend/accounts.go index a27089a6d6..bf83eabda8 100644 --- a/backend/accounts.go +++ b/backend/accounts.go @@ -117,8 +117,6 @@ func sortAccounts(accounts []accounts.Interface) { switch ethCoin.ChainID() { case params.MainnetChainConfig.ChainID.Uint64(): return 4, true - case params.GoerliChainConfig.ChainID.Uint64(): - return 5, true case params.SepoliaChainConfig.ChainID.Uint64(): return 6, true } @@ -204,7 +202,7 @@ func (backend *Backend) SupportedCoins(keystore keystore.Keystore) []coinpkg.Cod allCoins := []coinpkg.Code{ coinpkg.CodeBTC, coinpkg.CodeTBTC, coinpkg.CodeRBTC, coinpkg.CodeLTC, coinpkg.CodeTLTC, - coinpkg.CodeETH, coinpkg.CodeGOETH, coinpkg.CodeSEPETH, + coinpkg.CodeETH, coinpkg.CodeSEPETH, } var availableCoins []coinpkg.Code for _, coinCode := range allCoins { @@ -467,7 +465,7 @@ func (backend *Backend) createAndPersistAccountConfig( }, accountsConfig, ) - case coinpkg.CodeETH, coinpkg.CodeGOETH, coinpkg.CodeSEPETH: + case coinpkg.CodeETH, coinpkg.CodeSEPETH: bip44Coin := "1'" if coinCode == coinpkg.CodeETH { bip44Coin = "60'" @@ -1208,7 +1206,7 @@ func (backend *Backend) persistDefaultAccountConfigs(keystore keystore.Keystore, } } } else { - for _, coinCode := range []coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeGOETH, coinpkg.CodeSEPETH} { + for _, coinCode := range []coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeSEPETH} { if backend.config.AppConfig().Backend.DeprecatedCoinActive(coinCode) { if _, err := backend.createAndPersistAccountConfig( coinCode, 0, false, "", keystore, nil, accountsConfig); err != nil { diff --git a/backend/accounts_test.go b/backend/accounts_test.go index 795191fe81..10567cdfa7 100644 --- a/backend/accounts_test.go +++ b/backend/accounts_test.go @@ -171,7 +171,6 @@ func TestSortAccounts(t *testing.T) { {Code: "acct-btc-1", CoinCode: coinpkg.CodeBTC, SigningConfigurations: btcConfig("m/84'/0'/0'")}, {Code: "acct-btc-3", CoinCode: coinpkg.CodeBTC, SigningConfigurations: btcConfig("m/84'/0'/2'")}, {Code: "acct-btc-2", CoinCode: coinpkg.CodeBTC, SigningConfigurations: btcConfig("m/84'/0'/1'")}, - {Code: "acct-goeth", CoinCode: coinpkg.CodeGOETH}, {Code: "acct-sepeth", CoinCode: coinpkg.CodeSEPETH}, {Code: "acct-ltc", CoinCode: coinpkg.CodeLTC}, {Code: "acct-tltc", CoinCode: coinpkg.CodeTLTC}, @@ -195,7 +194,6 @@ func TestSortAccounts(t *testing.T) { "acct-eth-2", "acct-eth-2-eth-erc20-bat", "acct-eth-2-eth-erc20-usdt", - "acct-goeth", "acct-sepeth", } @@ -312,7 +310,7 @@ func TestSupportedCoins(t *testing.T) { b := newBackend(t, testnetEnabled, regtestDisabled) defer b.Close() require.Equal(t, - []coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeGOETH, coinpkg.CodeSEPETH}, + []coinpkg.Code{coinpkg.CodeTBTC, coinpkg.CodeTLTC, coinpkg.CodeSEPETH}, b.SupportedCoins(&keystoremock.KeystoreMock{ SupportsCoinFunc: func(coin coinpkg.Coin) bool { return true diff --git a/backend/backend.go b/backend/backend.go index 4e1ce4293b..254ec46a7a 100644 --- a/backend/backend.go +++ b/backend/backend.go @@ -77,7 +77,6 @@ var fixedURLWhitelist = []string{ "https://sochain.com/tx/LTCTEST/", "https://blockchair.com/litecoin/transaction/", "https://etherscan.io/tx/", - "https://goerli.etherscan.io/tx/", "https://sepolia.etherscan.io/tx/", // Moonpay onramp "https://www.moonpay.com/", @@ -511,12 +510,6 @@ func (backend *Backend) Coin(code coinpkg.Code) (coinpkg.Coin, error) { "https://etherscan.io/tx/", etherScan, nil) - case code == coinpkg.CodeGOETH: - etherScan := etherscan.NewEtherScan("https://api-goerli.etherscan.io/api", backend.etherScanHTTPClient) - coin = eth.NewCoin(etherScan, code, "Ethereum Goerli", "GOETH", "GOETH", params.GoerliChainConfig, - "https://goerli.etherscan.io/tx/", - etherScan, - nil) case code == coinpkg.CodeSEPETH: etherScan := etherscan.NewEtherScan("https://api-sepolia.etherscan.io/api", backend.etherScanHTTPClient) coin = eth.NewCoin(etherScan, code, "Ethereum Sepolia", "SEPETH", "SEPETH", params.SepoliaChainConfig, diff --git a/backend/backend_test.go b/backend/backend_test.go index d518c7bc91..6cc19089be 100644 --- a/backend/backend_test.go +++ b/backend/backend_test.go @@ -294,7 +294,6 @@ func newBackend(t *testing.T, testing, regtest bool) *Backend { // avoid hitting real API for ETH coins. for _, code := range []coinpkg.Code{ coinpkg.CodeETH, - coinpkg.CodeGOETH, coinpkg.CodeSEPETH, } { c, err := b.Coin(code) diff --git a/backend/coins/coin/codes.go b/backend/coins/coin/codes.go index bd77f37363..a014102f8f 100644 --- a/backend/coins/coin/codes.go +++ b/backend/coins/coin/codes.go @@ -30,8 +30,6 @@ const ( CodeTLTC Code = "tltc" // CodeETH is Ethereum. CodeETH Code = "eth" - // CodeGOETH is Ethereum Goerli. - CodeGOETH Code = "goeth" // CodeSEPETH is Ethereum Sepolia. CodeSEPETH Code = "sepeth" // If you add coins, don't forget to update `testnetCoins` below. @@ -53,6 +51,5 @@ const ( var TestnetCoins = map[Code]struct{}{ CodeTBTC: {}, CodeTLTC: {}, - CodeGOETH: {}, CodeSEPETH: {}, } diff --git a/backend/coins/eth/account_test.go b/backend/coins/eth/account_test.go index ce3b610df3..5d1cf9c7cc 100644 --- a/backend/coins/eth/account_test.go +++ b/backend/coins/eth/account_test.go @@ -82,7 +82,7 @@ func newAccount(t *testing.T) *Account { return 0, nil }, } - coin := NewCoin(client, coin.CodeGOETH, "Goerli", "GOETH", "GOETH", params.GoerliChainConfig, "", nil, nil) + coin := NewCoin(client, coin.CodeSEPETH, "Sepolia", "SEPETH", "SEPETH", params.SepoliaChainConfig, "", nil, nil) acct := NewAccount( &accounts.AccountConfig{ Config: &config.Account{ diff --git a/backend/config/accounts_test.go b/backend/config/accounts_test.go index 1127d688be..555f16bd56 100644 --- a/backend/config/accounts_test.go +++ b/backend/config/accounts_test.go @@ -79,7 +79,7 @@ func TestLookupByXpub(t *testing.T) { func TestSetTokenActive(t *testing.T) { // not an ETH account. - require.Error(t, (&Account{CoinCode: coin.CodeGOETH}).SetTokenActive("TOKEN", true)) + require.Error(t, (&Account{CoinCode: coin.CodeSEPETH}).SetTokenActive("TOKEN", true)) acct := &Account{ CoinCode: coin.CodeETH, diff --git a/backend/config/config.go b/backend/config/config.go index 8ea963402e..2908ae116b 100644 --- a/backend/config/config.go +++ b/backend/config/config.go @@ -113,7 +113,7 @@ func (backend Backend) DeprecatedCoinActive(code coin.Code) bool { return backend.DeprecatedBitcoinActive case coin.CodeLTC, coin.CodeTLTC: return backend.DeprecatedLitecoinActive - case coin.CodeETH, coin.CodeGOETH, coin.CodeSEPETH: + case coin.CodeETH, coin.CodeSEPETH: return backend.DeprecatedEthereumActive default: panic(fmt.Sprintf("unknown code %s", code)) diff --git a/backend/handlers/handlers.go b/backend/handlers/handlers.go index 055716e02f..84bfb04603 100644 --- a/backend/handlers/handlers.go +++ b/backend/handlers/handlers.go @@ -1023,8 +1023,6 @@ func (handlers *Handlers) getConvertFromFiat(r *http.Request) interface{} { switch unit { // HACK: fake rates for testnet coins case "TBTC", "TLTC": unit = unit[1:] - case "GOETH": - unit = unit[2:] case "SEPETH": unit = unit[3:] } diff --git a/backend/rates/gecko.go b/backend/rates/gecko.go index b75d0376e2..dbf789e91b 100644 --- a/backend/rates/gecko.go +++ b/backend/rates/gecko.go @@ -45,7 +45,6 @@ var ( "tbtc": "bitcoin", "rbtc": "bitcoin", "tltc": "litecoin", - "goeth": "ethereum", "sepeth": "ethereum", // ERC20 tokens as used in the backend. // Frontend and app config use unprefixed name, without "eth-erc20-". diff --git a/backend/rates/rates.go b/backend/rates/rates.go index c73940536d..3f4811a029 100644 --- a/backend/rates/rates.go +++ b/backend/rates/rates.go @@ -336,10 +336,8 @@ func (updater *RateUpdater) updateLast(ctx context.Context) { rates[SAT.String()] = sat // Provide conversion rates for testnets as well, useful for testing. - for _, testnetUnit := range []string{"TBTC", "RBTC", "TLTC", "GOETH", "SEPETH"} { + for _, testnetUnit := range []string{"TBTC", "RBTC", "TLTC", "SEPETH"} { switch testnetUnit { - case "GOETH": - rates[testnetUnit] = rates[testnetUnit[2:]] case "SEPETH": rates[testnetUnit] = rates[testnetUnit[3:]] default: diff --git a/frontends/web/src/api/account.ts b/frontends/web/src/api/account.ts index a20c5c148e..be6540821f 100644 --- a/frontends/web/src/api/account.ts +++ b/frontends/web/src/api/account.ts @@ -20,7 +20,7 @@ import type { TDetailStatus } from './bitsurance'; import type { SuccessResponse } from './response'; import { Slip24 } from 'request-address'; -export type NativeCoinCode = 'btc' | 'tbtc' | 'rbtc' | 'ltc' | 'tltc' | 'eth' | 'goeth' | 'sepeth'; +export type NativeCoinCode = 'btc' | 'tbtc' | 'rbtc' | 'ltc' | 'tltc' | 'eth' | 'sepeth'; export type AccountCode = string; @@ -28,7 +28,7 @@ export type Fiat = 'AUD' | 'BRL' | 'BTC' | 'CAD' | 'CHF' | 'CNY' | 'CZK' | 'EUR' export type ConversionUnit = Fiat | 'sat' -export type CoinUnit = 'BTC' | 'sat' | 'LTC' | 'ETH' | 'TBTC' | 'tsat' | 'TLTC' | 'GOETH' | 'SEPETH'; +export type CoinUnit = 'BTC' | 'sat' | 'LTC' | 'ETH' | 'TBTC' | 'tsat' | 'TLTC' | 'SEPETH'; export type ERC20TokenUnit = 'USDT' | 'USDC' | 'LINK' | 'BAT' | 'MKR' | 'ZRX' | 'WBTC' | 'PAXG' | 'DAI'; diff --git a/frontends/web/src/components/amount/amount.test.tsx b/frontends/web/src/components/amount/amount.test.tsx index 0c15f27a08..c5c72ee137 100644 --- a/frontends/web/src/components/amount/amount.test.tsx +++ b/frontends/web/src/components/amount/amount.test.tsx @@ -236,7 +236,7 @@ describe('Amount formatting', () => { }); describe('non BTC coins amounts', () => { - let coins: CoinUnit[] = ['ETH', 'GOETH', 'SEPETH']; + let coins: CoinUnit[] = ['ETH', 'SEPETH']; coins.forEach(coin => { it('10.00000000 ' + coin + ' with removeBtcTrailingZeroes enabled stays 10.00000000', () => { const { container } = render(); diff --git a/frontends/web/src/components/icon/logo.tsx b/frontends/web/src/components/icon/logo.tsx index 9a719d73f9..38fb51dc17 100644 --- a/frontends/web/src/components/icon/logo.tsx +++ b/frontends/web/src/components/icon/logo.tsx @@ -82,7 +82,6 @@ const logoMap: LogoMap = { 'ltc': [LTC, LTC_GREY], 'tltc': [LTC, LTC_GREY], 'eth': [ETH, ETH_GREY], - 'goeth': [ETH, ETH_GREY], 'sepeth': [ETH, ETH_GREY], 'erc20Test': [ETH, ETH_GREY], diff --git a/frontends/web/src/routes/account/utils.ts b/frontends/web/src/routes/account/utils.ts index d5b12662b8..3b83b26de4 100644 --- a/frontends/web/src/routes/account/utils.ts +++ b/frontends/web/src/routes/account/utils.ts @@ -49,7 +49,7 @@ export const isBitcoinBased = (coinCode: CoinCode): boolean => { }; export const isEthereumBased = (coinCode: CoinCode): boolean => { - return coinCode === 'eth' || coinCode === 'goeth' || coinCode === 'sepeth' || coinCode.startsWith('eth-erc20-'); + return coinCode === 'eth' || coinCode === 'sepeth' || coinCode.startsWith('eth-erc20-'); }; export const getCoinCode = (coinCode: CoinCode): CoinCode | undefined => { @@ -61,7 +61,6 @@ export const getCoinCode = (coinCode: CoinCode): CoinCode | undefined => { case 'tltc': return 'ltc'; case 'eth': - case 'goeth': case 'sepeth': return 'eth'; } diff --git a/frontends/web/src/routes/account/walletconnect/components/incoming-pairing/incoming-pairing.tsx b/frontends/web/src/routes/account/walletconnect/components/incoming-pairing/incoming-pairing.tsx index 572322c146..d326971daf 100644 --- a/frontends/web/src/routes/account/walletconnect/components/incoming-pairing/incoming-pairing.tsx +++ b/frontends/web/src/routes/account/walletconnect/components/incoming-pairing/incoming-pairing.tsx @@ -102,7 +102,7 @@ export const WCIncomingPairing = ({ if (e.message.includes('Non conforming namespaces')) { alertUser(t('walletConnect.invalidPairingChain', { - chains: '\n•Ethereum \n•Ethereum (Goerli)' + chains: '\n•Ethereum' })); } else { //unexpected error, display native error message diff --git a/frontends/web/src/utils/walletconnect.ts b/frontends/web/src/utils/walletconnect.ts index 40a4bd4611..36d351ac5b 100644 --- a/frontends/web/src/utils/walletconnect.ts +++ b/frontends/web/src/utils/walletconnect.ts @@ -26,10 +26,6 @@ export const SUPPORTED_CHAINS: TSupportedChainDetail = { name: 'Etherum mainnet', icon: createElement(ETHLogo) }, - 'eip155:5': { - name: 'Ethereum goerli', - icon: createElement(ETHLogo) - }, }; export const EIP155_SIGNING_METHODS = {