@@ -42,32 +42,23 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
42
42
// unless the target chain is 0 (which means all chains).
43
43
uint16 targetChain;
44
44
(targetChain, offset) = vaa.payload.asUint16Unchecked (offset);
45
-
46
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
47
45
require (targetChain == 0 || targetChain == _chainId, "invalid target chain " );
48
46
49
47
uint16 foreignChain;
50
48
(foreignChain, offset) = vaa.payload.asUint16Unchecked (offset);
51
-
52
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
53
49
require (foreignChain != 0 && foreignChain != _chainId, "invalid chain " );
54
50
55
51
mapping (uint16 => bytes32 ) storage registeredEmitters = getRegisteredEmitters ();
56
52
57
53
// 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.
59
54
require (registeredEmitters[foreignChain] == 0 , "chain already registered " );
60
55
61
56
bytes32 foreignAddress;
62
57
(foreignAddress, offset) = vaa.payload.asBytes32Unchecked (offset);
63
-
64
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
65
58
require (foreignAddress != 0 , "emitter cannot be zero address " );
66
59
67
60
uint32 cctpDomain;
68
61
(cctpDomain, offset) = vaa.payload.asUint32Unchecked (offset);
69
-
70
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
71
62
require (cctpDomain != _localCctpDomain, "domain == localDomain() " );
72
63
73
64
_checkLength (vaa.payload, offset);
@@ -102,14 +93,10 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
102
93
// contract upgrades should only be relevant for this contract's chain ID
103
94
uint16 targetChain;
104
95
(targetChain, offset) = vaa.payload.asUint16Unchecked (offset);
105
-
106
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
107
96
require (targetChain == _chainId, "invalid target chain " );
108
97
109
98
bytes32 encodedImplementation;
110
99
(encodedImplementation, offset) = vaa.payload.asBytes32Unchecked (offset);
111
-
112
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
113
100
require (bytes12 (encodedImplementation) == 0 , "invalid address " );
114
101
115
102
_checkLength (vaa.payload, offset);
@@ -125,7 +112,6 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
125
112
abi.encodeWithSignature ("circleIntegrationImplementation() " )
126
113
);
127
114
128
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
129
115
require (queried.length == 32 , "invalid implementation " );
130
116
require (
131
117
abi.decode (queried, (bytes32 )) == keccak256 ("circleIntegrationImplementation() " ),
@@ -141,8 +127,6 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
141
127
// call initialize function of the new implementation
142
128
(bool success , bytes memory reason ) =
143
129
newImplementation.delegatecall (abi.encodeWithSignature ("initialize() " ));
144
-
145
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
146
130
require (success, string (reason));
147
131
148
132
emit ContractUpgraded (currentImplementation, newImplementation);
@@ -180,41 +164,33 @@ abstract contract Governance is IGovernance, State, ERC1967Upgrade {
180
164
uint8 action
181
165
) private view returns (IWormhole.VM memory vaa , uint256 offset ) {
182
166
// Make sure the blockchain has not forked.
183
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
184
167
require (block .chainid == _evmChain, "invalid evm chain " );
185
168
186
169
// verify the governance message
187
170
bool valid;
188
171
string memory reason;
189
172
(vaa, valid, reason) = _wormhole.parseAndVerifyVM (encodedVaa);
190
-
191
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
192
173
require (valid, reason);
193
174
194
175
// 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.
196
176
require (vaa.emitterChainId == GOVERNANCE_CHAIN, "invalid governance chain " );
197
177
require (vaa.emitterAddress == GOVERNANCE_EMITTER, "invalid governance contract " );
198
178
199
179
// 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.
201
180
require (! consumedVaas[vaa.hash], "governance action already consumed " );
202
181
203
182
bytes32 govModule;
204
183
(govModule, offset) = vaa.payload.asBytes32Unchecked (offset);
205
184
206
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
207
185
require (govModule == GOVERNANCE_MODULE, "invalid governance module " );
208
186
209
187
uint8 govAction;
210
188
(govAction, offset) = vaa.payload.asUint8Unchecked (offset);
211
189
212
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
213
190
require (govAction == action, "invalid governance action " );
214
191
}
215
192
216
193
function _checkLength (bytes memory encoded , uint256 expected ) private pure {
217
- // NOTE: Reverting with Error(string) comes from the old implementation, so we preserve it.
218
194
require (encoded.length == expected, "invalid governance payload length " );
219
195
}
220
196
0 commit comments