Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Commit

Permalink
add ring miner to ringhash caculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kongliangzhong committed Apr 19, 2018
1 parent 6af0967 commit 4b80de6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion contracts/LoopringProtocolImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ contract LoopringProtocolImpl is LoopringProtocol {
require(params.ringSize == uintArgsList.length);
require(params.ringSize == uint8ArgsList.length);
require(params.ringSize == buyNoMoreThanAmountBList.length);

// Validate ring-mining related arguments.
for (uint i = 0; i < params.ringSize; i++) {
require(uintArgsList[i][5] > 0); // "order rateAmountS is zero");
Expand Down Expand Up @@ -865,6 +865,7 @@ contract LoopringProtocolImpl is LoopringProtocol {

params.ringHash = keccak256(
params.ringHash,
params.miner,
params.feeSelections
);
}
Expand Down
4 changes: 2 additions & 2 deletions test/testLoopringProtocolImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ contract("LoopringProtocolImpl", (accounts: string[]) => {
const order4Owner = accounts[4];
const order5Owner = accounts[5];
const orderAuthAddr = accounts[7]; // should generate each time in front-end. we just mock it here.
const ringOwner = accounts[0];
const feeRecepient = accounts[6];
const ringOwner = accounts[6];
const feeRecepient = ringOwner;
const walletAddr = accounts[8];

let loopringProtocolImpl: any;
Expand Down
3 changes: 2 additions & 1 deletion util/ring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ export class Ring {

const ringHash = crypto.solSHA3WithType([
this.xorReduceStr(orderHashList),
this.owner,
this.feeSelectionListToNumber(this.feeSelections),
], ["string", "uint16"]);
], ["string", "address", "uint16"]);

return ringHash;
}
Expand Down

0 comments on commit 4b80de6

Please sign in to comment.