refactor: extract _broadcast, fix cross-chain dispatch bugs#121
Merged
refactor: extract _broadcast, fix cross-chain dispatch bugs#121
Conversation
Consolidates duplicated 15-line satellite dispatch pattern from 3 cross-chain functions (upgradeBeaconCrossChain, addContractTypeCrossChain, adminCallCrossChain) into single internal _broadcast function. Reduces ~40 lines of code duplication and eliminates a class of copy-paste bugs. Changes: - Simplify event signatures: remove per-satellite domain/messageId params, emit once per operation - Add activeSatelliteCount storage cache to eliminate double satellite iteration - Extract _broadcast(payload, preBalance) internal function - Remove _feePerActiveSatellite() helper (no longer needed) - Fix bug: NoActiveSatellites always reverts when count==0, not only when msg.value>0 - Add 4 new tests for NoActiveSatellites revert behavior - Update 4 existing tests that expected success with 0 satellites Cross-chain message types now correctly defined: MSG_UPGRADE_BEACON (0x01), MSG_ADD_CONTRACT_TYPE (0x02), MSG_ADMIN_CALL (0x03). Also includes testnet E2E infrastructure: new deploy-testnet.sh, InfraUpgradeE2E, TriggerAdminCall, VerifyAdminCall scripts for testing cross-chain infrastructure upgrades on Sepolia/Base testnets. Co-Authored-By: Claude Haiku 4.5 <[email protected]>
Contributor
Coverage Report
Coverage by file
|
Include GovernanceFactory, AccessFactory, ModulesFactory, HatsTreeSetup, and PasskeyFactory in deploy-testnet.sh output so all indexed contract addresses are visible after deployment. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_broadcastinternal, eliminating ~40 lines of copy-paste codeNoActiveSatellitesnow always reverts whenactiveSatelliteCount == 0(previously only reverted when ETH was sent, allowing governance to silently upgrade only the home chain)activeSatelliteCountstorage cache andSatelliteNotActiveguard on double-remove to prevent counter corruptionTest plan
forge build --skip testcompiles cleanly🤖 Generated with Claude Code