Skip to content

Commit

Permalink
BACK-7120: Fix uniswap wrong names in schema (#193)
Browse files Browse the repository at this point in the history
* BACK-7120: Fix 1inch fusion EIP-712 token references

* BACK-7380: fix validator not enforcing ordering of schema types

* BACK-7380: remove debug code

* BACK-7120: Fix uniswap wrong names in schema
  • Loading branch information
jnicoulaud-ledger authored Jun 18, 2024
1 parent 0f00d0e commit d005d92
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 42 deletions.
6 changes: 3 additions & 3 deletions arbitrum/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions arbitrum_sepolia/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions avalanche/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions base/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions base_sepolia/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions blast/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions bsc/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions celo/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions ethereum/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions ethereum_sepolia/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions optimism/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions optimism_sepolia/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions polygon/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 3 additions & 3 deletions polygon_mumbai/uniswap/eip712.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"assetPath": "witness.inputToken",
"format": "amount",
"label": "To swap",
"path": "witness.intStartAmount"
"path": "witness.inputStartAmount"
},
{
"format": "token",
Expand Down Expand Up @@ -526,11 +526,11 @@
"type": "address"
},
{
"name": "intStartAmount",
"name": "inputStartAmount",
"type": "uint256"
},
{
"name": "intEndAmount",
"name": "inputEndAmount",
"type": "uint256"
},
{
Expand Down
6 changes: 6 additions & 0 deletions scripts/validation/validators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import glob
import hashlib
import json
import logging
import re
Expand Down Expand Up @@ -220,6 +221,11 @@ def _inner_validator(data: str, filename: str) -> Tuple[bool, str]:
def eip712_schema_validator(data: str, filename: str) -> Tuple[bool, str]:
try:
loaded = json.loads(data)
for contract in loaded["contracts"]:
for message in contract["messages"]:
# schema types must be sorted by key for reproducible hashing
message["schema"] = dict(sorted(message["schema"].items()))

formatted = json.dumps(loaded, indent=4, sort_keys=True, ensure_ascii=False)
if formatted != data and (formatted + "\n") != data:
logger.debug(
Expand Down

0 comments on commit d005d92

Please sign in to comment.