reach-lang icon indicating copy to clipboard operation
reach-lang copied to clipboard

The Solidity compiler failed with the message: Error: Invalid type for argument in function call. Invalid implicit conversion from struct T32 memory to struct T36 memory.

Open MetaB0y opened this issue 3 years ago • 1 comments
trafficstars

I have a bunch of parallelReduces (6 in a row). The last two are very simple, it is

  const [needToConfiscate] = parallelReduce([!fullUnlock])
    .invariant(true)
    .while(needToConfiscate)
    .api_(Api.confiscate, () => {
      check(this == metaLabsAddress);

      return [
        (callback) => {
          callback(null);
          transfer([[balance(token), token]]).to(this);
          return [false];
        },
      ];
    });

  const [needToPay] = parallelReduce([!fullUnlock])
    .paySpec([wALGO])
    .invariant(true)
    .while(needToPay)
    .api_(Api.payAndRelease, (amount) => {
      check(this == metaLabsAddress);

      return [
        [0, [amount, wALGO]],
        (callback) => {
          callback(null);
          return [false];
        },
      ];
    })

It causes

The Solidity compiler failed with the message:
 
Error: Invalid type for argument in function call. Invalid implicit conversion from struct T32 memory to struct T36 memory requested.
   --> /tmp/reachc-sol-da154d2a4bf5dd20/compiled.sol:1691:10:
    |
1691 |       l6(la);
    |          ^^
    
CallStack (from HasCallStack):
 error, called at src/Reach/Util.hs:65:3 in reach-0.1.11-CbDshw3EQf7JLMU6TWlPrY:Reach.Util
 impossible, called at src/Reach/Connector/ETH_Solidity.hs:1867:13 in reach-0.1.11-CbDshw3EQf7JLMU6TWlPrY:Reach.Connector.ETH_Solidity

It is the initialization of needToPay with !fullUnlock in the second parallelReduce which causes the issue (if I change it to parallelReduce([true]), it compiles). What is weird that I have the same initialization of needToConfiscate in the first parallelReduce and it doesn't cause problems.

I hope that this information is enough to debug, if not please tell me and I will try to provide more details.

MetaB0y avatar Jun 23 '22 08:06 MetaB0y

Sorry, this isn't enough information. Can you email me a gist or link to your code so I can investigate it?

jeapostrophe avatar Jun 25 '22 16:06 jeapostrophe

I just messaged you on Discord about getting a copy of the program too. I'm going to close this since I haven't heard from you. Please feel free to reopen if you can get the program (I'll do that too if you resend it).

jeapostrophe avatar Aug 12 '22 18:08 jeapostrophe

I provided the program which demonstrates this bug privately. I don't think I have permissions to reopen though.

MetaB0y avatar Aug 14 '22 08:08 MetaB0y

Thank you!

jeapostrophe avatar Aug 14 '22 11:08 jeapostrophe