Uniswap / Uniswap/interface

[Bug] Signatures > 130 length are treated as invalid

Open
#8,008 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Signature validation failing for signatures > 130 length

Which application are you experiencing issues with?


💻 System / Environment Info

Please provide details about your environment:

  • Browser: Brave (irrelevant)
  • OS / Platform: iOS (irrelevant)
  • Device (irrelevant)
  • Wallet used: Ambire, Smart account
  • Network: Ethereum, but in general all are affected

🔁 Steps to Reproduce

Limit order. You will need a smart account wallet to reproduce. But you don't need to.
Basically, smart account signatures may not be ECDSA and therefore they might not be 65 bytes in length size.
However, the uniswap signature validation expect an exact 130 length signature and therefore fails. The smart account signature is correct and it will pass validation on the blockchain if the size validation is removed.

This is what's returned:

{
    "detail": "\"signature\" with value \"0xf0640cd98579a8c43e1d704e94fe35f6164e139423759ac917b0d0910ebbc4ce0a6a60369498de7621a6ae4c102c85ad5a5aeb910fbdc301a933aecefe9602aa1c00\" fails to match the required pattern: /^0x[0-9,a-z,A-Z]{130}$/",
    "errorCode": "VALIDATION_ERROR"
}

The signing message is:

{
    "kind": "typedMessage",
    "types": {
        "PermitWitnessTransferFrom": [
            {
                "name": "permitted",
                "type": "TokenPermissions"
            },
            {
                "name": "spender",
                "type": "address"
            },
            {
                "name": "nonce",
                "type": "uint256"
            },
            {
                "name": "deadline",
                "type": "uint256"
            },
            {
                "name": "witness",
                "type": "ExclusiveDutchOrder"
            }
        ],
        "TokenPermissions": [
            {
                "name": "token",
                "type": "address"
            },
            {
                "name": "amount",
                "type": "uint256"
            }
        ],
        "ExclusiveDutchOrder": [
            {
                "name": "info",
                "type": "OrderInfo"
            },
            {
                "name": "decayStartTime",
                "type": "uint256"
            },
            {
                "name": "decayEndTime",
                "type": "uint256"
            },
            {
                "name": "exclusiveFiller",
                "type": "address"
            },
            {
                "name": "exclusivityOverrideBps",
                "type": "uint256"
            },
            {
                "name": "inputToken",
                "type": "address"
            },
            {
                "name": "inputStartAmount",
                "type": "uint256"
            },
            {
                "name": "inputEndAmount",
                "type": "uint256"
            },
            {
                "name": "outputs",
                "type": "DutchOutput[]"
            }
        ],
        "OrderInfo": [
            {
                "name": "reactor",
                "type": "address"
            },
            {
                "name": "swapper",
                "type": "address"
            },
            {
                "name": "nonce",
                "type": "uint256"
            },
            {
                "name": "deadline",
                "type": "uint256"
            },
            {
                "name": "additionalValidationContract",
                "type": "address"
            },
            {
                "name": "additionalValidationData",
                "type": "bytes"
            }
        ],
        "DutchOutput": [
            {
                "name": "token",
                "type": "address"
            },
            {
                "name": "startAmount",
                "type": "uint256"
            },
            {
                "name": "endAmount",
                "type": "uint256"
            },
            {
                "name": "recipient",
                "type": "address"
            }
        ],
        "EIP712Domain": [
            {
                "name": "name",
                "type": "string"
            },
            {
                "name": "chainId",
                "type": "uint256"
            },
            {
                "name": "verifyingContract",
                "type": "address"
            }
        ]
    },
    "domain": {
        "name": "Permit2",
        "chainId": "1",
        "verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
    },
    "message": {
        "permitted": {
            "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "amount": "1000000"
        },
        "spender": "0x6000da47483062a0d734ba3dc7576ce6a0b645c4",
        "nonce": "1993349507737061452432783688516964554371214508764223689455774238758175366401",
        "deadline": "1772188326",
        "witness": {
            "info": {
                "reactor": "0x6000da47483062a0d734ba3dc7576ce6a0b645c4",
                "swapper": "0xtainamaina",
                "nonce": "1993349507737061452432783688516964554371214508764223689455774238758175366401",
                "deadline": "1772188326",
                "additionalValidationContract": "0x0000000000000000000000000000000000000000",
                "additionalValidationData": "0x"
            },
            "decayStartTime": "1771583526",
            "decayEndTime": "1771583526",
            "exclusiveFiller": "0x0000000000000000000000000000000000000000",
            "exclusivityOverrideBps": "0",
            "inputToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "inputStartAmount": "1000000",
            "inputEndAmount": "1000000",
            "outputs": [
                {
                    "token": "0x0000000000000000000000000000000000000000",
                    "startAmount": "1000000000000000000",
                    "endAmount": "1000000000000000000",
                    "recipient": "0xtainamaina"
                }
            ]
        }
    },
    "primaryType": "PermitWitnessTransferFrom"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the limit-order signature validation that emits the shown VALIDATION_ERROR and the /^0x[0-9,a-z,A-Z]{130}$/ pattern. Trace the relevant request-validation entry point and any existing validation tests; done means valid smart-account signatures that are not exactly 130 characters are accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.