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

Dataclass conversion error (regression introduced on 0.7.6) #2008

Closed
0rtis opened this issue Apr 16, 2024 · 4 comments · Fixed by #2010
Closed

Dataclass conversion error (regression introduced on 0.7.6) #2008

0rtis opened this issue Apr 16, 2024 · 4 comments · Fixed by #2010
Labels
category: bug Something isn't working

Comments

@0rtis
Copy link

0rtis commented Apr 16, 2024

Environment information

  • OS: linux
  • Python Version: 3.11.9
  • ape and plugin versions:
$ ape --version
# 0.7.15
 
$ ape plugins list
# Installed Plugins
  solidity 0.7.1
  • Contents of your ape-config.yaml:
$ cat ape-config.yaml
# name: regression
default_ecosystem: ethereum
test:
  mnemonic: "test test test test test test test test test test test junk"
  number_of_accounts: 10
compiler:
  ignore_files:
    - "*.md"
    - "*.adoc"
plugins:
  - name: solidity
solidity:
  version: 0.8.24

What went wrong?

A regression was introduced on data class conversion starting version 0.7.6 of eth-ape. Retrieving a struct cause an error TypeError: non-default argument 'datas' follows default argument.

Reproducible example

The following example will cause an error when running ape test with any version >= 0.7.6
Version 0.7.5 is unaffected

Solidity file
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


contract MultiSig {

   struct MultiSigCall {
        uint id;
        address [] targets;
        uint [] values;
        bytes [] datas;
        address [] approvals;
        bool executed;
    }

    mapping(uint => MultiSigCall) multiSigCalls;

    uint public nextProposalId = 1;


    function initMultiSigCall(MultiSigCall memory proposal) public returns(uint) {
        proposal.id = nextProposalId;
        multiSigCalls[nextProposalId++] = proposal;
        return proposal.id;
    }

    function getMultiSigCall(uint proposalId) public view returns(MultiSigCall memory) {
        return multiSigCalls[proposalId];
    }

    receive() external payable {}

    fallback() external payable {}

}
Test file
def test_multisig(accounts, project):

    eoa = accounts[0]
    multisig = eoa.deploy(project.MultiSig)


    original_multisig_call = (0, ['0xf091867EC603A6628eD83D274E835539D82e9cc8'], [0], ['0xa9059cbb000000000000000000000000a5c0067121b222d1303b00bdd750424874e8be6f0000000000000000000000000000000000000000000000000dfdf13250603400'], ['0x3524727d39a6344C44a33Ea99862c8791a703D25'], False)

    multisig.initMultiSigCall(original_multisig_call, sender=eoa)
    multisig_call = multisig.getMultiSigCall(1) # this fails with any version >= 0.7.6
@0rtis 0rtis added the category: bug Something isn't working label Apr 16, 2024
Copy link

linear bot commented Apr 16, 2024

@0rtis 0rtis changed the title Dataclass conversion error (regression introduced 0.7.6) Dataclass conversion error (regression introduced on 0.7.6) Apr 16, 2024
@antazoey
Copy link
Member

Trying to figure out what EVM version to use as well what provider.

  • Tried running on ::test but getting Invalid opcode 0x5e @ 2297
  • Tried running on ::foundry but got EVM error NotActivated
    ** Ran foundryup and retried: was able to reproduce!

@antazoey
Copy link
Member

figured out it is related to values in the struct conflicting with values method.

@0rtis
Copy link
Author

0rtis commented Apr 16, 2024

@antazoey Thank you ! I suggest to ask for the test provider in the bug report template. It completely skipped my mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants