From 088db986d688a88c1d78b4f5df123da76ec6e1a8 Mon Sep 17 00:00:00 2001 From: jnicoulaud-ledger <102984500+jnicoulaud-ledger@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:38:43 +0100 Subject: [PATCH 1/4] spec(BACK-8009): refine slices specification (#83) --- specs/erc-7730.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/specs/erc-7730.md b/specs/erc-7730.md index ee1523d..ed1374d 100644 --- a/specs/erc-7730.md +++ b/specs/erc-7730.md @@ -195,7 +195,7 @@ This specification uses a limited [json path](https://www.rfc-editor.org/rfc/rfc Limitation to the json path specification are the following: * Paths MUST use the dot notation, including for slice and array selectors (i.e. an element of an array should be selected through `array_name.[index]`) * Only name, index and slices selectors are supported. -* Slices selectors MUST NOT contain the optional step. +* Slices selectors MUST NOT contain the optional step. Start index is inclusive, end index is exclusive. Start or end index can be omitted to indicate the beginning or end of the array. In addition, additional *roots* are introduced to support description of paths over multiple files in a single common notation. The root node identifier indicates which document or data location this path references, according to the following table: @@ -214,8 +214,8 @@ For paths referring to structured data fields, if a field has a variable length References to values in the serialized structured data * `#.params.amountIn` or `params.amountIn` refers to parameter `amountIn` in top-level structure `params` as defined in the ABI * `#.data.path.[0].path.[-1].to` or `data.path.[0].path.[-1].to` refers to the field `to` taken from last member of `path` array, itself taken from first member of enclosing `path` array, itself part of top level `data` structure. -* `#.params.path.[0:19]` refers to the first 20 bytes of the `path` byte array -* `#.params.path.[-20:-1]` refers to the last 20 bytes of the `path` byte array +* `#.params.path.[:20]` or `#.params.path.[0:20]` refers to the first 20 bytes of the `path` byte array +* `#.params.path.[-20:]` refers to the last 20 bytes of the `path` byte array * `#.details.[]` refers to the array with the Permit Details of a PermitBatch message References to values in the format specification file @@ -819,7 +819,7 @@ A slice on an array type means that the associated [field format specification]( "label": "Maximum Amount to Send", "format": "tokenAmount", "params": { - "tokenPath": "params.path.[0:19]" + "tokenPath": "params.path.[0:20]" } } ] From 9fef60fcd4b4fbb19b8ec33da3e80545e0bdd1e2 Mon Sep 17 00:00:00 2001 From: paoun-ledger <98907864+paoun-ledger@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:39:31 +0100 Subject: [PATCH 2/4] Add support for slices applied on primitive static types (#102) --- specs/erc-7730.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/erc-7730.md b/specs/erc-7730.md index ed1374d..0df2019 100644 --- a/specs/erc-7730.md +++ b/specs/erc-7730.md @@ -800,9 +800,9 @@ A *field format specification* is a json object defining how to format a single #### Slices in paths -A slice can be applied at the end of paths for dynamic types like bytes, string and arrays. +A slice can be applied at the end of paths. -A slice on a primitive type like bytes and string means that the associated [field format specification](#field-format-specification) MUST only be applied to the corresponding slice of bytes of the underlying data. +A slice on a primitive type like uint256, bytes and string means that the associated [field format specification](#field-format-specification) MUST only be applied to the corresponding slice of bytes of the underlying data. A slice on an array type means that the associated [field format specification](#field-format-specification) or recursive [structured data format specification](#structured-data-format-specification) MUST be applied to ALL the array elements part of the slice. From 88c871dca1f092c7ff0714320e05b0c5602aed88 Mon Sep 17 00:00:00 2001 From: paoun-ledger <98907864+paoun-ledger@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:43:37 +0100 Subject: [PATCH 3/4] Fix StarkGate descriptor (#100) * token and amount are the same field * the fee should be clear signed Co-authored-by: jnicoulaud-ledger <102984500+jnicoulaud-ledger@users.noreply.github.com> --- registry/starkgate/calldata-StarkGate-STRK.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/registry/starkgate/calldata-StarkGate-STRK.json b/registry/starkgate/calldata-StarkGate-STRK.json index 8eb1ced..b3fddb6 100644 --- a/registry/starkgate/calldata-StarkGate-STRK.json +++ b/registry/starkgate/calldata-StarkGate-STRK.json @@ -17,9 +17,9 @@ "$id": "deposit", "intent": "Bridge", "fields": [ - { "path": "token", "label": "Token", "format": "addressName", "params": { "types": ["token"] } }, - { "path": "amount", "label": "Amount", "format": "amount" }, - { "path": "l2Recipient", "label": "Recipient", "format": "raw" } + { "path": "amount", "label": "Amount to deposit", "format": "tokenAmount", "params": { "tokenPath": "token" } }, + { "path": "l2Recipient", "label": "Recipient", "format": "raw" }, + { "path": "@.value", "label": "Deposit fee", "format": "amount" } ], "required": ["token", "amount", "l2Recipient"] } From eebfcb9709495fe84d1c6d65b3651e925c9f7462 Mon Sep 17 00:00:00 2001 From: jnicoulaud-ledger <102984500+jnicoulaud-ledger@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:58:32 +0100 Subject: [PATCH 4/4] spec: update spec after #66 (#74) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EIP-712 `schemas` can be `url | array[schema | url]` Co-authored-by: Frédéric Samier --- specs/erc-7730.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/erc-7730.md b/specs/erc-7730.md index 0df2019..6488dbc 100644 --- a/specs/erc-7730.md +++ b/specs/erc-7730.md @@ -405,7 +405,7 @@ To verify a factory constraints a wallet MUST check that: **`eip712.schemas`** -The `schemas` key is either an URL pointing to the EIP-712 schemas (in json representation) or an array of individual *EIP-712 json schema*. +The `schemas` key is either an URL pointing to the EIP-712 schemas (in json representation) or an array of either individual *EIP-712 json schema*, or URLs pointing to a single message schema. An *EIP-712 schema* consists in the subset of the EIP-712 message containing only the `types` and `primaryType` elements of the message, represented in json notation for this specification.