GridPlus / gridplus-sdk

SDK for communicating with the GridPlus Lattice1 hardware wallet
MIT License
50 stars 24 forks source link

Incorrect NFT IDs appearing on decoded Lattice screen when using bulk transfer #482

Closed Logic-Beach closed 1 year ago

Logic-Beach commented 1 year ago

When doing batch transfers via the OpenSea: Transfer helper contract: 0x0000000000c2d145a2526bD8C716263bFeBe1A72 (click three dots below an NFT on your OS profile, select 'transfer' then select a few more of the same collection to recreate) Frame wallet shows correct data in raw form, but the decoded tx on the Lattice shows every NFT with the same ID.

Raw Data in Frame (latest and Canary have same affect):

Screenshot 2022-11-15 at 8 08 23 AM

Lattice decoded tx: PXL_20221115_140149139 PXL_20221115_140155439 PXL_20221115_140200211

Logic-Beach commented 1 year ago

Raw Data:

0x32389b7100000000000000000000000000000000000000000000000000000000000000400000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f00000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000600000000000000000000000004fee2114929cd17d69700fadbba765c25e392ddd0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000447433bd197f03be984a6053241ae8d347c5539000000000000000000000000000000000000000000000000000000000000005f000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000447433bd197f03be984a6053241ae8d347c5539000000000000000000000000000000000000000000000000000000000000005e0000000000000000000000000000000000000000000000000000000000000001

alex-miller-0 commented 1 year ago

Turns out this is a problem for all nested, dynamic sized arrays. I took this example from the same contract. Here's how that data should be interpreted:

bulkTransfer(((uint8,address,uint256,uint256)[],address,bool)[],bytes32)
(uint8,address,uint256,uint256)[],address,bool)[]
[0]:  0000000000000000000000000000000000000000000000000000000000000040
bytes32
[1]:  0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000

(uint8,address,uint256,uint256)[],address,bool)[]
[2]:  0000000000000000000000000000000000000000000000000000000000000001 // array size = 1
[3]:  0000000000000000000000000000000000000000000000000000000000000020 // offset = 32 bytes
(uint8,address,uint256,uint256)[]
[4]:  0000000000000000000000000000000000000000000000000000000000000060 // offset = 96 bytes
address
[5]:  000000000000000000000000399883ec45a30af696dd2e2478b0b8301affa64b
bool
[6]:  0000000000000000000000000000000000000000000000000000000000000001

(uint8,address,uint256,uint256)[]
[7]:  0000000000000000000000000000000000000000000000000000000000000002  // array size = 2
uint8
[8]:  0000000000000000000000000000000000000000000000000000000000000002  
address
[9]:  0000000000000000000000009378368ba6b85c1fba5b131b530f5f5bedf21a18
uint256
[10]: 0000000000000000000000000000000000000000000000000000000000002255
uint256
[11]: 0000000000000000000000000000000000000000000000000000000000000001

uint8
[12]: 0000000000000000000000000000000000000000000000000000000000000002
address
[13]: 0000000000000000000000009378368ba6b85c1fba5b131b530f5f5bedf21a18
uint256
[14]: 0000000000000000000000000000000000000000000000000000000000003068
uint256
[15]: 0000000000000000000000000000000000000000000000000000000000000001
alex-miller-0 commented 1 year ago

This is a firmware issue, not an SDK issue. Closing in favor of https://github.com/GridPlus/lattice-firmware/issues/2610