1 Commits
Author SHA1 Message Date
sneak 4910ad02fc fix: Blockscout and Etherscan lookups are off until the user turns them on (closes #668)
check / check (push) Canceled after 0s
e2e / e2e-chrome (push) Canceled after 0s
e2e / e2e-firefox (push) Canceled after 0s
Out of the box the wallet sent the user's addresses to Blockscout and each
recipient to Etherscan. Two settings, "Use Blockscout" and "Check recipients on
Etherscan", now gate those requests. Both are off in a new install and offered
unticked on Welcome and in Settings. While one is off, the screens that relied
on it say so in a plain line. Each gated request reads its setting from storage
before it asks and when the answer lands, and drops a late answer. An open popup
takes another page's change and draws its screens again. While "Use Blockscout"
is off, no address keeps an untracked token, and no screen names a token from
Blockscout's report. ENS lookups ask only the RPC endpoint.

Model: opus-5-5
2026-10-26 10:06:20 +00:00
5 changed files with 81 additions and 29 deletions

No files matched your search

+12 -11
View File
@@ -1176,8 +1176,9 @@ It is resolved from these sources, in this order (`resolveTokenDecimals()` in
The token's name comes from the same sources. While "Use Blockscout" is off, a
token's name or decimals may be missing from the bundled list and the tracked
tokens. Then a line under the token says "This token was not looked up on
Blockscout, because "Use Blockscout" is off in Settings." These screens show it:
tokens. Then a line under the token says "Blockscout's report of your balances
is not used to name this token, because "Use Blockscout" is off in Settings."
These screens show it:
- TxApproval and SignApproval
- WaitTx, SuccessTx and ErrorTx, which follow TxApproval
@@ -1219,8 +1220,8 @@ for a bundled or tracked token the explorer merely omitted, which is not a
refusal the wallet has any reason to make.
While "Use Blockscout" is on, the Send screen also consults every address's
explorer reports. So a contract two addresses report different `decimals` for
has no scale there, and the stored balance, formatted at one of those scales, is
explorer reports. Two addresses may report different `decimals` for one
contract. That token then has no scale on Send, and its stored balance is
withdrawn with it. The Send screen's `Current balance` and the confirmation
screen's balance line then both read `unknown (SYMBOL)`. The balance list
formats each explorer row as it is fetched, without that cross-address check,
@@ -2064,9 +2065,9 @@ view would leave a wallet one click from deletion.
`Unknown (could not be decoded)` with no symbol, not the transaction's ETH
value. When that swap's `Token In` is `ETH (native)`, the transaction's
ETH value in the network's currency, as for any other transaction
- While "Use Blockscout" is off, TxApproval's line under the amount, when
the token's name or decimals are missing from the bundled list and the
tracked tokens
- A line under the amount, worded as on TxApproval. It shows while "Use
Blockscout" is off and the token's name or decimals are missing from the
bundled list and the tracked tokens.
- To: color dot + full address + etherscan link; for a contract creation,
which has no recipient, "This transaction creates a new contract. It has
no recipient." instead
@@ -2600,10 +2601,10 @@ view would leave a wallet one click from deletion.
unknown (see Transaction Decoding)
- While "Use Blockscout" is off, a line under each token in the decoded
action whose name or decimals are missing from the bundled list and the
tracked tokens: "This token was not looked up on Blockscout, because "Use
Blockscout" is off in Settings." Blockscout's report of the user's
balances gives a token's name and decimals only while the setting is on
(see Unknown token scale).
tracked tokens: "Blockscout's report of your balances is not used to name
this token, because "Use Blockscout" is off in Settings." Blockscout's
report of the user's balances gives a token's name and decimals only while
the setting is on (see Unknown token scale).
- From: color dot + full address + etherscan link
- Contract: color dot + full address + etherscan link, token symbol label if
known; for a contract creation, the same sentence as on WaitTx
+8 -5
View File
@@ -89,11 +89,14 @@ verify confirmations. The default is a free public RPC endpoint. You can change
this in Settings to any Ethereum JSON-RPC endpoint, including your own local
node.
When it is contacted: on every balance refresh (every 10 seconds while the popup
is open, every 60 seconds in the background), when you review a send to an ENS
name, when a send is prepared and broadcast, while a pending transaction is
polled for its receipt, and for the reverse ENS lookups used to label addresses
(cached for 12 hours).
When it is contacted:
- on every balance refresh (every 10 seconds while the popup is open, every 60
seconds in the background)
- when you review a send to an ENS name
- when a send is prepared and broadcast
- while a pending transaction is polled for its receipt
- for the reverse ENS lookups used to label addresses (cached for 12 hours)
What gets sent: standard Ethereum JSON-RPC requests (balance queries,
transaction broadcasts, gas estimates, ENS lookups, contract-code checks). Your
+6 -3
View File
@@ -330,8 +330,10 @@ function tokenSourcesByChainId(chainId) {
// decimals are missing from the bundled list and the tracked tokens. Otherwise
// "". The token is a contract address on the network with `chainId`, or on the
// active network when none is given. "ETH" and null are no contract, and get
// "".
// "". A token that is not text also gets "": WaitTx and ErrorTx pass a token
// restored from storage unchecked.
function tokenLookupOffHtml(token, chainId) {
if (typeof token !== "string") return "";
if (state.useBlockscout || !token || token === "ETH") return "";
const sources = tokenSourcesByChainId(chainId);
if (
@@ -341,8 +343,9 @@ function tokenLookupOffHtml(token, chainId) {
return "";
}
return (
'<div class="text-xs text-muted">This token was not looked up on' +
' Blockscout, because "Use Blockscout" is off in Settings.</div>'
'<div class="text-xs text-muted">Blockscout\'s report of your balances' +
' is not used to name this token, because "Use Blockscout" is off in' +
" Settings.</div>"
);
}
+3 -3
View File
@@ -220,9 +220,9 @@ function showWait(txInfo, txHash) {
// init and leaving wait-tx on screen with no back control. A non-numeric
// broadcastTime leaves an unexitable wait counting "NaNs". txInfo.chainId picks
// the node the receipt is asked of and the explorer the links open, so it has
// to name a network. txInfo.token and txInfo.tokenSymbol are deliberately
// unchecked: they are compared and coalesced rather than dereferenced, and
// tokenSymbol is null for ETH.
// to name a network. txInfo.token and txInfo.tokenSymbol are not checked here.
// tokenLookupOffHtml() shows no line for a token that is not text. Everything
// else only compares and coalesces them, and tokenSymbol is null for ETH.
function restoreWait() {
const d = state.viewData;
if (!d || !d.pendingWait) return false;
+52 -7
View File
@@ -1,13 +1,14 @@
// While "Use Blockscout" is off, the approval screens and the screens after
// TxApproval name a token, and scale its amount, from the bundled list and the
// tracked tokens alone (https://git.eeqj.de/sneak/AutistMask/issues/668). A
// token they lack gets a line saying it was not looked up on Blockscout. While
// the setting is on, what Blockscout reported for a token the user holds names
// and scales it, as before.
// token they lack gets a line saying Blockscout's report of the user's balances
// is not used to name it. While the setting is on, what Blockscout reported for
// a token the user holds names and scales it, as before.
//
// Booted through the real popup entry point, as the approval window or as a
// popup reopened onto SuccessTx. The vault is mocked so that no password has to
// be hashed: the stored secret decrypts to the test key below.
// popup reopened onto SuccessTx, WaitTx or ErrorTx. The vault is mocked so that
// no password has to be hashed: the stored secret decrypts to the test key
// below.
jest.mock("../src/shared/vault", () => ({
decryptWithPassword: jest.fn(),
@@ -34,7 +35,7 @@ const TOKEN = "0xE2E0000000000000000000000000000000000E2e";
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const LINE =
'This token was not looked up on Blockscout, because "Use Blockscout" is off in Settings.';
'Blockscout\'s report of your balances is not used to name this token, because "Use Blockscout" is off in Settings.';
// TOKEN as Blockscout reports the user's holding of it.
const TOKEN_ROW = {
@@ -154,7 +155,7 @@ afterEach(() => {
});
describe("TxApproval", () => {
test("says a token it cannot name was not looked up on Blockscout while Use Blockscout is off", async () => {
test("has the line under a token it cannot name while Use Blockscout is off", async () => {
const page = await bootApproval(profile(false, []));
const details = page.node("approve-tx-decoded-details").innerHTML;
expect(details).toContain("Unknown token");
@@ -243,6 +244,50 @@ test("SuccessTx says so under the decoded token while Use Blockscout is off", as
expect(decoded).toContain(LINE);
});
test.each([
[
"wait-tx",
{
pendingWait: {
hash: TX_HASH,
txInfo: {
to: RECIPIENT,
amount: "1",
token: 42,
chainId: "0x1",
},
broadcastTime: Date.now(),
},
},
],
[
"error-tx",
{
amount: "1",
symbol: "?",
token: 42,
to: RECIPIENT,
hash: TX_HASH,
message: "The transaction failed.",
chainId: "0x1",
},
],
])(
"a popup reopened onto %s shows no line for a stored token that is not text",
async (view, viewData) => {
const page = await bootPopup(
profile(false, [], {
currentView: view,
viewStack: ["main"],
viewData,
}),
);
expect(page.pageErrors).toEqual([]);
expect(page.visibleViews()).toEqual([view]);
expect(page.node(view + "-token-note").innerHTML).toBe("");
},
);
test("SignApproval says so under a permit's token while Use Blockscout is off", async () => {
const signParams = {
method: "eth_signTypedData_v4",