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

fix:complex calls #31

Merged
merged 2 commits into from
Jul 14, 2022
Merged

fix:complex calls #31

merged 2 commits into from
Jul 14, 2022

Conversation

kanej
Copy link
Member

@kanej kanej commented Jul 13, 2022

To allow m.call(...) calls against overloaded functions we now support the following syntax:

m.call(resolver, "setAddr(bytes32,address)", {
  args: [resolverNode, resolver],
});

Technical details

The invocation using the setAddr(bytes32,address) was fine, but failed the initial validation. This fix is to the validation code.

Add tests for the `m.call(...)` function in core.
Don't block validation on overloaded functions invoked with args i.e.
`example(uint256,bool)`.
@kanej kanej requested review from fvictorio and zoeyTM July 13, 2022 13:46
Copy link
Contributor

@zoeyTM zoeyTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fvictorio
Copy link
Member

Repeating here what I said to John in the chat just for the record:

I think using the signature like this is fine, and that the alternative of trying to use the value of the args array to determine which overload to use seems super complex and it might have a lot of weird edge cases (or maybe not, but it's really hard to tell in advance).

@kanej kanej removed the request for review from fvictorio July 14, 2022 10:07
@kanej kanej merged commit cf3f522 into main Jul 14, 2022
@kanej kanej deleted the fix/complex-calls branch July 14, 2022 10:10
@MatiFalcone
Copy link

I have the following module:

function createPoap(m: IgnitionModuleBuilder) {

  const proxyAdminOwner = m.getAccount(0);

  const name = m.getParameter('name');
  const symbol = m.getParameter('symbol');

  const poapContract = m.contract('Poap', [
    name,
    symbol,
    proxyAdminOwner
  ]);

  // Initialize
  const baseUri = m.getParameter('baseUri');
  m.call(poapContract, "initialize", [baseUri, []]);

  return { poapContract };
}

And I am getting this error:

Poap#Poap.initialize:
 - IGN710: Function 'initialize' is overloaded in contract Poap. Please use one of these names instead:

 - initialize()
 - initialize(string,address[])
 - initialize(address)

But when I changed it to the function I want to execute (initialize(string,address[])) I get:

IgnitionError: IGN702: Module validation failed with reason: The function name "initialize(string,address[])" is invalid, make sure you use a valid identifier.

How can I execute that function?

@kanej
Copy link
Member Author

kanej commented May 20, 2024

Can you paste a version of the Solidity code of your contract?

Are you able to invoke the initialize(address) version if you change the parameter list? To exclude the issue being a bug with Ignition dealing with address[] incorrectly.

@kanej kanej added the status:needs-more-information There isn't enough information to start working on this issue label May 20, 2024
@matias-gmg
Copy link

The version of Solidity I am using is 0.8.24 and when I call initialize(address) everything works as expected.

@matias-gmg
Copy link

@kanej based on this issue, it looks like there is a bug with Ignition dealing with any [] type.

@SyedAsadKazmi
Copy link

Kindly please see to it, @kanej. Thanks.

@kanej kanej removed the status:needs-more-information There isn't enough information to start working on this issue label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants