Skip to content

Commit 8095770

Browse files
committed
evm: remove comments; remove irrelevant error
1 parent 90bcbce commit 8095770

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

evm/src/contracts/CircleIntegration/Governance.sol

-26
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import {
2020
abstract contract Governance is IGovernance, State, ERC1967Upgrade {
2121
using BytesParsing for bytes;
2222

23-
error UnsupportedGovernanceAction();
24-
2523
uint16 constant GOVERNANCE_CHAIN = 1;
2624
bytes32 constant GOVERNANCE_EMITTER =
2725
0x0000000000000000000000000000000000000000000000000000000000000004;
@@ -42,32 +40,23 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
4240
// unless the target chain is 0 (which means all chains).
4341
uint16 targetChain;
4442
(targetChain, offset) = vaa.payload.asUint16Unchecked(offset);
45-
46-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
4743
require(targetChain == 0 || targetChain == _chainId, "invalid target chain");
4844

4945
uint16 foreignChain;
5046
(foreignChain, offset) = vaa.payload.asUint16Unchecked(offset);
51-
52-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
5347
require(foreignChain != 0 && foreignChain != _chainId, "invalid chain");
5448

5549
mapping(uint16 => bytes32) storage registeredEmitters = getRegisteredEmitters();
5650

5751
// For now, ensure that we cannot register the same foreign chain again.
58-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
5952
require(registeredEmitters[foreignChain] == 0, "chain already registered");
6053

6154
bytes32 foreignAddress;
6255
(foreignAddress, offset) = vaa.payload.asBytes32Unchecked(offset);
63-
64-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
6556
require(foreignAddress != 0, "emitter cannot be zero address");
6657

6758
uint32 cctpDomain;
6859
(cctpDomain, offset) = vaa.payload.asUint32Unchecked(offset);
69-
70-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
7160
require(cctpDomain != _localCctpDomain, "domain == localDomain()");
7261

7362
_checkLength(vaa.payload, offset);
@@ -102,14 +91,10 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
10291
// contract upgrades should only be relevant for this contract's chain ID
10392
uint16 targetChain;
10493
(targetChain, offset) = vaa.payload.asUint16Unchecked(offset);
105-
106-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
10794
require(targetChain == _chainId, "invalid target chain");
10895

10996
bytes32 encodedImplementation;
11097
(encodedImplementation, offset) = vaa.payload.asBytes32Unchecked(offset);
111-
112-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
11398
require(bytes12(encodedImplementation) == 0, "invalid address");
11499

115100
_checkLength(vaa.payload, offset);
@@ -125,7 +110,6 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
125110
abi.encodeWithSignature("circleIntegrationImplementation()")
126111
);
127112

128-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
129113
require(queried.length == 32, "invalid implementation");
130114
require(
131115
abi.decode(queried, (bytes32)) == keccak256("circleIntegrationImplementation()"),
@@ -141,8 +125,6 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
141125
// call initialize function of the new implementation
142126
(bool success, bytes memory reason) =
143127
newImplementation.delegatecall(abi.encodeWithSignature("initialize()"));
144-
145-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
146128
require(success, string(reason));
147129

148130
emit ContractUpgraded(currentImplementation, newImplementation);
@@ -180,41 +162,33 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
180162
uint8 action
181163
) private view returns (IWormhole.VM memory vaa, uint256 offset) {
182164
// Make sure the blockchain has not forked.
183-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
184165
require(block.chainid == _evmChain, "invalid evm chain");
185166

186167
// verify the governance message
187168
bool valid;
188169
string memory reason;
189170
(vaa, valid, reason) = _wormhole.parseAndVerifyVM(encodedVaa);
190-
191-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
192171
require(valid, reason);
193172

194173
// Confirm that the governance message was sent from the governance contract.
195-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
196174
require(vaa.emitterChainId == GOVERNANCE_CHAIN, "invalid governance chain");
197175
require(vaa.emitterAddress == GOVERNANCE_EMITTER, "invalid governance contract");
198176

199177
// Confirm that this governance action has not been consumed already.
200-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
201178
require(!consumedVaas[vaa.hash], "governance action already consumed");
202179

203180
bytes32 govModule;
204181
(govModule, offset) = vaa.payload.asBytes32Unchecked(offset);
205182

206-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
207183
require(govModule == GOVERNANCE_MODULE, "invalid governance module");
208184

209185
uint8 govAction;
210186
(govAction, offset) = vaa.payload.asUint8Unchecked(offset);
211187

212-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
213188
require(govAction == action, "invalid governance action");
214189
}
215190

216191
function _checkLength(bytes memory encoded, uint256 expected) private pure {
217-
// NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
218192
require(encoded.length == expected, "invalid governance payload length");
219193
}
220194

0 commit comments

Comments
 (0)