Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions snapshots/verifyBroadcastMessage.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"EthereumToOptimism": "1642677",
"EthereumToTaikoL2": "1052244",
"LineaL2ToEthereum": "2551806",
"ScrollL2ToEthereum": "1361970",
"EthereumToOptimism": "1642699",
"EthereumToTaikoL2": "1052266",
"LineaL2ToEthereum": "2551828",
"ScrollL2ToEthereum": "1361992",
"ScrollToOptimism": "1352078",
"TaikoL2ToEthereum": "1022307",
"ZkSyncL2ToEthereum": "125693"
"TaikoL2ToEthereum": "1022329",
"ZkSyncL2ToEthereum": "125715"
}
3 changes: 2 additions & 1 deletion src/contracts/StateProverPointer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.30;

import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol";
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this import still needed?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to use Ownable2Steps we need to import both Ownable2Steps and Ownable, because the constructor takes the Ownable:

constructor(address _initialOwner) Ownable(_initialOwner) {}

import {IStateProver} from "./interfaces/IStateProver.sol";
import {IStateProverPointer} from "./interfaces/IStateProverPointer.sol";
Expand All @@ -14,7 +15,7 @@ bytes32 constant STATE_PROVER_POINTER_SLOT = bytes32(uint256(keccak256("eip7888.
/// It enforces version monotonicity to ensure that updates always move to newer versions.
/// The code hash is stored in a dedicated storage slot for efficient cross-chain verification.
/// @custom:security-contact security@openzeppelin.com
contract StateProverPointer is IStateProverPointer, Ownable {
contract StateProverPointer is IStateProverPointer, Ownable2Step {
address internal _implementationAddress;

error NonIncreasingVersion(uint256 newVersion, uint256 oldVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,29 @@ contract StateProverPointerTest is Test {
vm.expectRevert(abi.encodeWithSelector(StateProverPointer.InvalidImplementationAddress.selector));
stateProverPointer.setImplementationAddress(makeAddr("invalid"));
}
}

function test_transferOwnership() public {
address newOwner = makeAddr("newOwner");
vm.prank(owner);
stateProverPointer.transferOwnership(newOwner);
assertEq(stateProverPointer.owner(), owner);
assertEq(stateProverPointer.pendingOwner(), newOwner);

vm.prank(newOwner);
stateProverPointer.acceptOwnership();
assertEq(stateProverPointer.owner(), newOwner);
assertEq(stateProverPointer.pendingOwner(), address(0));

vm.prank(newOwner);
// transfer ownership back to initial owner
stateProverPointer.transferOwnership(owner);
assertEq(stateProverPointer.owner(), newOwner);
assertEq(stateProverPointer.pendingOwner(), owner);

// cancel initiated ownership transfer
vm.prank(newOwner);
stateProverPointer.transferOwnership(address(0));
assertEq(stateProverPointer.owner(), newOwner);
assertEq(stateProverPointer.pendingOwner(), address(0));
}
}