@@ -194,7 +194,6 @@ contract KlerosGovernor is IArbitrableV2 {
194
194
// ************************************* //
195
195
196
196
/// @dev Creates transaction list based on input parameters and submits it for potential approval and execution.
197
- /// Transactions must be ordered by their hash.
198
197
/// @param _target List of addresses to call.
199
198
/// @param _value List of values required for respective addresses.
200
199
/// @param _data Concatenated calldata of all transactions of this list.
@@ -215,11 +214,9 @@ contract KlerosGovernor is IArbitrableV2 {
215
214
// Do the assignment first to avoid creating a new variable and bypass a 'stack too deep' error.
216
215
submission.deposit = submissionBaseDeposit + arbitrator.arbitrationCost (arbitratorExtraData);
217
216
require (msg .value >= submission.deposit, "Not enough ETH to cover deposit " );
218
- // Using an array to get around the stack limit.
219
- // 0 - List hash.
220
- // 1 - Previous transaction hash.
221
- // 2 - Current transaction hash.
222
- bytes32 [3 ] memory hashes;
217
+
218
+ bytes32 listHash;
219
+ bytes32 currentTxHash;
223
220
uint256 readingPosition;
224
221
for (uint256 i = 0 ; i < _target.length ; i++ ) {
225
222
bytes memory readData = new bytes (_dataSize[i]);
@@ -231,14 +228,12 @@ contract KlerosGovernor is IArbitrableV2 {
231
228
}
232
229
transaction.data = readData;
233
230
readingPosition += _dataSize[i];
234
- hashes[2 ] = keccak256 (abi.encodePacked (transaction.target, transaction.value, transaction.data));
235
- require (uint256 (hashes[2 ]) >= uint256 (hashes[1 ]), "Incorrect tx order " );
236
- hashes[0 ] = keccak256 (abi.encodePacked (hashes[2 ], hashes[0 ]));
237
- hashes[1 ] = hashes[2 ];
231
+ currentTxHash = keccak256 (abi.encodePacked (transaction.target, transaction.value, transaction.data));
232
+ listHash = keccak256 (abi.encodePacked (currentTxHash, listHash));
238
233
}
239
- require (! session.alreadySubmitted[hashes[ 0 ] ], "List already submitted " );
240
- session.alreadySubmitted[hashes[ 0 ] ] = true ;
241
- submission.listHash = hashes[ 0 ] ;
234
+ require (! session.alreadySubmitted[listHash ], "List already submitted " );
235
+ session.alreadySubmitted[listHash ] = true ;
236
+ submission.listHash = listHash ;
242
237
submission.submissionTime = block .timestamp ;
243
238
session.sumDeposit += submission.deposit;
244
239
session.submittedLists.push (submissions.length - 1 );
0 commit comments