Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying slot causes execution error. #1735

Open
Subway2023 opened this issue Feb 10, 2025 · 0 comments
Open

Modifying slot causes execution error. #1735

Subway2023 opened this issue Feb 10, 2025 · 0 comments

Comments

@Subway2023
Copy link

Version: v0.3.3: Atlantis
Description: If _data.slot := slot is commented out, the error does not occur.

contract C {
    struct S {
        uint a;
        uint b;
    }

    mapping(uint => S) public mappingAccess;

    function data() internal view returns (S storage _data) {
        _data = mappingAccess[20];

        bytes32 slot = keccak256(abi.encode(uint(1), uint(0)));
        assembly {
            // _data.slot := slot
        }
    }

    function get() public view returns (uint) {
        return data().a;
    }
}

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

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

The execution error is as follows:

Contract name: C
function new for tVdNkXJPLk3bGwfGamfSaArTJj3buT5TUUZmUK6WDd6
input: 872ccdc6190148bc
running bpf with calldata:872ccdc6190148bc
program: tVdNkXJPLk3bGwfGamfSaArTJj3buT5TUUZmUK6WDd6
static: length:3f0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
offset:410 prev:10 next:10 length:0 allocated:0 
thread 'main' panicked at src/tests/solana.rs:1778:52:
account 'systemProgram' is missing
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
function_call_with_account causes error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant