From 8c29d57390fa9277586619648b4b18322b4fdcbc Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Tue, 18 Jun 2024 17:36:29 +0200 Subject: [PATCH] EIP-712: implement stricter validations - forbid empty labels, or longer than 39 characters (ethereum app limit) - forbid empty mappings / empty messages or contracts lists - fix SmartCredit.io descriptor breaking rule (just show all fields) --- arbitrum/eip712.schema.json | 7 +++++++ arbitrum_sepolia/eip712.schema.json | 7 +++++++ avalanche/eip712.schema.json | 9 ++++++++- base/eip712.schema.json | 9 ++++++++- base_sepolia/eip712.schema.json | 9 ++++++++- blast/eip712.schema.json | 9 ++++++++- bsc/eip712.schema.json | 7 +++++++ celo/eip712.schema.json | 7 +++++++ ethereum/eip712.schema.json | 7 +++++++ ethereum/smartcredit/eip712.json | 31 ++++++++++++++++++++++++++++- ethereum_sepolia/eip712.schema.json | 7 +++++++ fantom/eip712.schema.json | 7 +++++++ optimism/eip712.schema.json | 7 +++++++ optimism_sepolia/eip712.schema.json | 7 +++++++ polygon/eip712.schema.json | 7 +++++++ polygon_mumbai/eip712.schema.json | 7 +++++++ polygon_zk_evm/eip712.schema.json | 9 ++++++++- scroll/eip712.schema.json | 9 ++++++++- 18 files changed, 155 insertions(+), 7 deletions(-) diff --git a/arbitrum/eip712.schema.json b/arbitrum/eip712.schema.json index e814e52a..35adf4d5 100644 --- a/arbitrum/eip712.schema.json +++ b/arbitrum/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/arbitrum_sepolia/eip712.schema.json b/arbitrum_sepolia/eip712.schema.json index 6aee46ec..c897c1c4 100644 --- a/arbitrum_sepolia/eip712.schema.json +++ b/arbitrum_sepolia/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/avalanche/eip712.schema.json b/avalanche/eip712.schema.json index d4a7b7da..6d35d510 100644 --- a/avalanche/eip712.schema.json +++ b/avalanche/eip712.schema.json @@ -15,7 +15,7 @@ "items": { "properties": { "address": { - "pattern": "^0x[a-f0-9]{40}$", + "pattern": "^0x[a-z0-9]{40}$", "type": "string" }, "contractName": { @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/base/eip712.schema.json b/base/eip712.schema.json index 0a1c443f..2c4bd121 100644 --- a/base/eip712.schema.json +++ b/base/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { @@ -101,4 +108,4 @@ "chainId" ], "type": "object" -} +} \ No newline at end of file diff --git a/base_sepolia/eip712.schema.json b/base_sepolia/eip712.schema.json index 2a7b4ed0..4ed7d969 100644 --- a/base_sepolia/eip712.schema.json +++ b/base_sepolia/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { @@ -101,4 +108,4 @@ "chainId" ], "type": "object" -} +} \ No newline at end of file diff --git a/blast/eip712.schema.json b/blast/eip712.schema.json index 4bafcd76..5f191a0e 100644 --- a/blast/eip712.schema.json +++ b/blast/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { @@ -101,4 +108,4 @@ "chainId" ], "type": "object" -} +} \ No newline at end of file diff --git a/bsc/eip712.schema.json b/bsc/eip712.schema.json index 1981a7af..8c75d2f3 100644 --- a/bsc/eip712.schema.json +++ b/bsc/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/celo/eip712.schema.json b/celo/eip712.schema.json index 98d61b60..6c2a29cd 100644 --- a/celo/eip712.schema.json +++ b/celo/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/ethereum/eip712.schema.json b/ethereum/eip712.schema.json index 49d6ccf4..0e035fd6 100644 --- a/ethereum/eip712.schema.json +++ b/ethereum/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/ethereum/smartcredit/eip712.json b/ethereum/smartcredit/eip712.json index a5a16148..86c082fa 100644 --- a/ethereum/smartcredit/eip712.json +++ b/ethereum/smartcredit/eip712.json @@ -8,7 +8,36 @@ "messages": [ { "mapper": { - "fields": [], + "fields": [ + { + "label": "Collateral address", + "path": "collateralAddress" + }, + { + "label": "Initial Collateral Amount", + "path": "initialCollateralAmount" + }, + { + "label": "Loan Amount", + "path": "loanAmount" + }, + { + "label": "Loan ID", + "path": "loanId" + }, + { + "label": "Loan interest rate", + "path": "loanInterestRate" + }, + { + "label": "Load Term", + "path": "loanTerm" + }, + { + "label": "Underlying Address", + "path": "underlyingAddress" + } + ], "label": "SmartCredit.io" }, "schema": { diff --git a/ethereum_sepolia/eip712.schema.json b/ethereum_sepolia/eip712.schema.json index 4d5e8cf1..e97b9262 100644 --- a/ethereum_sepolia/eip712.schema.json +++ b/ethereum_sepolia/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/fantom/eip712.schema.json b/fantom/eip712.schema.json index 8357e698..60d20b87 100644 --- a/fantom/eip712.schema.json +++ b/fantom/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/optimism/eip712.schema.json b/optimism/eip712.schema.json index 5afb4998..0afedc18 100644 --- a/optimism/eip712.schema.json +++ b/optimism/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/optimism_sepolia/eip712.schema.json b/optimism_sepolia/eip712.schema.json index 1c8d2dd4..77a9e497 100644 --- a/optimism_sepolia/eip712.schema.json +++ b/optimism_sepolia/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/polygon/eip712.schema.json b/polygon/eip712.schema.json index d00feece..91088f03 100644 --- a/polygon/eip712.schema.json +++ b/polygon/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/polygon_mumbai/eip712.schema.json b/polygon_mumbai/eip712.schema.json index d271030f..5169ec00 100644 --- a/polygon_mumbai/eip712.schema.json +++ b/polygon_mumbai/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { diff --git a/polygon_zk_evm/eip712.schema.json b/polygon_zk_evm/eip712.schema.json index 5df6dab3..21a396e3 100644 --- a/polygon_zk_evm/eip712.schema.json +++ b/polygon_zk_evm/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { @@ -101,4 +108,4 @@ "chainId" ], "type": "object" -} +} \ No newline at end of file diff --git a/scroll/eip712.schema.json b/scroll/eip712.schema.json index 929ef8f1..85b1a036 100644 --- a/scroll/eip712.schema.json +++ b/scroll/eip712.schema.json @@ -44,6 +44,8 @@ ] }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" }, "path": { @@ -56,9 +58,12 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "label": { + "maxLength": 39, + "minLength": 1, "type": "string" } }, @@ -78,6 +83,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" } }, @@ -88,6 +94,7 @@ ], "type": "object" }, + "minItems": 1, "type": "array" }, "name": { @@ -101,4 +108,4 @@ "chainId" ], "type": "object" -} +} \ No newline at end of file