Closed xhliu closed 2 years ago
pragma solidity ^0.8.10;
contract SimpleStorage {
uint storedData;
function foo() public {
if (true) return;
int a = 1;
}
function foo1() external {
if (true) return;
int a = 1;
}
}
now this code will be transpile to
contract SimpleStorage {
@state
int storedData;
function foo() : bool {
bool ret = false;
bool returned = false;
if (true) {
{
ret = true;
returned = true;
}
}
if (!returned) {
int a = 1;
}
return ret;
}
public function foo1(SigHashPreimage txPreimage) {
bool ret = false;
bool returned = false;
if (true) {
{
ret = true;
returned = true;
}
}
if (!returned) {
int a = 1;
}
require(this.propagateState(txPreimage));
}
function propagateState(SigHashPreimage txPreimage) : bool {
require(Tx.checkPreimage(txPreimage));
bytes outputScript = this.getStateScript();
bytes output = Utils.buildOutput(outputScript, SigHash.value(txPreimage));
return hash256(output) == SigHash.hashOutputs(txPreimage);
}
}
This is wrong. This should not fail:
_Originally posted by @xhliu in https://github.com/sCrypt-Inc/sol2scrypt/pull/123#discussion_r817098907_