question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ABI coder fails to process Vyper-generated tuples

See original GitHub issue

Ethers Version

5.4.0

Search Terms

tuple abi vyper

Describe the Problem

When using structs in external functions in the latest Vyper release (0.3.3), the resulting ABI causes ethers to error out when attempting to encode data for them.

I provide snippets for an example of a constructor that fails in such a way.

Code Snippet

struct MyStruct:
    bar: address
    baz: address
    qux: int256
    qyz: uint256
    bazoo: uint256
    ka: uint256

@external
def __init__(foo: MyStruct[10]):

Contract ABI

{
  "stateMutability": "nonpayable",
  "type": "constructor",
  "inputs": [
    {
      "name": "foo",
      "type": "(address,address,int256,uint256,uint256,uint256)[10]"
    },
  ],
  "outputs": []
}

Errors

Error: invalid type (argument="type", value="(address,address,int256,uint256,uint256,uint256)", code=INVALID_ARGUMENT, version=abi/5.4.0)

Environment

node.js (v12 or newer), Hardhat

Environment (Other)

Vyper

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ricmoocommented, May 30, 2022

Yes, looks like that bug exactly. 😉

My guess is they aren’t using the same ABI generation functions for outputs and inputs, as outputs seem to be correct.

In the meantime, you can write the human-readable ABI to get your code up an running until the compiler is fixed to generate the correct ABI for inputs. Or you can write the JSON ABI, but that’s so much more involved. 😃

const ABI = [
  // You first example with the constructor
  "constructor (tuple(address bar, address baz, int256 qux, uint256 qyz, uint256 bazoo, uint256 ka)[10] foo)",
];
0reactions
ricmoocommented, Jul 14, 2022

This looks like it was fixed in Vyper. I’m going to close this now, but please let me know if there are still any problems. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Head Overflow Bug in Calldata Tuple ABI-Reencoding
The tuple contains at least one dynamic component. E.g. bytes or a struct containing a dynamic array. The code is using ABI coder...
Read more >
Nicolás Venturo (@mrnventuro) / Twitter
ABI coder fails to process Vyper-generated tuples · Issue #3032 · ethers-io/ethers.js. Ethers Version 5.4.0 Search Terms tuple abi vyper Describe the ...
Read more >
AbiCoder - Ethers.js
The AbiCoder is a collection of Coders which can be used to encode and decode the binary data formats used to interoperate between...
Read more >
Nested tuples with go-ethereum abi package
Is it possible to use the go-ethereum accounts/abi package to encode nested tuples? Say I have a Solidity struct
Read more >
Add support to generate bgpd corefile for CI - Metallb/Metallb
ABI coder fails to process Vyper-generated tuples, 9, 2022-05-28, 2022-07-27. A question about prompt-based BARTScore, 2, 2021-12-10, 2022-01-02.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found