Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays currently unimplemented for EIP-712 #127

Open
davyfitz opened this issue Jun 29, 2022 · 12 comments
Open

Arrays currently unimplemented for EIP-712 #127

davyfitz opened this issue Jun 29, 2022 · 12 comments
Labels
blocked bug Something isn't working help wanted Extra attention is needed spec-tests

Comments

@davyfitz
Copy link

Hi, is there a plan to implement arrays as per signTypedData_v4?

@q9f
Copy link
Owner

q9f commented Jun 30, 2022

Hi, can you give me an example that fails?

@q9f q9f added the bug Something isn't working label Jun 30, 2022
@davyfitz
Copy link
Author

I can't share too much info, but the sign_typed_data method is not up to date with the V4 standard, as outlined here:

https://docs.metamask.io/guide/signing-data.html#sign-typed-data-v4

Specifically I'm hitting this error in eip712.rb

raise NotImplementedError, "Arrays currently unimplemented for EIP-712." if type.end_with? "]"

It's not a huge problem, I've found a JS workaround for my use-case. But it would be nice if I could keep it all within the Ruby app.

@q9f
Copy link
Owner

q9f commented Jul 1, 2022

I'm asking because I only add NotImplementedError to the codebase if I cannot find any specification or test case. The link you posted does not contain much information.

So, if this is not too much to ask, I would like to see some test data (you can randomize the content), so that I can write a test case so that I can implement the feature completely. 🙏🏼

@gith-u-b
Copy link

gith-u-b commented Jul 12, 2022

@q9f 🙏

@q9f
Copy link
Owner

q9f commented Sep 26, 2022

I don't have a test case for this. If you can show me an array that raises the NotImplementedError above, please post it here so I can work on a patch. Otherwise it will be hard for me to reproduce as I explained in the comment above.

@q9f q9f added spec-tests help wanted Extra attention is needed labels Dec 29, 2022
@q9f
Copy link
Owner

q9f commented Jan 17, 2023

This requires packed abi encoding: #103

@q9f q9f added the blocked label Jan 17, 2023
@zackisaacs
Copy link

I'm also excited for this one. I'm currently unable to sign OpenSea orders because the request requires multiple Consideration and Offer items. Here is sample data, if you're still looking for some:

{:types=>
  {: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"}],
   :EIP712Domain=>
    [{:name=>"name", :type=>"string"},
     {:name=>"version", :type=>"string"},
     {:name=>"chainId", :type=>"uint256"},
     {:name=>"verifyingContract", :type=>"address"}]},
 :domain=>{:name=>"Seaport", :version=>"1.1", :chainId=>1, :verifyingContract=>"0x00000000006c3852cbef3e08e8df289169ede581"},
 :primaryType=>"OrderComponents",
 :message=>
  {:offerer=>"0x0000000000000000000000000000000000000001",
   :zone=>"0x0000000000000000000000000000000000000000",
   :zoneHash=>"0x0000000000000000000000000000000000000000000000000000000000000000",
   :offer=>[{:itemType=>2, :token=>"0x0000000000000000000000000000000000000002", :identifierOrCriteria=>2, :startAmount=>1, :endAmount=>1}],
   :consideration=>
    [{:itemType=>0,
      :identifierOrCriteria=>0,
      :startAmount=>9750000000000000000,
      :endAmount=>9750000000000000000,
      :recipient=>"0x0000000000000000000000000000000000000003"},
     {:itemType=>0,
      :identifierOrCriteria=>0,
      :startAmount=>250000000000000000,
      :endAmount=>250000000000000000,
      :recipient=>"0x0000000000000000000000000000000000000004"}],
   :salt=>12686911856931635052326433555881236148,
   :conduitKey=>"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",
   :nonce=>0}} 

@q9f
Copy link
Owner

q9f commented Feb 28, 2023

Thanks. It will take some time to fix as we need to write a packed ABI encoder for Ruby first.

@RogerPodacter
Copy link

Hi! I'm running into this problem as well. Just curious if a fix is still in progress. Thanks! Love the gem!

@geraldb
Copy link

geraldb commented Jan 21, 2024

we need to write a packed ABI encoder for Ruby first.

fyi: happy to help (but unfortunately i already spend hundreds of free hours without ever getting anything back - surprise, surprise - not sustainable. if there's a sponsor with modest pay i am happy to continue - see here -> https://github.com/rubycocos/blockchain/tree/master/abicoder . note: as always - i am the gem guy / nutcase, that is, trying to modularize - to make testing and (re)use easier.

@q9f
Copy link
Owner

q9f commented Jan 22, 2024

@geraldb I also spend hundreds of free hours without ever getting anything back, and I'm sure we both are not the only two open-source maintainers who suffer this fate. This is not a job fair, so please move on unless you'd like to contribute to this issue for free (as we all do). There is no funding available for this gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked bug Something isn't working help wanted Extra attention is needed spec-tests
Projects
None yet
Development

No branches or pull requests

6 participants