Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
410310ea
Unverified
Commit
410310ea
authored
Oct 24, 2023
by
Maurelian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ctb): Add auth to guard checkAfterExecution
Also added regression tests.
parent
8215444c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
LivenessGuard.sol
packages/contracts-bedrock/src/Safe/LivenessGuard.sol
+3
-1
LivenessGuard.t.sol
packages/contracts-bedrock/test/LivenessGuard.t.sol
+28
-0
No files found.
packages/contracts-bedrock/src/Safe/LivenessGuard.sol
View file @
410310ea
...
...
@@ -60,10 +60,11 @@ contract LivenessGuard is ISemver, BaseGuard {
address gasToken,
address payable refundReceiver,
bytes memory signatures,
address
address
msgSender
)
external
{
msgSender; // silence unused variable warning
require(msg.sender == address(SAFE), "LivenessGuard: only Safe can call this function");
// Cache the set of owners prior to execution.
...
...
@@ -105,6 +106,7 @@ contract LivenessGuard is ISemver, BaseGuard {
/// 1. Add new owners to the lastLive mapping
/// 2. Delete removed owners from the lastLive mapping
function checkAfterExecution(bytes32, bool) external {
require(msg.sender == address(SAFE), "LivenessGuard: only Safe can call this function");
// Get the current set of owners
address[] memory ownersAfter = SAFE.getOwners();
...
...
packages/contracts-bedrock/test/LivenessGuard.t.sol
View file @
410310ea
...
...
@@ -40,6 +40,25 @@ contract LivenessGuard_Getters_Test is LivnessGuard_TestInit {
}
}
contract LivnessGuard_CheckTx_TestFails is LivnessGuard_TestInit {
function test_checkTransaction_callerIsNotSafe_revert() external {
vm.expectRevert("LivenessGuard: only Safe can call this function");
livenessGuard.checkTransaction({
to: address(0),
value: 0,
data: hex"00",
operation: Enum.Operation.Call,
safeTxGas: 0,
baseGas: 0,
gasPrice: 0,
gasToken: address(0),
refundReceiver: payable(address(0)),
signatures: hex"00",
msgSender: address(0)
});
}
}
contract LivnessGuard_CheckTx_Test is LivnessGuard_TestInit {
using SafeTestLib for SafeInstance;
...
...
@@ -63,6 +82,15 @@ contract LivnessGuard_CheckTx_Test is LivnessGuard_TestInit {
}
}
contract LivnessGuard_CheckAfterExecution_TestFails is LivnessGuard_TestInit {
function test_checkAfterExecution_callerIsNotSafe_revert() external {
vm.expectRevert("LivenessGuard: only Safe can call this function");
livenessGuard.checkAfterExecution(bytes32(0), false);
}
}
contract LivnessGuard_CheckAfterExecution_Test is LivnessGuard_TestInit { }
contract LivenessGuard_ShowLiveness_Test is LivnessGuard_TestInit {
function test_showLiveness_succeeds() external {
// Cache the caller
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment