Skip to content

EIP-712 binding context cannot omit deployments, so a salt domain cannot be described #337

Description

@fbwoolf

InputEIP712 and ResolvedEIP712 inherit deployments from the binding context base, where it is
required with min_length=1:

class InputBindingContext(Model):
    deployments: list[InputDeployment] = Field(
        title="Deployments",
        description="An array of deployments ...",
        min_length=1,
    )

This holds in both erc7730/model/input/context.py and erc7730/model/input/v2/context.py, and in
the resolved counterparts.

A message whose domain is EIP712Domain(string name,string version,address verifyingContract,bytes32 salt) carries the chain id in salt and has no chainId member. The specification requires a
message bound by eip712.deployments to carry both domain.chainId and domain.verifyingContract,
so that constraint can never be satisfied for such a message, and a descriptor for one must bind
through eip712.domainSeparator instead. InputEIP712.domainSeparator and InputDomain.salt are
already fields on these models, so the library models the shape but rejects every descriptor that
uses it.

Reproduce with erc7730 lint on:

{
  "context": {
    "eip712": {
      "domain": {
        "name": "USDT0",
        "version": "1",
        "verifyingContract": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F"
      },
      "domainSeparator": "0x7b43b7deae87806d0ace67d6c8e9e347fc85db8ad198e756e5c17d126fef9a05"
    }
  },
  "metadata": { "owner": "USDT" },
  "display": { "formats": {} }
}

on 1.0.10:

Value "{'eip712': {'domain': {...}, 'domainSeparator': '0x7b43...'}}" is not valid: Field required

Suggested fix: make deployments optional on the EIP-712 binding context and add a model validator
requiring at least one of deployments or domainSeparator. The contract binding context keeps
deployments required.

Context: the domain separator above is the live value from Polygon PoS USDT
(0xc2132D05D31c914a87C6611C10748AEb04B58e8F), and the same applies to bridged USDC
(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174) and DAI (0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063).
See ethereum/clear-signing-erc7730-registry#2947.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions