Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LIVE-15017] Bugfix - Force Struct values order in EIP-712 messages #8473

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/popular-pugs-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/hw-app-eth": minor
---

Force entries order in EIP-712 Structs when providing their implementation.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ const makeRecursiveFieldStructImplem = ({
await recursiveFieldStructImplem([typeDescription, restSizes], entry, entryPath);
}
} else if (isCustomType) {
for (const [fieldName, fieldValue] of Object.entries(data as EIP712Message["message"])) {
for (const fieldName of Object.keys(typesMap[typeDescription?.name || ""])) {
const fieldValue = data[fieldName];
const fieldType = typesMap[typeDescription?.name || ""]?.[fieldName];

if (fieldType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"primaryType": "Permit",
"message": {
"deadline": 1718992051,
"nonce": 0,
"spender": "0x111111125421ca6dc452d289314280a0f8842a65",
"owner": "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
"value": "115792089237316195423570985008687907853269984665640564039457584007913129639935"
"nonce": 0,
"value": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
"owner": "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d"
},
"types": {
"EIP712Domain": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"primaryType": "PermitSingle",
"message": {
"details": {
"token": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
"amount": "69420000000000000000",
"expiration": "1718184249",
"nonce": "0"
"amount": "69420000000000000000",
"nonce": "0",
"token": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"
},
"spender": "0xec7be89e9d109e7e3fec59c222cf297125fefda2",
"sigDeadline": "1715594049"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"deadline": "1718467096",
"witness": {
"info": {
"reactor": "0x6000da47483062a0d734ba3dc7576ce6a0b645c4",
"swapper": "0x224cbc440944c72e951507e97d8bf5ffa2e3d2b9",
"nonce": "1993354326232431306240697018571020274189859638820531235067341608173853199105",
"deadline": "1718467096",
"swapper": "0x224cbc440944c72e951507e97d8bf5ffa2e3d2b9",
"additionalValidationContract": "0x0000000000000000000000000000000000000000",
"reactor": "0x6000da47483062a0d734ba3dc7576ce6a0b645c4",
"deadline": "1718467096",
"additionalValidationData": "0x"
},
"decayStartTime": "1718467024",
Expand All @@ -31,15 +31,15 @@
"inputEndAmount": "100000000000000000",
"outputs": [
{
"token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"startAmount": "348572327",
"token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"endAmount": "332452012",
"recipient": "0x224cbc440944c72e951507e97d8bf5ffa2e3d2b9"
},
{
"endAmount": "833213",
"token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"startAmount": "873614",
"endAmount": "833213",
"recipient": "0x27213e28d7fda5c57fe9e5dd923818dbccf71c47"
}
]
Expand Down
Loading