ethereum / solidity

Solidity, the Smart Contract Programming Language
https://soliditylang.org
GNU General Public License v3.0
23.29k stars 5.77k forks source link

[isoltest] Formatting should support strings longer than 32 bytes #7197

Open erak opened 5 years ago

erak commented 5 years ago

The following test

contract C {
    function e() public {
        revert("Transaction failed. Transaction failed.");
    }
}
// ====
// EVMVersion: >homestead
// ----
// e() ->

does not handle strings longer than 32 bytes correctly:

// e() -> FAILURE, hex"08c379a0", 0x20, 39, "Transaction failed. Transaction "
chriseth commented 5 years ago

Is this only an issue with error strings or with strings in general?

erak commented 5 years ago

This applies to all strings (error strings aren't handled differently):

contract C {
    function s() public pure returns (string memory) {
        return "A string that is longer than 32 bytes.";
    }
}
// ----
// s() -> 0x20, 38, "A string that is longer than 32 bytes."

Which leads to an exception since the expected value can not be encoded.

Leaving the expected values empty in order to let the auto-update routine fill them in, results in a broken value:

// s() -> 0x20, 38, "A string that is longer than 32 "
mijovic commented 3 years ago

I think this is solved now

axic commented 3 years ago

Aren't those strings still split into 32-byte chunks, e.g. "A string..", "is long...".

mijovic commented 3 years ago

Aren't those strings still split into 32-byte chunks, e.g. "A string..", "is long...".

Yes, they are. But I was thinking back than it wasn't working, so maybe issue is not worth fixing.