@@ -37,12 +37,6 @@ contract QuantumGravityBridge is IDAOracle {
3737 // be accounted for in any upgrades. Always test an exact upgrade on testnet
3838 // and localhost before mainnet upgrades.
3939
40- ////////////////
41- // Immutables //
42- ////////////////
43-
44- bytes32 public immutable BRIDGE_ID;
45-
4640 /////////////
4741 // Storage //
4842 /////////////
@@ -99,25 +93,20 @@ contract QuantumGravityBridge is IDAOracle {
9993 // Functions //
10094 ///////////////
10195
102- /// @param _bridge_id Identifier of the bridge, used in signatures for
103- /// domain separation.
10496 /// @param _nonce Initial event nonce.
10597 /// @param _powerThreshold Initial voting power that is needed to approve
10698 /// operations.
10799 /// @param _validatorSetHash Initial validator set hash. This does not need
108100 /// to be the genesis validator set of the bridged chain, only the initial
109101 /// validator set of the bridge.
110102 constructor (
111- bytes32 _bridge_id ,
112103 uint256 _nonce ,
113104 uint256 _powerThreshold ,
114105 bytes32 _validatorSetHash
115106 ) {
116- BRIDGE_ID = _bridge_id;
117-
118107 // CHECKS
119108
120- bytes32 newCheckpoint = domainSeparateValidatorSetHash (_bridge_id, _nonce, _powerThreshold, _validatorSetHash);
109+ bytes32 newCheckpoint = domainSeparateValidatorSetHash (_nonce, _powerThreshold, _validatorSetHash);
121110
122111 // EFFECTS
123112
@@ -156,20 +145,18 @@ contract QuantumGravityBridge is IDAOracle {
156145 /// @dev Make a domain-separated commitment to the validator set.
157146 /// A hash of all relevant information about the validator set.
158147 /// 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)
160149 /// The elements in the validator set should be monotonically decreasing by power.
161- /// @param _bridge_id Bridge ID.
162150 /// @param _nonce Nonce.
163151 /// @param _powerThreshold The voting power threshold.
164152 /// @param _validatorSetHash Validator set hash.
165153 function domainSeparateValidatorSetHash (
166- bytes32 _bridge_id ,
167154 uint256 _nonce ,
168155 uint256 _powerThreshold ,
169156 bytes32 _validatorSetHash
170157 ) private pure returns (bytes32 ) {
171158 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)
173160 );
174161
175162 return c;
@@ -178,17 +165,15 @@ contract QuantumGravityBridge is IDAOracle {
178165 /// @dev Make a domain-separated commitment to a data root tuple root.
179166 /// A hash of all relevant information about a data root tuple root.
180167 /// 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)
183169 /// @param _nonce Event nonce.
184170 /// @param _dataRootTupleRoot Data root tuple root.
185171 function domainSeparateDataRootTupleRoot (
186- bytes32 _bridge_id ,
187172 uint256 _nonce ,
188173 bytes32 _dataRootTupleRoot
189174 ) private pure returns (bytes32 ) {
190175 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)
192177 );
193178
194179 return c;
@@ -276,15 +261,14 @@ contract QuantumGravityBridge is IDAOracle {
276261 // Check that the supplied current validator set matches the saved checkpoint.
277262 bytes32 currentValidatorSetHash = computeValidatorSetHash (_currentValidatorSet);
278263 if (
279- domainSeparateValidatorSetHash (BRIDGE_ID, _oldNonce, currentPowerThreshold, currentValidatorSetHash) !=
264+ domainSeparateValidatorSetHash (_oldNonce, currentPowerThreshold, currentValidatorSetHash) !=
280265 state_lastValidatorSetCheckpoint
281266 ) {
282267 revert SuppliedValidatorSetInvalid ();
283268 }
284269
285270 // Check that enough current validators have signed off on the new validator set.
286271 bytes32 newCheckpoint = domainSeparateValidatorSetHash (
287- BRIDGE_ID,
288272 _newNonce,
289273 _newPowerThreshold,
290274 _newValidatorSetHash
@@ -346,7 +330,6 @@ contract QuantumGravityBridge is IDAOracle {
346330 bytes32 currentValidatorSetHash = computeValidatorSetHash (_currentValidatorSet);
347331 if (
348332 domainSeparateValidatorSetHash (
349- BRIDGE_ID,
350333 _validatorSetNonce,
351334 currentPowerThreshold,
352335 currentValidatorSetHash
@@ -357,7 +340,7 @@ contract QuantumGravityBridge is IDAOracle {
357340
358341 // Check that enough current validators have signed off on the data
359342 // root tuple root and nonce.
360- bytes32 c = domainSeparateDataRootTupleRoot (BRIDGE_ID, _newNonce, _dataRootTupleRoot);
343+ bytes32 c = domainSeparateDataRootTupleRoot (_newNonce, _dataRootTupleRoot);
361344 checkValidatorSignatures (_currentValidatorSet, _sigs, c, currentPowerThreshold);
362345
363346 // EFFECTS
0 commit comments