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

IR-based codegen: Modifying the length of a dynamic array to a large number in assembly, followed by a push() operation, will cause a revert. #15417

Open
Subway2023 opened this issue Sep 9, 2024 · 0 comments
Labels

Comments

@Subway2023
Copy link

  • Compiler version: 0.8.27
  • Target EVM version (as per compiler settings): None
  • Framework/IDE (e.g. Truffle or Remix): Remix
  • EVM execution environment / backend / blockchain client: None
  • Operating system: None

Steps to Reproduce

contract A {
    int[] public a;
    function f() public  {
        assembly {
            let converted := 14
            let _1 := 50
            sstore(0, keccak256(_1, converted))
            // sstore(0, 1)
        }
        a.push(2);
    }
}

Remix

Legacy codegen

image

IR-based codegen

image

  1. If we comment out a.push(2), transaction will not revert
  2. If replaced with sstore(0, 1), it still will not revert
@ethereum ethereum deleted a comment Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant