Add nonReentrant modifiers on functions that use getCurrentContextAddress only, add lockMutex modifier on functions that make external calls
This commit is contained in:
parent
6d0dedc62c
commit
c75212bef0
@ -56,6 +56,7 @@ contract MixinExchangeCore is
|
||||
/// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
|
||||
function cancelOrdersUpTo(uint256 targetOrderEpoch)
|
||||
external
|
||||
nonReentrant
|
||||
{
|
||||
address makerAddress = getCurrentContextAddress();
|
||||
// If this function is called via `executeTransaction`, we only update the orderEpoch for the makerAddress/msg.sender combination.
|
||||
@ -88,7 +89,7 @@ contract MixinExchangeCore is
|
||||
bytes memory signature
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
lockMutex
|
||||
returns (FillResults memory fillResults)
|
||||
{
|
||||
fillResults = fillOrderInternal(
|
||||
@ -104,6 +105,7 @@ contract MixinExchangeCore is
|
||||
/// @param order Order to cancel. Order must be OrderStatus.FILLABLE.
|
||||
function cancelOrder(Order memory order)
|
||||
public
|
||||
nonReentrant
|
||||
{
|
||||
// Fetch current order status
|
||||
OrderInfo memory orderInfo = getOrderInfo(order);
|
||||
|
@ -50,7 +50,7 @@ contract MixinMatchOrders is
|
||||
bytes memory rightSignature
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
lockMutex
|
||||
returns (LibFillResults.MatchedFillResults memory matchedFillResults)
|
||||
{
|
||||
// We assume that rightOrder.takerAssetData == leftOrder.makerAssetData and rightOrder.makerAssetData == leftOrder.takerAssetData.
|
||||
|
@ -19,6 +19,7 @@
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../utils/LibBytes/LibBytes.sol";
|
||||
import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
|
||||
import "./mixins/MSignatureValidator.sol";
|
||||
import "./mixins/MTransactions.sol";
|
||||
import "./interfaces/IWallet.sol";
|
||||
@ -26,6 +27,7 @@ import "./interfaces/IValidator.sol";
|
||||
|
||||
|
||||
contract MixinSignatureValidator is
|
||||
ReentrancyGuard,
|
||||
MSignatureValidator,
|
||||
MTransactions
|
||||
{
|
||||
@ -69,6 +71,7 @@ contract MixinSignatureValidator is
|
||||
bool approval
|
||||
)
|
||||
external
|
||||
nonReentrant
|
||||
{
|
||||
address signerAddress = getCurrentContextAddress();
|
||||
allowedValidators[signerAddress][validatorAddress] = approval;
|
||||
|
@ -46,7 +46,7 @@ contract MixinWrapperFunctions is
|
||||
bytes memory signature
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
lockMutex
|
||||
returns (FillResults memory fillResults)
|
||||
{
|
||||
fillResults = fillOrKillOrderInternal(
|
||||
@ -69,6 +69,7 @@ contract MixinWrapperFunctions is
|
||||
bytes memory signature
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
returns (FillResults memory fillResults)
|
||||
{
|
||||
// ABI encode calldata for `fillOrder`
|
||||
@ -88,14 +89,7 @@ contract MixinWrapperFunctions is
|
||||
fillOrderCalldata, // write output over input
|
||||
128 // output size is 128 bytes
|
||||
)
|
||||
switch success
|
||||
case 0 {
|
||||
mstore(fillResults, 0)
|
||||
mstore(add(fillResults, 32), 0)
|
||||
mstore(add(fillResults, 64), 0)
|
||||
mstore(add(fillResults, 96), 0)
|
||||
}
|
||||
case 1 {
|
||||
if success {
|
||||
mstore(fillResults, mload(fillOrderCalldata))
|
||||
mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))
|
||||
mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))
|
||||
@ -117,7 +111,7 @@ contract MixinWrapperFunctions is
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
lockMutex
|
||||
returns (FillResults memory totalFillResults)
|
||||
{
|
||||
uint256 ordersLength = orders.length;
|
||||
@ -144,7 +138,7 @@ contract MixinWrapperFunctions is
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
lockMutex
|
||||
returns (FillResults memory totalFillResults)
|
||||
{
|
||||
uint256 ordersLength = orders.length;
|
||||
@ -172,6 +166,7 @@ contract MixinWrapperFunctions is
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
returns (FillResults memory totalFillResults)
|
||||
{
|
||||
uint256 ordersLength = orders.length;
|
||||
@ -197,7 +192,7 @@ contract MixinWrapperFunctions is
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
lockMutex
|
||||
returns (FillResults memory totalFillResults)
|
||||
{
|
||||
bytes memory takerAssetData = orders[0].takerAssetData;
|
||||
@ -242,6 +237,7 @@ contract MixinWrapperFunctions is
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
returns (FillResults memory totalFillResults)
|
||||
{
|
||||
bytes memory takerAssetData = orders[0].takerAssetData;
|
||||
@ -285,7 +281,7 @@ contract MixinWrapperFunctions is
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
lockMutex
|
||||
returns (FillResults memory totalFillResults)
|
||||
{
|
||||
bytes memory makerAssetData = orders[0].makerAssetData;
|
||||
@ -338,6 +334,7 @@ contract MixinWrapperFunctions is
|
||||
bytes[] memory signatures
|
||||
)
|
||||
public
|
||||
nonReentrant
|
||||
returns (FillResults memory totalFillResults)
|
||||
{
|
||||
bytes memory makerAssetData = orders[0].makerAssetData;
|
||||
|
Loading…
x
Reference in New Issue
Block a user