Skip to content

Commit

Permalink
privacy warning: t-addr (#254)
Browse files Browse the repository at this point in the history
* privacy warning for t-addr

* truncate bech32 addresses:

* linting

* stack privacy warnings

* privacy warning description

* use t-addr in dialogue rendering

* derive t-addr bech32 encoding

* conditionally select between ephemeral and transparent bech32 encoding

* bump package deps

* bump more package deps

* update lockfile

* update lockfile

* force broken lockfile
  • Loading branch information
TalDerei authored Dec 22, 2024
1 parent 6cc59d3 commit f6cff30
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 269 deletions.
20 changes: 10 additions & 10 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
"@connectrpc/connect": "^1.x",
"@connectrpc/connect-web": "^1.x",
"@penumbra-labs/registry": "^12.0.0",
"@penumbra-zone/bech32m": "10.0.0",
"@penumbra-zone/client": "21.0.0",
"@penumbra-zone/crypto-web": "29.0.1",
"@penumbra-zone/getters": "20.0.0",
"@penumbra-zone/bech32m": "11.0.0",
"@penumbra-zone/client": "22.0.0",
"@penumbra-zone/crypto-web": "32.0.0",
"@penumbra-zone/getters": "21.0.0",
"@penumbra-zone/keys": "4.2.1",
"@penumbra-zone/perspective": "39.0.0",
"@penumbra-zone/protobuf": "6.3.0",
"@penumbra-zone/perspective": "42.0.0",
"@penumbra-zone/protobuf": "7.0.0",
"@penumbra-zone/query": "workspace:*",
"@penumbra-zone/services": "44.0.0",
"@penumbra-zone/storage": "39.0.0",
"@penumbra-zone/services": "47.0.0",
"@penumbra-zone/storage": "42.0.0",
"@penumbra-zone/transport-chrome": "8.0.1",
"@penumbra-zone/transport-dom": "7.5.0",
"@penumbra-zone/types": "26.2.1",
"@penumbra-zone/wasm": "33.1.0",
"@penumbra-zone/types": "27.0.0",
"@penumbra-zone/wasm": "36.0.0",
"@radix-ui/react-icons": "^1.3.0",
"@repo/context": "workspace:*",
"@repo/ui": "workspace:*",
Expand Down
37 changes: 29 additions & 8 deletions apps/extension/src/routes/popup/approval/transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ const hasAltGasFee = (txv?: TransactionView): boolean => {
return feeAssetId.equals(stakingAssetId);
};

const hasTransparentAddress = (txv?: TransactionView): boolean => {
return (
txv?.bodyView?.actionViews.some(
action =>
action.actionView.case === 'ics20Withdrawal' &&
action.actionView.value.useTransparentAddress,
) ?? false
);
};

export const TransactionApproval = () => {
const { authorizeRequest: authReqString, setChoice, sendResponse } = useStore(txApprovalSelector);

Expand Down Expand Up @@ -64,14 +74,25 @@ export const TransactionApproval = () => {
</h1>
</div>
<div className='grow overflow-auto p-4'>
{selectedTransactionViewName === TransactionViewTab.SENDER &&
!hasAltGasFee(selectedTransactionView) && (
<div className='mb-4 rounded border border-yellow-500 p-2 text-sm text-yellow-500'>
<span className='block text-center font-bold'>⚠ Privacy Warning:</span>
Transaction uses a non-native fee token. To reduce gas costs and protect your privacy,
maintain an UM balance for fees.
</div>
)}
{selectedTransactionViewName === TransactionViewTab.SENDER && (
<>
{hasTransparentAddress(selectedTransactionView) && (
<div className='mb-4 rounded border border-yellow-500 p-2 text-sm text-yellow-500'>
<span className='block text-center font-bold'>⚠ Privacy Warning</span>
<p>This transaction uses a transparent address which may reduce privacy.</p>
</div>
)}
{!hasAltGasFee(selectedTransactionView) && (
<div className='mb-4 rounded border border-yellow-500 p-2 text-sm text-yellow-500'>
<span className='block text-center font-bold'>⚠ Privacy Warning</span>
<p>
Transaction uses a non-native fee token. To reduce gas costs and protect your
privacy, maintain an UM balance for fees.
</p>
</div>
)}
</>
)}
<ViewTabs
defaultValue={selectedTransactionViewName}
onValueChange={setSelectedTransactionViewName}
Expand Down
18 changes: 9 additions & 9 deletions packages/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
"peerDependencies": {
"@bufbuild/protobuf": "^1.x",
"@penumbra-labs/registry": "^12.0.0",
"@penumbra-zone/bech32m": "10.0.0",
"@penumbra-zone/crypto-web": "29.0.1",
"@penumbra-zone/getters": "20.0.0",
"@penumbra-zone/bech32m": "11.0.0",
"@penumbra-zone/crypto-web": "32.0.0",
"@penumbra-zone/getters": "21.0.0",
"@penumbra-zone/keys": "4.2.1",
"@penumbra-zone/perspective": "39.0.0",
"@penumbra-zone/protobuf": "6.3.0",
"@penumbra-zone/perspective": "42.0.0",
"@penumbra-zone/protobuf": "7.0.0",
"@penumbra-zone/query": "workspace:*",
"@penumbra-zone/services": "44.0.0",
"@penumbra-zone/storage": "39.0.0",
"@penumbra-zone/services": "47.0.0",
"@penumbra-zone/storage": "42.0.0",
"@penumbra-zone/transport-chrome": "8.0.1",
"@penumbra-zone/transport-dom": "7.5.0",
"@penumbra-zone/types": "26.2.1",
"@penumbra-zone/wasm": "33.1.0",
"@penumbra-zone/types": "27.0.0",
"@penumbra-zone/wasm": "36.0.0",
"exponential-backoff": "^3.1.1"
}
}
6 changes: 3 additions & 3 deletions packages/noble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
},
"dependencies": {
"@cosmjs/stargate": "^0.32.4",
"@penumbra-zone/bech32m": "10.0.0",
"@penumbra-zone/protobuf": "6.3.0",
"@penumbra-zone/wasm": "33.1.0"
"@penumbra-zone/bech32m": "11.0.0",
"@penumbra-zone/protobuf": "7.0.0",
"@penumbra-zone/wasm": "36.0.0"
}
}
12 changes: 6 additions & 6 deletions packages/query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"@bufbuild/protobuf": "^1.x",
"@connectrpc/connect": "^1.x",
"@connectrpc/connect-web": "^1.x",
"@penumbra-zone/bech32m": "10.0.0",
"@penumbra-zone/crypto-web": "29.0.1",
"@penumbra-zone/getters": "20.0.0",
"@penumbra-zone/protobuf": "6.3.0",
"@penumbra-zone/types": "26.2.1",
"@penumbra-zone/wasm": "33.1.0",
"@penumbra-zone/bech32m": "11.0.0",
"@penumbra-zone/crypto-web": "32.0.0",
"@penumbra-zone/getters": "21.0.0",
"@penumbra-zone/protobuf": "7.0.0",
"@penumbra-zone/types": "27.0.0",
"@penumbra-zone/wasm": "36.0.0",
"exponential-backoff": "^3.1.1"
},
"engine": {
Expand Down
16 changes: 12 additions & 4 deletions packages/ui/components/ui/tx/actions-views/isc20-withdrawal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Ics20Withdrawal } from '@penumbra-zone/protobuf/penumbra/core/component
import { ViewBox } from '../viewbox';
import { ActionDetails } from './action-details';
import { joinLoHiAmount } from '@penumbra-zone/types/amount';
import { getTransmissionKeyByAddress } from '@penumbra-zone/wasm/keys';
import { bech32TransparentAddress } from '@penumbra-zone/bech32m/tpenumbra';
import { bech32mAddress } from '@penumbra-zone/bech32m/penumbra';

const getUtcTime = (time: bigint) => {
Expand Down Expand Up @@ -29,19 +31,25 @@ export const Ics20WithdrawalComponent = ({ value }: { value: Ics20Withdrawal })
)}

<ActionDetails.Row label='Destination Address'>
{value.destinationChainAddress}
<span className='truncate max-w-[125px]'>{value.destinationChainAddress}</span>
</ActionDetails.Row>

<ActionDetails.Row label='Source channel'>{value.sourceChannel}</ActionDetails.Row>

{value.returnAddress && (
<ActionDetails.Row label='Return Address'>
{bech32mAddress(value.returnAddress)}
<span className='truncate max-w-[125px]'>
{value.useTransparentAddress
? bech32TransparentAddress({
inner: getTransmissionKeyByAddress(value.returnAddress),
})
: bech32mAddress(value.returnAddress)}
</span>
</ActionDetails.Row>
)}

<ActionDetails.Row label='Use Compat Address'>
{value.useCompatAddress ? 'TRUE' : 'FALSE'}
<ActionDetails.Row label='Use Transparent Address'>
{value.useTransparentAddress ? 'TRUE' : 'FALSE'}
</ActionDetails.Row>

{value.timeoutHeight && (
Expand Down
12 changes: 6 additions & 6 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@penumbra-labs/registry": "^12.0.0",
"@penumbra-zone/bech32m": "10.0.0",
"@penumbra-zone/getters": "20.0.0",
"@penumbra-zone/perspective": "39.0.0",
"@penumbra-zone/protobuf": "6.3.0",
"@penumbra-zone/types": "26.2.1",
"@penumbra-zone/wasm": "33.1.0",
"@penumbra-zone/bech32m": "11.0.0",
"@penumbra-zone/getters": "21.0.0",
"@penumbra-zone/perspective": "42.0.0",
"@penumbra-zone/protobuf": "7.0.0",
"@penumbra-zone/types": "27.0.0",
"@penumbra-zone/wasm": "36.0.0",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-dialog": "1.1.1",
Expand Down
Loading

0 comments on commit f6cff30

Please sign in to comment.