solang icon indicating copy to clipboard operation
solang copied to clipboard

The result of exponentiation with 0 is inconsistent.

Open Subway2023 opened this issue 11 months ago • 0 comments

Version: v0.3.3: Atlantis Description: solc+EVM returns 1, but solang+SVM returns 0.

contract C {
    function f() public pure returns (uint8 x) {
        unchecked {
            return uint8(0)**uint8(uint8(2)**uint8(8));
        }
    }
}

Reproduction: I set up a Solang compilation and execution environment to test the program.

solang/target/debug/vmRunNoPara test.sol C f

The execution error is as follows:

Contract name: C
function new for 75nvYUN1gg1dLpUFA5nKPuQR7cxgoeUH682TsW32Cfx5
input: 872ccdc6190148bc
running bpf with calldata:872ccdc6190148bc
program: 75nvYUN1gg1dLpUFA5nKPuQR7cxgoeUH682TsW32Cfx5
static: length:0 
offset:20 prev:10 next:10 length:0 allocated:0 
thread 'main' panicked at src/tests/solana.rs:1788:9:
assertion `left == right` failed: Number of accounts does not match IDL
  left: 1
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Contract name: C
function new for A2ARo9mp5VLSNzoHwsbMJTYDm6Gt1UftAguqGkqGjcUB
input: 872ccdc6190148bc
running bpf with calldata:872ccdc6190148bc
program: A2ARo9mp5VLSNzoHwsbMJTYDm6Gt1UftAguqGkqGjcUB
static: length:0 
offset:20 prev:10 next:10 length:0 allocated:0 
function f for A2ARo9mp5VLSNzoHwsbMJTYDm6Gt1UftAguqGkqGjcUB
input: 352dd00eb9a6751b
running bpf with calldata:352dd00eb9a6751b
program: A2ARo9mp5VLSNzoHwsbMJTYDm6Gt1UftAguqGkqGjcUB
sol_set_return_data: 00
return: 00
returnType:uint
returnValue:0

Subway2023 avatar Feb 10 '25 06:02 Subway2023