@@ -37,12 +37,6 @@ contract QuantumGravityBridge is IDAOracle {
37
37
// be accounted for in any upgrades. Always test an exact upgrade on testnet
38
38
// and localhost before mainnet upgrades.
39
39
40
- ////////////////
41
- // Immutables //
42
- ////////////////
43
-
44
- bytes32 public immutable BRIDGE_ID;
45
-
46
40
/////////////
47
41
// Storage //
48
42
/////////////
@@ -99,25 +93,20 @@ contract QuantumGravityBridge is IDAOracle {
99
93
// Functions //
100
94
///////////////
101
95
102
- /// @param _bridge_id Identifier of the bridge, used in signatures for
103
- /// domain separation.
104
96
/// @param _nonce Initial event nonce.
105
97
/// @param _powerThreshold Initial voting power that is needed to approve
106
98
/// operations.
107
99
/// @param _validatorSetHash Initial validator set hash. This does not need
108
100
/// to be the genesis validator set of the bridged chain, only the initial
109
101
/// validator set of the bridge.
110
102
constructor (
111
- bytes32 _bridge_id ,
112
103
uint256 _nonce ,
113
104
uint256 _powerThreshold ,
114
105
bytes32 _validatorSetHash
115
106
) {
116
- BRIDGE_ID = _bridge_id;
117
-
118
107
// CHECKS
119
108
120
- bytes32 newCheckpoint = domainSeparateValidatorSetHash (_bridge_id, _nonce, _powerThreshold, _validatorSetHash);
109
+ bytes32 newCheckpoint = domainSeparateValidatorSetHash (_nonce, _powerThreshold, _validatorSetHash);
121
110
122
111
// EFFECTS
123
112
@@ -156,20 +145,18 @@ contract QuantumGravityBridge is IDAOracle {
156
145
/// @dev Make a domain-separated commitment to the validator set.
157
146
/// A hash of all relevant information about the validator set.
158
147
/// The format of the hash is:
159
- /// keccak256(bridge_id, VALIDATOR_SET_HASH_DOMAIN_SEPARATOR, nonce, power_threshold, validator_set_hash)
148
+ /// keccak256(VALIDATOR_SET_HASH_DOMAIN_SEPARATOR, nonce, power_threshold, validator_set_hash)
160
149
/// The elements in the validator set should be monotonically decreasing by power.
161
- /// @param _bridge_id Bridge ID.
162
150
/// @param _nonce Nonce.
163
151
/// @param _powerThreshold The voting power threshold.
164
152
/// @param _validatorSetHash Validator set hash.
165
153
function domainSeparateValidatorSetHash (
166
- bytes32 _bridge_id ,
167
154
uint256 _nonce ,
168
155
uint256 _powerThreshold ,
169
156
bytes32 _validatorSetHash
170
157
) private pure returns (bytes32 ) {
171
158
bytes32 c = keccak256 (
172
- abi.encode (_bridge_id, VALIDATOR_SET_HASH_DOMAIN_SEPARATOR, _nonce, _powerThreshold, _validatorSetHash)
159
+ abi.encode (VALIDATOR_SET_HASH_DOMAIN_SEPARATOR, _nonce, _powerThreshold, _validatorSetHash)
173
160
);
174
161
175
162
return c;
@@ -178,17 +165,15 @@ contract QuantumGravityBridge is IDAOracle {
178
165
/// @dev Make a domain-separated commitment to a data root tuple root.
179
166
/// A hash of all relevant information about a data root tuple root.
180
167
/// The format of the hash is:
181
- /// keccak256(bridge_id, DATA_ROOT_TUPLE_ROOT_DOMAIN_SEPARATOR, nonce, dataRootTupleRoot)
182
- /// @param _bridge_id Bridge ID.
168
+ /// keccak256(DATA_ROOT_TUPLE_ROOT_DOMAIN_SEPARATOR, nonce, dataRootTupleRoot)
183
169
/// @param _nonce Event nonce.
184
170
/// @param _dataRootTupleRoot Data root tuple root.
185
171
function domainSeparateDataRootTupleRoot (
186
- bytes32 _bridge_id ,
187
172
uint256 _nonce ,
188
173
bytes32 _dataRootTupleRoot
189
174
) private pure returns (bytes32 ) {
190
175
bytes32 c = keccak256 (
191
- abi.encode (_bridge_id, DATA_ROOT_TUPLE_ROOT_DOMAIN_SEPARATOR, _nonce, _dataRootTupleRoot)
176
+ abi.encode (DATA_ROOT_TUPLE_ROOT_DOMAIN_SEPARATOR, _nonce, _dataRootTupleRoot)
192
177
);
193
178
194
179
return c;
@@ -276,15 +261,14 @@ contract QuantumGravityBridge is IDAOracle {
276
261
// Check that the supplied current validator set matches the saved checkpoint.
277
262
bytes32 currentValidatorSetHash = computeValidatorSetHash (_currentValidatorSet);
278
263
if (
279
- domainSeparateValidatorSetHash (BRIDGE_ID, _oldNonce, currentPowerThreshold, currentValidatorSetHash) !=
264
+ domainSeparateValidatorSetHash (_oldNonce, currentPowerThreshold, currentValidatorSetHash) !=
280
265
state_lastValidatorSetCheckpoint
281
266
) {
282
267
revert SuppliedValidatorSetInvalid ();
283
268
}
284
269
285
270
// Check that enough current validators have signed off on the new validator set.
286
271
bytes32 newCheckpoint = domainSeparateValidatorSetHash (
287
- BRIDGE_ID,
288
272
_newNonce,
289
273
_newPowerThreshold,
290
274
_newValidatorSetHash
@@ -346,7 +330,6 @@ contract QuantumGravityBridge is IDAOracle {
346
330
bytes32 currentValidatorSetHash = computeValidatorSetHash (_currentValidatorSet);
347
331
if (
348
332
domainSeparateValidatorSetHash (
349
- BRIDGE_ID,
350
333
_validatorSetNonce,
351
334
currentPowerThreshold,
352
335
currentValidatorSetHash
@@ -357,7 +340,7 @@ contract QuantumGravityBridge is IDAOracle {
357
340
358
341
// Check that enough current validators have signed off on the data
359
342
// root tuple root and nonce.
360
- bytes32 c = domainSeparateDataRootTupleRoot (BRIDGE_ID, _newNonce, _dataRootTupleRoot);
343
+ bytes32 c = domainSeparateDataRootTupleRoot (_newNonce, _dataRootTupleRoot);
361
344
checkValidatorSignatures (_currentValidatorSet, _sigs, c, currentPowerThreshold);
362
345
363
346
// EFFECTS
0 commit comments