eth.rb
eth.rb copied to clipboard
Arrays currently unimplemented for EIP-712
Hi, is there a plan to implement arrays as per signTypedData_v4?
Hi, can you give me an example that fails?
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.
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. 🙏🏼
@q9f 🙏
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.
still looking for testdata
- https://ethereum.stackexchange.com/questions/78222/eip-712-typed-signature-for-arrays
- https://stackoverflow.com/questions/58257459/solidity-web3js-eip712-signing-uint256-works-signing-uint256-does-not
- https://ethereum.stackexchange.com/questions/125105/singing-an-array-whit-eth-signtypeddata-v4
This requires packed abi encoding: #103
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}}
Thanks. It will take some time to fix as we need to write a packed ABI encoder for Ruby first.
Hi! I'm running into this problem as well. Just curious if a fix is still in progress. Thanks! Love the gem!
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.
@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.