Skip to content

L2ArbitrumGovernor: Add proposal cancellation and frontrunning protection#365

Open
wildmolasses wants to merge 9 commits intoArbitrumFoundation:delegate-total-poc-fixedfrom
ScopeLift:rebase
Open

L2ArbitrumGovernor: Add proposal cancellation and frontrunning protection#365
wildmolasses wants to merge 9 commits intoArbitrumFoundation:delegate-total-poc-fixedfrom
ScopeLift:rebase

Conversation

@wildmolasses
Copy link

@wildmolasses wildmolasses commented Nov 7, 2025

This PR adds proposal cancellation and frontrunning protection to L2ArbitrumGovernor.

We refactored our audited L2ArbitrumGovernorV2 to make in-place modifications to L2ArbitrumGovernor. Hoping we can get this in for next week's audit, per request. We'd also like to add the tests from our audited branch to the repo, aiming for next week on that.

We've also got an Upgrade proposal script, a GAC for the UpgradeExecutor, etc, but because the governors are already slated for upgrade, these might be unnecessary. For now we won't include them.

Would love to sync as early as Monday with any concerns! Cheers.

garyghayrat and others added 8 commits November 7, 2025 09:41
* Add V2 governor and basic testing, scripts for use later

* Store proposers and revert cancel if not proposer

* Add governor action contract, upgrade script, and tests

* Add `MultiProxyUpgradeAction` contract and upgrade through proxy

* Make fns virtual, mapping internal, and add natspec in GovernorV2

* Fix nits and separate test helper from deployConstants

* Fix nits

* Update naming in gov upgrade action contract

* Fix nits and update constants

* Update src/L2ArbitrumGovernorV2.sol

---------

Co-authored-by: Ed Mazurek <Edward.R.Mazurek@gmail.com>
* Add propose, queue, and execute tests

* Add `vm.assume`s in test
Co-authored-by: Ed Mazurek <Edward.R.Mazurek@gmail.com>
@gzeoneth gzeoneth requested review from Copilot and gzeoneth December 16, 2025 14:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds proposal cancellation functionality and frontrunning protection to the L2ArbitrumGovernor contract. The frontrunning protection mechanism allows proposers to restrict proposal submission to a specific address by including a #proposer=0x... suffix in the proposal description.

Key changes:

  • Implemented cancel() function allowing proposers to cancel their own pending proposals
  • Added frontrunning protection via _isValidDescriptionForProposer() to prevent proposal hijacking
  • Enhanced test coverage with new test contracts for Cancel, Propose, Queue, and Execute operations

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/L2ArbitrumGovernor.sol Added proposers mapping, cancel() function, and frontrunning protection logic in propose()
test/L2ArbitrumGovernor.t.sol Refactored test structure with setUp, helper functions, and comprehensive test suites for cancellation and proposal lifecycle

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +102 to 103
// timelock.initialize(1, stubAddressArray, stubAddressArray);

Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

Remove commented-out code. This line appears to be dead code that should be deleted rather than left as a comment.

Suggested change
// timelock.initialize(1, stubAddressArray, stubAddressArray);

Copilot uses AI. Check for mistakes.
function testFuzz_RevertIf_NotProposer(uint256 _randomSeed, address _actor) public {
address _proposer = createAndMintToProposer(_randomSeed);
vm.assume(_actor != _proposer);
// vm.assume(_actor != proxyAdmin);
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

Remove commented-out code. If this assumption is not needed, the comment should be deleted.

Suggested change
// vm.assume(_actor != proxyAdmin);

Copilot uses AI. Check for mistakes.
Comment on lines +412 to +413
if (47 < c && c < 58) {
return (true, c - 48);
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

Replace magic numbers with named constants for better readability. The ASCII values 47, 58, 48, 64, 71, 55, 96, 103, and 87 should be defined as constants like ASCII_ZERO_MINUS_ONE, ASCII_NINE_PLUS_ONE, ASCII_ZERO, etc.

Copilot uses AI. Check for mistakes.
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.

3 participants