Remove matchOrders optimization

This commit is contained in:
Jacob Evans
2019-01-12 12:07:37 +11:00
parent 5da40ab45e
commit 007a2d7deb
2 changed files with 5 additions and 11 deletions

View File

@@ -7,7 +7,7 @@
"pr": 1474
},
{
"note": "Prevent Exchange `matchOrdersAsync` input parameters being modified",
"note": "Remove Exchange `matchOrdersAsync` optimization",
"pr": 1514
}
]

View File

@@ -744,19 +744,13 @@ export class ExchangeWrapper extends ContractWrapper {
) {
throw new Error(ExchangeWrapperError.AssetDataMismatch);
}
// Smart contracts assigns the asset data from the left order to the right one so we can save gas on reducing the size of call data
const optimizedRightSignedOrder = {
...rightSignedOrder,
makerAssetData: '0x',
takerAssetData: '0x',
};
const exchangeInstance = await this._getExchangeContractAsync();
if (orderTransactionOpts.shouldValidate) {
await exchangeInstance.matchOrders.callAsync(
leftSignedOrder,
optimizedRightSignedOrder,
rightSignedOrder,
leftSignedOrder.signature,
optimizedRightSignedOrder.signature,
rightSignedOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
@@ -767,9 +761,9 @@ export class ExchangeWrapper extends ContractWrapper {
}
const txHash = await exchangeInstance.matchOrders.sendTransactionAsync(
leftSignedOrder,
optimizedRightSignedOrder,
rightSignedOrder,
leftSignedOrder.signature,
optimizedRightSignedOrder.signature,
rightSignedOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,