From 68989f93429b633df660a74622d5440138653cc0 Mon Sep 17 00:00:00 2001 From: Vectorized Date: Wed, 2 Oct 2024 17:54:48 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Make=20Pod=20mothership=20?= =?UTF-8?q?internal=20(#1101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/accounts/Pod.sol | 4 ++-- test/utils/mocks/MockPod.sol | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/accounts/Pod.sol b/src/accounts/Pod.sol index 4963e6125..18257b8a0 100644 --- a/src/accounts/Pod.sol +++ b/src/accounts/Pod.sol @@ -43,7 +43,7 @@ abstract contract Pod is Receiver { /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the mothership contract. - function mothership() public view virtual returns (address result) { + function _mothership() internal view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := shr(96, sload(_MOTHERSHIP_SLOT)) @@ -78,7 +78,7 @@ abstract contract Pod is Receiver { /// @dev Requires that the caller is the mothership. /// This is called in the `onlyMothership` modifier. function _checkMothership() internal view virtual { - if (msg.sender != mothership()) revert CallerNotMothership(); + if (msg.sender != _mothership()) revert CallerNotMothership(); } /// @dev Requires that the caller is the mothership. diff --git a/test/utils/mocks/MockPod.sol b/test/utils/mocks/MockPod.sol index 6ac0d8c3b..403350ac4 100644 --- a/test/utils/mocks/MockPod.sol +++ b/test/utils/mocks/MockPod.sol @@ -7,6 +7,10 @@ import {Brutalizer} from "../Brutalizer.sol"; /// @dev WARNING! This mock is strictly intended for testing purposes only. /// Do NOT copy anything here into production code unless you really know what you are doing. contract MockPod is Pod, Brutalizer { + function mothership() public view returns (address) { + return _mothership(); + } + function initializeMothership(address initialMothership) public { _initializeMothership(_brutalized(initialMothership)); }