Skip to content

test: add integration test for proposals which need ETH#80

Merged
thelostone-mc merged 5 commits intoaudit-fixesfrom
timelock-eth-test
Aug 28, 2025
Merged

test: add integration test for proposals which need ETH#80
thelostone-mc merged 5 commits intoaudit-fixesfrom
timelock-eth-test

Conversation

@thelostone-mc
Copy link
Copy Markdown
Contributor

  • scenario where timelock has eth
  • scenario when eth is sent along with execute

To be merged after the medium severity issues are resolved

@thelostone-mc thelostone-mc requested a review from apbendi August 19, 2025 08:08
@thelostone-mc thelostone-mc changed the base branch from audit-fixes to m-03 August 21, 2025 08:58
@thelostone-mc thelostone-mc force-pushed the timelock-eth-test branch 2 times, most recently from 9ceca0c to 781a1e4 Compare August 21, 2025 09:33
@thelostone-mc thelostone-mc marked this pull request as ready for review August 21, 2025 09:33
Copy link
Copy Markdown
Member

@apbendi apbendi left a comment

Choose a reason for hiding this comment

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

Looks good, a couple of thoughts on how we can expand these as fuzz tests


/// @notice Test that a proposal requiring ETH works when we send ETH along with the execute call
/// @dev This test demonstrates the scenario where ETH is sent WITH the execute call (not FROM the timelock)
function test_ProposalRequiringEth_WorksWhenEthIsSentAlongWithExecuteCall() external {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we fuz the amount required here? And fuzz the executor to show it can be any address.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Did this but it's causing the test to run 30min +

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ended breaking the test into 2 tests where 1 we fuzz the executor and the other we fuzz the amount

Base automatically changed from m-03 to audit-fixes August 21, 2025 16:26
@thelostone-mc thelostone-mc force-pushed the timelock-eth-test branch 3 times, most recently from f6e9f03 to 972141c Compare August 22, 2025 15:40
- scenario where timelock has eth
- scenario when eth is sent along with execute
Copy link
Copy Markdown
Member

@apbendi apbendi left a comment

Choose a reason for hiding this comment

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

A couple small comments but overall looking good

/// @notice Internal helper function to test ETH proposal execution
/// @dev This contains the core test logic that can be reused by different fuzz tests
function _testProposalRequiringEthAndEthIsSentWithExecuteCall(uint256 _requiredEthAmount, address _executor) internal {
// 0. Verify initial state - contract should have no ETH initially
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: comment implies we're verifying, but we're just recording/saving the balance, not verifying them in any way.

govHelper.submitPassAndQueue(proposer, ethProposal);

// 4. Execute with ETH using the specified executor
if (_executor != address(this)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the point of this check? Why does it matter if the fuzzer chooses the test contract address?

@github-actions
Copy link
Copy Markdown

Coverage after merging timelock-eth-test into audit-fixes will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   RollbackManager.sol100%100%100%100%
   RollbackManagerTimelockCompound.sol100%100%100%100%
   RollbackManagerTimelockControl.sol100%100%100%100%
   TimelockMultiAdminShim.sol100%100%100%100%

@thelostone-mc thelostone-mc merged commit 9e4da60 into audit-fixes Aug 28, 2025
6 checks passed
@thelostone-mc thelostone-mc deleted the timelock-eth-test branch August 28, 2025 05:39
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

Successfully merging this pull request may close these issues.

2 participants