Skip to content

Commit 8b45455

Browse files
committed
eth-testnets: add goerli and remove ropsten and rinkeby
Ropsten and Rinkeby ETH testnets are currently deprecated. This commit removes them from the code and introduces support to the Goerly testnet. Since the erc20 test token has been removed from the wallet-app in 4347b1, it is now removed here too.
1 parent eef2092 commit 8b45455

File tree

7 files changed

+26
-50
lines changed

7 files changed

+26
-50
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
88

99
### [Unreleased]
1010
- Bitcoin: warn if the transaction fee is higher than 10% of the coins sent
11+
- ETH Testnets: add Goerli and remove deprecated Rinkeby and Ropsten
1112

1213
### 9.13.0
1314
- Bitcoin: allow displaying BTC values in the 'sat' unit

src/apps/eth/eth_params.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@
1616

1717
#include <util.h>
1818

19-
static const app_eth_erc20_params_t _ropsten_erc20_params[] = {
20-
{
21-
.unit = "TEST",
22-
.contract_address =
23-
"\x2f\x45\xb6\xfb\x2f\x28\xa7\x3f\x11\x04\x00\x38\x6d\xa3\x10\x44\xb2\xe9\x53\xd4",
24-
.decimals = 18,
25-
},
26-
};
27-
2819
static const app_eth_erc20_params_t _ethereum_erc20_params[] = {
2920
{
3021
.unit = "1SG",
@@ -13904,22 +13895,12 @@ const app_eth_erc20_params_t* app_eth_erc20_params_get(
1390413895
uint64_t chain_id,
1390513896
const uint8_t* contract_address)
1390613897
{
13907-
const app_eth_erc20_params_t* erc20_params;
13908-
size_t len;
13909-
switch (chain_id) {
13910-
case 1:
13911-
erc20_params = _ethereum_erc20_params;
13912-
len = sizeof(_ethereum_erc20_params) / sizeof(app_eth_erc20_params_t);
13913-
break;
13914-
case 3:
13915-
erc20_params = _ropsten_erc20_params;
13916-
len = sizeof(_ropsten_erc20_params) / sizeof(app_eth_erc20_params_t);
13917-
break;
13918-
default:
13898+
if (chain_id != 1) {
1391913899
return NULL;
1392013900
}
13901+
size_t len = sizeof(_ethereum_erc20_params) / sizeof(app_eth_erc20_params_t);
1392113902
for (size_t index = 0; index < len; index++) {
13922-
const app_eth_erc20_params_t* params = &erc20_params[index];
13903+
const app_eth_erc20_params_t* params = &_ethereum_erc20_params[index];
1392313904
if (MEMEQ(contract_address, params->contract_address, sizeof(params->contract_address))) {
1392413905
return params;
1392513906
}

src/rust/bitbox02-rust/src/hww/api/ethereum/params.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,11 @@ const PARAMS: &[Params] = &[
4343
unit: "ETH",
4444
},
4545
Params {
46-
coin: Some(EthCoin::RopstenEth),
46+
coin: Some(EthCoin::GoerliEth),
4747
bip44_coin: 1 + HARDENED,
48-
chain_id: 3,
49-
name: "Ropsten",
50-
unit: "TETH",
51-
},
52-
Params {
53-
coin: Some(EthCoin::RinkebyEth),
54-
bip44_coin: 1 + HARDENED,
55-
chain_id: 4,
56-
name: "Rinkeby",
57-
unit: "TETH",
48+
chain_id: 5,
49+
name: "Goerli",
50+
unit: "GOETH",
5851
},
5952
Params {
6053
coin: None,
@@ -151,10 +144,8 @@ mod tests {
151144
pub fn test_get() {
152145
assert_eq!(get(EthCoin::Eth, 0).unwrap().name, "Ethereum");
153146
assert_eq!(get(EthCoin::Eth, 1).unwrap().name, "Ethereum");
154-
assert_eq!(get(EthCoin::RopstenEth, 0).unwrap().name, "Ropsten");
155-
assert_eq!(get(EthCoin::Eth, 3).unwrap().name, "Ropsten");
156-
assert_eq!(get(EthCoin::RinkebyEth, 0).unwrap().name, "Rinkeby");
157-
assert_eq!(get(EthCoin::Eth, 4).unwrap().name, "Rinkeby");
147+
assert_eq!(get(EthCoin::GoerliEth, 0).unwrap().name, "Goerli");
148+
assert_eq!(get(EthCoin::Eth, 5).unwrap().name, "Goerli");
158149
assert_eq!(get(EthCoin::Eth, 56).unwrap().name, "Binance Smart Chain");
159150

160151
// Unknown chain id.

src/rust/bitbox02-rust/src/hww/api/ethereum/pubrequest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,11 @@ mod tests {
210210
CONFIRM_COUNTER
211211
} {
212212
1 => {
213-
assert_eq!(params.title, "Ropsten");
213+
assert_eq!(params.title, "Goerli");
214214
assert_eq!(params.body, "Unusual keypath warning: m/44'/60'/0'/0/0. Proceed only if you know what you are doing.");
215215
}
216216
2 => {
217-
assert_eq!(params.title, "Ropsten");
217+
assert_eq!(params.title, "Goerli");
218218
assert_eq!(params.body, ADDRESS);
219219
}
220220
_ => panic!("too many user confirmations"),
@@ -228,7 +228,7 @@ mod tests {
228228
block_on(process(&pb::EthPubRequest {
229229
output_type: OutputType::Address as _,
230230
keypath: [44 + HARDENED, 60 + HARDENED, 0 + HARDENED, 0, 0].to_vec(),
231-
coin: pb::EthCoin::RopstenEth as _,
231+
coin: pb::EthCoin::GoerliEth as _,
232232
display: true,
233233
contract_address: b"".to_vec(),
234234
chain_id: 0,

src/rust/bitbox02-rust/src/hww/api/ethereum/sign.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ mod tests {
384384
);
385385
}
386386

387-
/// Standard ETH transaction on an unusual keypath (Ropsten on mainnet keypath)
387+
/// Standard ETH transaction on an unusual keypath (Goerly on mainnet keypath)
388388
#[test]
389389
pub fn test_process_warn_unusual_keypath() {
390390
const KEYPATH: &[u32] = &[44 + HARDENED, 60 + HARDENED, 0 + HARDENED, 0, 0];
@@ -397,21 +397,21 @@ mod tests {
397397
CONFIRM_COUNTER
398398
} {
399399
1 => {
400-
assert_eq!(params.title, "Ropsten");
400+
assert_eq!(params.title, "Goerli");
401401
assert_eq!(params.body, "Unusual keypath warning: m/44'/60'/0'/0/0. Proceed only if you know what you are doing.");
402402
true
403403
}
404404
_ => panic!("too many user confirmations"),
405405
}
406406
})),
407407
ui_transaction_address_create: Some(Box::new(|amount, address| {
408-
assert_eq!(amount, "0.530564 TETH");
408+
assert_eq!(amount, "0.530564 GOETH");
409409
assert_eq!(address, "0x04F264Cf34440313B4A0192A352814FBe927b885");
410410
true
411411
})),
412412
ui_transaction_fee_create: Some(Box::new(|total, fee, longtouch| {
413-
assert_eq!(total, "0.53069 TETH");
414-
assert_eq!(fee, "0.000126 TETH");
413+
assert_eq!(total, "0.53069 GOETH");
414+
assert_eq!(fee, "0.000126 GOETH");
415415
assert!(longtouch);
416416
true
417417
})),
@@ -420,7 +420,7 @@ mod tests {
420420
mock_unlocked();
421421

422422
block_on(process(&pb::EthSignRequest {
423-
coin: pb::EthCoin::RopstenEth as _,
423+
coin: pb::EthCoin::GoerliEth as _,
424424
keypath: KEYPATH.to_vec(),
425425
nonce: b"\x1f\xdc".to_vec(),
426426
gas_price: b"\x01\x65\xa0\xbc\x00".to_vec(),
@@ -515,7 +515,7 @@ mod tests {
515515
mock_unlocked();
516516
assert_eq!(
517517
block_on(process(&pb::EthSignRequest {
518-
coin: pb::EthCoin::RinkebyEth as _, // ignored because chain_id > 0
518+
coin: pb::EthCoin::GoerliEth as _, // ignored because chain_id > 0
519519
keypath: KEYPATH.to_vec(),
520520
nonce: b"\x23\x67".to_vec(),
521521
gas_price: b"\x02\x7a\xca\x1a\x80".to_vec(),

src/rust/bitbox02-rust/src/hww/api/ethereum/signmsg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ mod tests {
157157
CONFIRM_COUNTER
158158
} {
159159
1 => {
160-
assert_eq!(params.title, "Ropsten");
160+
assert_eq!(params.title, "Goerli");
161161
assert_eq!(params.body, "Unusual keypath warning: m/44'/60'/0'/0/0. Proceed only if you know what you are doing.");
162162
true
163163
}
164164
2 => {
165-
assert_eq!(params.title, "Ropsten");
165+
assert_eq!(params.title, "Goerli");
166166
assert_eq!(params.body, EXPECTED_ADDRESS);
167167
true
168168
}
@@ -178,7 +178,7 @@ mod tests {
178178
});
179179
mock_unlocked();
180180
block_on(process(&pb::EthSignMessageRequest {
181-
coin: pb::EthCoin::RopstenEth as _,
181+
coin: pb::EthCoin::GoerliEth as _,
182182
keypath: KEYPATH.to_vec(),
183183
msg: MESSAGE.to_vec(),
184184
host_nonce_commitment: None,

src/rust/bitbox02-rust/src/shiftcrypto.bitbox02.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,11 @@ pub mod eth_response {
912912
#[repr(i32)]
913913
pub enum EthCoin {
914914
Eth = 0,
915+
// Removed in v9.14.0 - deprecated
915916
RopstenEth = 1,
917+
// Removed in v9.14.0 - deprecated
916918
RinkebyEth = 2,
919+
GoerliEth = 3,
917920
}
918921
#[derive(Clone, PartialEq, ::prost::Message)]
919922
pub struct ElectrumEncryptionKeyRequest {

0 commit comments

Comments
 (0)