Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Contract interaction with tuples not working #1765

Closed
tschubotz opened this issue Jan 11, 2021 · 7 comments · Fixed by #1787
Closed

Contract interaction with tuples not working #1765

tschubotz opened this issue Jan 11, 2021 · 7 comments · Fixed by #1787
Assignees
Labels
Bug 🐛 Something isn't working Major Needs to be fixed for immediate next public release.

Comments

@tschubotz
Copy link
Member

Title/Description

Contract interaction with tuples no working. (It works in the tx builder though)

Environment

Steps to reproduce

  1. Open safe
  2. Click contract interaction
  3. Enter 0x36292b627eb637696c90edd460e49300b099d045 as target
  4. Select func1
  5. Enter [1,2]
  6. Click "review"

Expected result

I end up on review screen and can send the tx

Obtained result

Error (see screenshot)

Screenshots

There is a nice screencase on here: #1028 (comment)

Also:
image.png

@tschubotz tschubotz added Bug 🐛 Something isn't working Major Needs to be fixed for immediate next public release. labels Jan 11, 2021
@tschubotz tschubotz changed the title Contract interaction with tuples no working Contract interaction with tuples not working Jan 11, 2021
@rmeissner
Copy link
Member

So this is working for me, but if there is an error it is shown in the wrong field apparently

image

Abi used was

[
    {
      "anonymous": false,
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "facetAddress",
              "type": "address"
            },
            {
              "internalType": "enum IDiamondCut.FacetCutAction",
              "name": "action",
              "type": "uint8"
            },
            {
              "internalType": "bytes4[]",
              "name": "functionSelectors",
              "type": "bytes4[]"
            }
          ],
          "indexed": false,
          "internalType": "struct IDiamondCut.FacetCut[]",
          "name": "_diamondCut",
          "type": "tuple[]"
        },
        {
          "indexed": false,
          "internalType": "address",
          "name": "_init",
          "type": "address"
        },
        {
          "indexed": false,
          "internalType": "bytes",
          "name": "_calldata",
          "type": "bytes"
        }
      ],
      "name": "DiamondCut",
      "type": "event"
    },
    {
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "facetAddress",
              "type": "address"
            },
            {
              "internalType": "enum IDiamondCut.FacetCutAction",
              "name": "action",
              "type": "uint8"
            },
            {
              "internalType": "bytes4[]",
              "name": "functionSelectors",
              "type": "bytes4[]"
            }
          ],
          "internalType": "struct IDiamondCut.FacetCut[]",
          "name": "_diamondCut",
          "type": "tuple[]"
        },
        {
          "internalType": "address",
          "name": "_init",
          "type": "address"
        },
        {
          "internalType": "bytes",
          "name": "_calldata",
          "type": "bytes"
        }
      ],
      "name": "diamondCut",
      "outputs": [],
      "stateMutability": "nonpayable",
      "type": "function"
    }
  ]

Input value for the tuple array was

[["0x94D998c2Cb35bD4388D1D5Ed71992bF4a802d7a9", 0, ["0x00baddad", "0x00baddad", "0x00baddad"]]]

@Agupane
Copy link
Contributor

Agupane commented Jan 18, 2021

Hey @rmeissner thanks for the inputs, could you send me the contract address that you used for testing those input values?

@rmeissner
Copy link
Member

I didn't use any contract address, why would this be required? You can just paste the abi into the abi field and set any address. The tx would fail if you try to execute it, but that should not be required to test this anyways.

@Agupane
Copy link
Contributor

Agupane commented Jan 19, 2021

I didn't use any contract address, why would this be required? You can just paste the abi into the abi field and set any address. The tx would fail if you try to execute it, but that should not be required to test this anyways.

Just asked because I would like to have a real example to test if it's working or not (including sending the data to the contract) :)

@mmv08
Copy link
Member

mmv08 commented Jan 19, 2021

including sending the data to the contract

Won't web3 throw an error in case it's invalid? (Just curious)

@Agupane
Copy link
Contributor

Agupane commented Jan 19, 2021

Yes that's correct, just wanted to improve the validation client side

@mmv08
Copy link
Member

mmv08 commented Jan 19, 2021

Yes that's correct, just wanted to improve the validation client side

Might try digging in web3.js code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug 🐛 Something isn't working Major Needs to be fixed for immediate next public release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants