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
2 changes: 1 addition & 1 deletion src/mutability/Mutator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ contract Mutator is IMutator, Derived, Pausable {
/// @notice Upgrades the implementation of a proxy and optionally calls its initializer
/// @param implementation New version of contract to be proxied
/// @param data Calldata to invoke the instance's initializer
function upgrade(IImplementation implementation, bytes memory data) public payable onlyOwner {
function upgrade(IImplementation implementation, bytes memory data) public onlyOwner {
ShortString name = ShortStrings.toShortString(implementation.name());
if (_nameToMutable[name] == IMutable(address(0))) revert MutatorInvalidMutable();
_nameToMutable[name].upgrade(implementation, data);
Expand Down
2 changes: 1 addition & 1 deletion src/mutability/interfaces/IMutator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ interface IMutator is IOwnable, IPausable {

function mutables() external view returns (address[] memory);
function create(IImplementation implementation, bytes calldata data) external returns (IMutableTransparent newMutable);
function upgrade( IImplementation implementation, bytes memory data) external payable;
function upgrade( IImplementation implementation, bytes memory data) external;
}
9 changes: 9 additions & 0 deletions test/mutability/Mutator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ contract MutatorTest is MutableTestV1Deploy {
mutator.upgrade(impl2, abi.encode(772));
}

function test_revertsUpgradeWithValue() public {
SampleContractV2 impl2 = new SampleContractV2(201);

vm.deal(owner, 1);
vm.prank(owner);
(bool success,) = address(mutator).call{value: 1}(abi.encodeCall(mutator.upgrade, (impl2, abi.encode(773))));
assertFalse(success, "upgrade should reject ETH");
}

function test_ownerCanPauseAndUnpause() public {
vm.startPrank(owner);
vm.expectEmit();
Expand Down
Loading