@@ -194,7 +194,6 @@ contract KlerosGovernor is IArbitrableV2 {
194194 // ************************************* //
195195
196196 /// @dev Creates transaction list based on input parameters and submits it for potential approval and execution.
197- /// Transactions must be ordered by their hash.
198197 /// @param _target List of addresses to call.
199198 /// @param _value List of values required for respective addresses.
200199 /// @param _data Concatenated calldata of all transactions of this list.
@@ -215,11 +214,9 @@ contract KlerosGovernor is IArbitrableV2 {
215214 // Do the assignment first to avoid creating a new variable and bypass a 'stack too deep' error.
216215 submission.deposit = submissionBaseDeposit + arbitrator.arbitrationCost (arbitratorExtraData);
217216 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;
223220 uint256 readingPosition;
224221 for (uint256 i = 0 ; i < _target.length ; i++ ) {
225222 bytes memory readData = new bytes (_dataSize[i]);
@@ -231,14 +228,12 @@ contract KlerosGovernor is IArbitrableV2 {
231228 }
232229 transaction.data = readData;
233230 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));
238233 }
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 ;
242237 submission.submissionTime = block .timestamp ;
243238 session.sumDeposit += submission.deposit;
244239 session.submittedLists.push (submissions.length - 1 );
0 commit comments