ref-fvm icon indicating copy to clipboard operation
ref-fvm copied to clipboard

Output of non pure/non view functions - potential bug reported in FVM bulletproofing run

Open BlocksOnAChain opened this issue 2 years ago • 4 comments
trafficstars

We tested the following contract in Remix: contract OutputTest {    function test() public returns (uint) {        return 1;    }    function testView() public view returns (uint) {        return 1;    }    function testPure() public pure returns (uint) {        return 1;    }}

We found that when calling the "test" function on Hyperspace, the "decoded output" field is empty, while on EVM, it is not.

However, when calling "testView" and "testPure" functions, the "decoded output" field is populated both on EVM and Hyperspace. Screenshots EVM (1) Hyperspace (1)

BlocksOnAChain avatar Mar 13 '23 10:03 BlocksOnAChain

@maciejwitowski for visibility.

BlocksOnAChain avatar Mar 13 '23 10:03 BlocksOnAChain

We'll need to dig into this a bit more, but I'm guessing this is because the remix VM has a non-standard feature for returning contract output in a receipt.

Stebalien avatar Mar 13 '23 19:03 Stebalien

The "decoded output" field is empty when calling the "test" function on Hyperspace because the "test" function is a non-view function. Non-view functions do not return any data, so the "decoded output" field is not populated.

The "decoded output" field is populated when calling the "testView" and "testPure" functions on both Hyperspace and EVM because the "testView" and "testPure" functions are view functions. View functions return data, but they do not modify the state of the blockchain, so the "decoded output" field is populated.

Abudie12 avatar May 14 '23 08:05 Abudie12

@Abudie12, thanks for sharing.

@Stebalien @maciejwitowski - let me know if this helps and should move the issue to a different status?

BlocksOnAChain avatar May 16 '23 09:05 BlocksOnAChain