trezor / trezor-firmware

:lock: Trezor Firmware Monorepo
https://trezor.io
Other
1.34k stars 653 forks source link

EIP-712 nested arrays support #2963

Open parmesh-shiroya opened 1 year ago

parmesh-shiroya commented 1 year ago

Trezoe Model T is throwing MetaMask Message Signature: Error: Firmware error msg when trying to signTypeData.

Firmware version : 2.5.3

To Reproduce Steps to reproduce the behavior: You can reproduce the issue by going to opensea.io and try to bulk list with more than 3 items. (It works with 2 items) or you can use this site to check max limit. https://seaportsignbulkorders.ryanio.repl.co/. Enter 3 or more in input box and press create orders.

or try to sign the below data with

signer._signTypedData(domain, types, value)

domain :

{
    "name": "Seaport",
    "version": "1.4",
    "chainId": 1,
    "verifyingContract": "0x00000000000001ad428e4906ae43d8f9852d0dd6"
}

types :

{"BulkOrder":[{"name":"tree","type":"OrderComponents[2][2]"}],"OrderComponents":[{"name":"offerer","type":"address"},{"name":"zone","type":"address"},{"name":"offer","type":"OfferItem[]"},{"name":"consideration","type":"ConsiderationItem[]"},{"name":"orderType","type":"uint8"},{"name":"startTime","type":"uint256"},{"name":"endTime","type":"uint256"},{"name":"zoneHash","type":"bytes32"},{"name":"salt","type":"uint256"},{"name":"conduitKey","type":"bytes32"},{"name":"counter","type":"uint256"}],"OfferItem":[{"name":"itemType","type":"uint8"},{"name":"token","type":"address"},{"name":"identifierOrCriteria","type":"uint256"},{"name":"startAmount","type":"uint256"},{"name":"endAmount","type":"uint256"}],"ConsiderationItem":[{"name":"itemType","type":"uint8"},{"name":"token","type":"address"},{"name":"identifierOrCriteria","type":"uint256"},{"name":"startAmount","type":"uint256"},{"name":"endAmount","type":"uint256"},{"name":"recipient","type":"address"}]}

value

{"tree":[[{"offerer":"0xc75499f522bAfB43caaB086F06E8dECd9fb2d212","offer":[{"itemType":2,"token":"0x228d3ae7943b81c76800c482d3273d8b09ab6225","identifierOrCriteria":"1068","startAmount":"1","endAmount":"1"}],"consideration":[{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"895000000000000000","endAmount":"895000000000000000","recipient":"0xc75499f522bAfB43caaB086F06E8dECd9fb2d212"},{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"5000000000000000","endAmount":"5000000000000000","recipient":"0x0000a26b00c1f0df003000390027140000faa719"},{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"100000000000000000","endAmount":"100000000000000000","recipient":"0xdf64f27bb2b8a5127dac6d403a8f92b6f2c8f696"}],"startTime":"1681666086","endTime":"1684178885","orderType":0,"zone":"0x004C00500000aD104D7DBd00e3ae0A5C00560C00","zoneHash":"0x0000000000000000000000000000000000000000000000000000000000000000","salt":"51951570786726798460324975021501917861654789585098516727730927161822071680544","conduitKey":"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000","totalOriginalConsiderationItems":3,"counter":"0"},{"offerer":"0xc75499f522bAfB43caaB086F06E8dECd9fb2d212","offer":[{"itemType":2,"token":"0x228d3ae7943b81c76800c482d3273d8b09ab6225","identifierOrCriteria":"2485","startAmount":"1","endAmount":"1"}],"consideration":[{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"895000000000000000","endAmount":"895000000000000000","recipient":"0xc75499f522bAfB43caaB086F06E8dECd9fb2d212"},{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"5000000000000000","endAmount":"5000000000000000","recipient":"0x0000a26b00c1f0df003000390027140000faa719"},{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"100000000000000000","endAmount":"100000000000000000","recipient":"0xdf64f27bb2b8a5127dac6d403a8f92b6f2c8f696"}],"startTime":"1681666086","endTime":"1684258085","orderType":0,"zone":"0x004C00500000aD104D7DBd00e3ae0A5C00560C00","zoneHash":"0x0000000000000000000000000000000000000000000000000000000000000000","salt":"51951570786726798460324975021501917861654789585098516727728244455681061490544","conduitKey":"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000","totalOriginalConsiderationItems":3,"counter":"0"}],[{"offerer":"0xc75499f522bAfB43caaB086F06E8dECd9fb2d212","offer":[{"itemType":2,"token":"0x228d3ae7943b81c76800c482d3273d8b09ab6225","identifierOrCriteria":"1295","startAmount":"1","endAmount":"1"}],"consideration":[{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"895000000000000000","endAmount":"895000000000000000","recipient":"0xc75499f522bAfB43caaB086F06E8dECd9fb2d212"},{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"5000000000000000","endAmount":"5000000000000000","recipient":"0x0000a26b00c1f0df003000390027140000faa719"},{"itemType":0,"token":"0x0000000000000000000000000000000000000000","identifierOrCriteria":0,"startAmount":"100000000000000000","endAmount":"100000000000000000","recipient":"0xdf64f27bb2b8a5127dac6d403a8f92b6f2c8f696"}],"startTime":"1681666086","endTime":"1684178885","orderType":0,"zone":"0x004C00500000aD104D7DBd00e3ae0A5C00560C00","zoneHash":"0x0000000000000000000000000000000000000000000000000000000000000000","salt":"51951570786726798460324975021501917861654789585098516727729426175207949446544","conduitKey":"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000","totalOriginalConsiderationItems":3,"counter":"0"},{"offerer":"0x0000000000000000000000000000000000000000","zone":"0x0000000000000000000000000000000000000000","offer":[],"consideration":[],"orderType":0,"startTime":0,"endTime":0,"zoneHash":"0x0000000000000000000000000000000000000000000000000000000000000000","salt":0,"conduitKey":"0x0000000000000000000000000000000000000000000000000000000000000000","counter":0}]]}
matejcik commented 1 year ago

"type":"OrderComponents[2][2]"

arrays of arrays are currently not supported on Trezor

parmesh-shiroya commented 1 year ago

"type":"OrderComponents[2][2]"

arrays of arrays are currently not supported on Trezor

Can i get ETA on this. This works on Trezor one. It's just issue with Trezor T.

matejcik commented 1 year ago

This works on Trezor one.

It doesn't really, Trezor One is only signing hashes that someone else has generated. Literally anything will "work" on Trezor One regardless of whether it is even a valid EIP712 message.

Anyway, no ETA for this, sorry

prusnak commented 1 year ago

Anyway, no ETA for this, sorry

Haven't we implemented blind signing on Model T too?

matejcik commented 1 year ago

Haven't we implemented blind signing on Model T too?

We did a draft implementation as a stop-gap in case Metamask couldn't integrate the full featured version, but we solved that one. And we don't really want blind signing on the TT unless there is a very strong need. (in which case prioritizing the effort on this issue would be a better way to go)