-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LIVE-3146][LIVE-3626] Feature - EIP712 filtering (#1211)
* Remove prefix on EIP712 methods in module * Remove useless changes on v parity for eth signMsg * Make eth signPersonalMessage work without rawMsg * Add crypto-js to hw-app-eth * Add temp fake CAL for test purposes * Add EIP712 filters related types * Add getFiltersForMessage method to EIP712 utils * Add filtering to EIP712 module * Update fakeCAL for the real cryptoassets repo * Add EIP712 importer to crypto-assets-importer script * Move EIP712 sample messages to new fixture folder * Change EIP712 tests folder architecture * Add EIP712 tests with filters * Sort alphabetically EIP712 types for schema hash * Add 3 new messages to EIP721 tests * Add EIP712 CAL Fixture * Fix EIP721 integer encoder and update tests * Update modified 712 APDUs due to new int encoder * Update CAL directory for eip712 importer * Update tsconfig to avoid false err on tree shaking * Import from crypto-js with lowercase syntax * Fix path of import for @ledgerhq/cryptoassets/data/* * Add test for sortObjectAlphabetically * Add eip712 CAL to vite config as common.js dep * Add fallback to legacy eip712 msg signing + warning message in doc * changesets * Export getFiltersForMessage in hw-app-eth * Update modal content scroll to vertical only * Add methods to get nano screens from EIP712 msg signing * Add LLD UI parsing to walletconnect msg signing * Update isEIP712Message to allow string as param * Add LLM UI parsing to walletconnect msg signing * changeset * Remove useless undefined type Co-authored-by: Landry Monga <[email protected]> * Add Ethereum nano app 1.10.0 as min requirement * Update eip712 importer for new JSON format * update screenshots * Add missing translation * Fix early return of MessageProperty component * Simplify EIP712 module recursive func condition * [LIVE-3641] Feature: EIP712 dynamic CAL (#1734) * Add LLM UI parsing to walletconnect msg signing * Add Dynamic CAL EIP712 in hw-app-eth * Update LLD UI for EIP712 dynamic CAL * Update LLM UI for EIP712 dynamic CAL * Move ERC20 dynamic CAL tests into their own folder * Update EIP712 tests for dynamic CAL * changeset * Add typing to dynamic CAL axios call * Fix flashing on EIP721 signing with dynamic CAL Co-authored-by: haammar-ledger <[email protected]> Co-authored-by: Landry Monga <[email protected]> Co-authored-by: Team Live <[email protected]>
- Loading branch information
1 parent
8c5e3ba
commit 32c8df8
Showing
191 changed files
with
4,785 additions
and
1,154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/live-common": minor | ||
--- | ||
|
||
Add dynamic CAL support for EIP712 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
--- | ||
|
||
Add dynamic CAL support for EIP712 in signMessage flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/hw-app-eth": minor | ||
--- | ||
|
||
Add dynamic CAL support for EIP712 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": minor | ||
--- | ||
|
||
New UI parsing for signMessage flow, supporting EIP712 filtering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
--- | ||
|
||
Add dynamic CAL support for EIP712 in signMessage flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@ledgerhq/cryptoassets": minor | ||
"ledger-libs": minor | ||
--- | ||
|
||
Add EIP712 CAL and CAL importer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
--- | ||
|
||
New UI parsing for signMessage flow, supporting EIP712 filtering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
--- | ||
|
||
Add eip721 cryptoassets data to vite config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/live-common": minor | ||
--- | ||
|
||
Remove EIP712 message signing from env and set as definitve feature + update tests accordingly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ledgerhq/hw-app-eth": minor | ||
--- | ||
|
||
Add filtering to EIP712 message signing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 0 additions & 109 deletions
109
apps/ledger-live-desktop/src/renderer/components/SignMessageConfirm/index.jsx
This file was deleted.
Oops, something went wrong.
139 changes: 139 additions & 0 deletions
139
apps/ledger-live-desktop/src/renderer/components/SignMessageConfirm/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import invariant from "invariant"; | ||
import styled from "styled-components"; | ||
import { useTranslation } from "react-i18next"; | ||
import React, { useEffect, useState } from "react"; | ||
import { Account, AccountLike } from "@ledgerhq/types-live"; | ||
import { getMainAccount } from "@ledgerhq/live-common/account/index"; | ||
import { Device } from "@ledgerhq/live-common/hw/actions/types"; | ||
import { MessageData } from "@ledgerhq/live-common/hw/signMessage/types"; | ||
import { NanoDisplayedInfoFor712 } from "~/renderer/modals/SignMessage/types"; | ||
import { DeviceTransactionField } from "@ledgerhq/live-common/transaction/index"; | ||
import { TypedMessageData } from "@ledgerhq/live-common/families/ethereum/types"; | ||
import { renderVerifyUnwrapped } from "~/renderer/components/DeviceAction/rendering"; | ||
import { getMessageProperties } from "~/renderer/modals/SignMessage/utils"; | ||
import SignMessageConfirmField from "./SignMessageConfirmField"; | ||
import Spinner from "~/renderer/components/BigSpinner.jsx"; | ||
import useTheme from "~/renderer/hooks/useTheme"; | ||
import Text from "~/renderer/components/Text"; | ||
import Box from "~/renderer/components/Box"; | ||
|
||
const FieldText = styled(Text).attrs(() => ({ | ||
ml: 1, | ||
ff: "Inter|Medium", | ||
color: "palette.text.shade80", | ||
fontSize: 3, | ||
}))` | ||
word-break: break-all; | ||
text-align: right; | ||
max-width: 50%; | ||
`; | ||
|
||
export type FieldComponentProps = { | ||
account: AccountLike; | ||
field: DeviceTransactionField; | ||
}; | ||
|
||
export type FieldComponent = React.ComponentType<FieldComponentProps>; | ||
|
||
const TextField = ({ field }: FieldComponentProps) => { | ||
return field.type === "text" ? ( | ||
<SignMessageConfirmField label={field.label}> | ||
<FieldText>{field.value}</FieldText> | ||
</SignMessageConfirmField> | ||
) : null; | ||
}; | ||
|
||
const Container = styled(Box).attrs(() => ({ | ||
alignItems: "center", | ||
fontSize: 4, | ||
pb: 4, | ||
}))``; | ||
|
||
type Props = { | ||
device: Device; | ||
account: AccountLike; | ||
parentAccount: Account | null | undefined; | ||
signMessageRequested: TypedMessageData | MessageData; | ||
}; | ||
|
||
const SignMessageConfirm = ({ device, account, parentAccount, signMessageRequested }: Props) => { | ||
const type = useTheme("colors.palette.type"); | ||
const { t } = useTranslation(); | ||
const { currency } = getMainAccount(account, parentAccount); | ||
const [inferredNanoFields, setInferredNanoFields] = useState<{ | ||
message: string; | ||
fields?: NanoDisplayedInfoFor712; | ||
}>(); | ||
|
||
useEffect(() => { | ||
getMessageProperties(currency, signMessageRequested).then(setInferredNanoFields); | ||
}, [currency, signMessageRequested]); | ||
|
||
if (!device) return null; | ||
|
||
let fields = []; | ||
if (inferredNanoFields?.fields && Array.isArray(inferredNanoFields.fields)) { | ||
fields = inferredNanoFields.fields.map(field => ({ | ||
...field, | ||
type: "text", | ||
value: Array.isArray(field.value) ? field.value.join(",\n") : field.value, | ||
})); | ||
} else { | ||
if ((signMessageRequested as TypedMessageData)?.hashes) { | ||
const { hashes } = signMessageRequested as TypedMessageData; | ||
|
||
if (hashes.domainHash) { | ||
fields.push({ | ||
type: "text", | ||
label: t("SignMessageConfirm.domainHash"), | ||
value: hashes.domainHash, | ||
}); | ||
} | ||
|
||
if (hashes.messageHash) { | ||
fields.push({ | ||
type: "text", | ||
label: t("SignMessageConfirm.messageHash"), | ||
value: hashes.messageHash, | ||
}); | ||
} | ||
|
||
if (hashes.stringHash) { | ||
fields.push({ | ||
type: "text", | ||
label: t("SignMessageConfirm.stringHash"), | ||
value: hashes.stringHash, | ||
}); | ||
} | ||
} | ||
|
||
fields.push({ | ||
type: "text", | ||
label: t("SignMessageConfirm.message"), | ||
value: | ||
typeof signMessageRequested.message === "object" | ||
? JSON.stringify(signMessageRequested.message) | ||
: signMessageRequested.message, | ||
}); | ||
} | ||
|
||
return ( | ||
<Container> | ||
{!inferredNanoFields?.message ? ( | ||
<Spinner size={30} /> | ||
) : ( | ||
<> | ||
<Box style={{ width: "100%" }} px={30} mb={20}> | ||
{fields.map((field, i) => { | ||
return <TextField key={i} field={field} account={account} />; | ||
})} | ||
</Box> | ||
|
||
{renderVerifyUnwrapped({ modelId: device.modelId, type })} | ||
</> | ||
)} | ||
</Container> | ||
); | ||
}; | ||
|
||
export default SignMessageConfirm; |
Oops, something went wrong.
32c8df8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲ 30min 31s ✅ 55 txs ❌ 36 txs⚠️ 22 specs ($2,908.11) for [Bot] non-reg on develop with 'Phosphore'
22 critical spec errors
Spec Bitcoin Testnet failed!
Spec Bitcoin Cash failed!
Spec Bitcoin Gold failed!
Spec Dash failed!
Spec Digibyte failed!
Spec DogeCoin failed!
Spec Komodo failed!
Spec Litecoin failed!
Spec Peercoin failed!
Spec PivX failed!
Spec Qtum failed!
Spec Vertcoin failed!
Spec ZCash failed!
Spec Horizen failed!
Spec Decred failed!
Spec Ethereum failed!
Spec Ethereum Goerli failed!
Spec Cronos failed!
Spec Fantom failed!
Spec Moonbeam failed!
Spec Songbird failed!
Spec Flare failed!
❌ 36 mutation errors
Portfolio ($2,908.11) – Details of the 42 currencies
32PI2C5HLHMVUF5KMNURLGCTYVIOVJJ2NLHLZ2PIMK567MKMS4RXBSVWQI
bc1qd26p34cmjhkn4vymz04g0j3a85dlr8u9gfw60v
tb1q0fss408djmtdap7kktwkwgxc8sq5f3tw0u3ghv
qprxxufvlxu6hrck0flmt97uxk9764jhvqj9u5wsnh
AQ8WHx49MnEN39yLbS3YVqFSR4QCPq9YBs
XoUD9yEVPCDpa5w3f5ZRJVBvRw4T3Th6SF
dgb1qrg3wq33sgdnq8kw7swc5enu7ylcyeqsnd0qfak
DSwhBnAWqfEBEiamgzgwi2DHkaq3bCde9B
RC21495pJtcxTsh4XSNm8JHR9Tqsi7V1ut
ltc1qq0sd0f08ry5zhjrukyqlr8ty6jefuygfgax7lq
PENairxSY2yt1yc3x2ix4W4yVvk5Ewo8fZ
DQgKoeM4sJg6qJmT5niqjoQXeH8YZAA4XB
MNyefqAndzqNpFbRY2aNcUSuTRS89uYb2F
3NzF9UQjcLV7YmeotSN1nG7YXHLzXQ71EA
EQmcUL6tzHVzp2njda3B4jfQmmNnbGeQzk
t1NMofpoiYLyzit88bb4WE2yrAiDNoSRZFv
znctkJCAs3Fhosps5ogC4bEq5i63Miwdo2i
DsSD4pp2S7jPqj2BWe1oqb25AZSSyFLGYwZ
addr1q9pmnk7ru3htvdh632gm3fzmpr9zz6jg92xyl054ar0v0dtrkxr0sr9fx363v03pw5cx4qumlnjrtquc0d09ny85e2ysr77t0q
0xCc7187772b999d669845d0D72660F388781575DB
cosmos1ga5n0llpm9dqmvmac92tqffrwwlhexppmts4s7
cro1hh3ygrlneu3whlsjcsa2akrwm00ujy2ggxk7v9
erd10f45c5x4997ctt5ye45vfzkvzsutwyd5rgw0zxsmneay90kyc0tq809pjy
0xa22CA840265d3C5CB1846e419B14c6a6CdD06FAB
0xa22CA840265d3C5CB1846e419B14c6a6CdD06FAB
0x556ad802f06ae3BE9fC48D4bEcDE703a9B9F7b29
f17ifzgtyoe3uj7w4dytb7wvzywbzhegaduovufoa
0.0.942690
osmo1ga5n0llpm9dqmvmac92tqffrwwlhexppnsr9xv
15jLBbe9LD6VSUYFkV5Fmo5LhZU5cns9E6g8qcDv5KrKM1eP
rP8phQ7XgRozw8Wg8cTgkWPT9ZL4VDydfQ
GfeURDNSr7iE5NksC9e3KteXsZTFn31VvAGaS9XG91KJ
GCXE56DP3YWR34L5OTEV6UJKXFEAGYIK7X6SAXF4ZB4VQAOH5I4ERYOP
tz1feA619tG2iPwCCUFCL72yC6bgwjDTD8FF
TRbtdwHowocq8ThZbRnTHgK4JG5sx3fFCK
Performance ⏲ 30min 31s
Time spent for each spec: (total across mutations)