trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.32k forks source link

function return data corrupted in browser #612

Closed ghost closed 6 years ago

ghost commented 7 years ago

Issue

In the browser the return data for a contract function is corrupted. In truffle console it looks ok and also in remix ide. I tried reordering and putting the arrays last, but then they are always empty. Im running truffle with webpack.

Steps to Reproduce

Create a contract

`

  contract Test  {

     function test() public constant returns (bytes32, bytes32, bytes32, bytes32[] memory, bytes16[] memory, bytes16, uint8, bool, uint) {

         bytes16[] memory t = new bytes16[](4);
         bytes32[] memory u  = new bytes32[](4);

         return ("s.title", "s.hash", "s.directory", t, u, "s.category", 120, true, now);
       }
  }

`

Then access the function from the browser

Test.deployed().then((t) => { t.test.call().then((response) => { console.log(response); } });

Expected Behavior

That the data is correct for all the fields in the return data

Actual Results

Browser Screenshot Truffle Console screenshot

Environment

cgewecke commented 6 years ago

@oddmarthon-lende Apologies for the delay in getting to this - I wasn't able to reproduce this issue. When I look at the two images you provided, it seems like the data values are different for several fields in the return object which suggests the issue might be a difference locally - different versions of the same contract perhaps?

Browser

browser 3

Console

console 2

Closing this for house-keeping since it's been open for a while but please re-open if you're still seeing this unusual behavior with the latest Truffle.