Closed iAmMichaelConnor closed 2 years ago
@MichaelConnorOfficial I'm not being able to reproduce this. I've set up the following contract, and calling into the foo
function both directly and via a proxy works fine:
contract Foo {
function foo(uint256[2][] xss) public pure returns (uint256) {
return xss[0][0] + xss[1][0] + xss[0][1] + xss[1][1];
}
}
I'm using Solidity 0.4.24. Can you share the full code of the contract you are testing with (the one that throws the error, not the one running the Debug), the error you are getting, and the compiler version? Thanks!
Is this issue not solved yet?
This is not an issue, the proxy just forwards all msg.data regardless of the type that it encodes.
I can't get the Proxy contract to correctly do a
delegatecall
to a function which takes a dynamic array as its parameter.Q: Is there a way to edit the Proxy's inline assembly code to correctly forward msg.data which contains a dynamic array? (I really need dynamic arrays to be passed to the contract).
I give a simple example of the problem below:
This is the function which I wish to call through the Proxy contract:
function myDynamicFunction(uint[2][] myArray)
The delegatecall to this fails.
If I remove the 'dynamic' nature of the array, then the function is correctly executed. E.g.:
function myDynamicFunction(uint[2][4] myArray)
(fixed array size of 4).The delegatecall to this works.
Here's what I think the problem is:
Say I want to pass the following array (an array of 4 arrays of 2 elements) to myDynamicFunction:
This is the correct msg.data of a dynamic array, which is passed into the Proxy:
However, I believe the delegatecall reformats this message data into an incorrect format as follows (see the solidity code further below to see how I deduced this in remix):
I deduced the above by inspecting the transaction details of the below in remix:
How can I edit the assembly so that dynamic arrays are passed to the contract correctly, by the Proxy? Current assembly in the proxy: