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

New InitializedResetter contract #13074

Open
Tracked by #13069
maurelian opened this issue Nov 25, 2024 · 0 comments
Open
Tracked by #13069

New InitializedResetter contract #13074

maurelian opened this issue Nov 25, 2024 · 0 comments

Comments

@maurelian
Copy link
Contributor

maurelian commented Nov 25, 2024

Following #13071, we will be able to simplify the process of resetting contracts initialized value, as they will all use the same slot. Therefore a purpose build version of the StorageSetter can be implemented.

contract InitializedResetter {

	// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
	bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
	
	function reset() external {
	    // Write 0 to the initializer slot
	    assembly {
	        sstore(INITIALIZABLE_STORAGE, 0)
	    }
	}
}

Note: this won't work until after the Isthmus upgrade.

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