diff options
5 files changed, 25 insertions, 25 deletions
diff --git a/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol b/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol index 076bee24c..b7e2e06b8 100644 --- a/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol +++ b/packages/contracts/src/contracts/current/test/TestLibMem/TestLibMem.sol @@ -25,11 +25,11 @@ contract TestLibMem is { /// @dev Copies a block of memory from one location to another. - /// @param mem Memory contents we want to apply memcpy to + /// @param mem Memory contents we want to apply memCopy to /// @param dest Destination offset into <mem>. /// @param source Source offset into <mem>. /// @param length Length of bytes to copy from <source> to <dest> - /// @return mem Memory contents after calling memcpy. + /// @return mem Memory contents after calling memCopy. function testMemcpy( bytes mem, uint256 dest, @@ -47,8 +47,8 @@ contract TestLibMem is // Get pointer to memory contents uint256 offset = getMemAddress(mem) + 32; - // Execute memcpy adjusted for memory array location - memcpy(offset + dest, offset + source, length); + // Execute memCopy adjusted for memory array location + memCopy(offset + dest, offset + source, length); // Return modified memory contents return mem; diff --git a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol index 282455ea0..4f9e2f152 100644 --- a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol +++ b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol @@ -311,7 +311,7 @@ contract LibBytes is // Allocate memory and copy value to result result = new bytes(nestedBytesLength); - memcpy( + memCopy( getMemAddress(result) + 32, // +32 skips array length getMemAddress(b) + index + 32, nestedBytesLength @@ -340,7 +340,7 @@ contract LibBytes is ); // Copy <input> into <b> - memcpy( + memCopy( getMemAddress(b) + 32 + index, // +32 to skip length of <b> getMemAddress(input), // includes length of <input> input.length + 32 // +32 bytes to store <input> length diff --git a/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol b/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol index 960850725..6afb9973a 100644 --- a/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol +++ b/packages/contracts/src/contracts/current/utils/LibMem/LibMem.sol @@ -39,7 +39,7 @@ contract LibMem /// @param dest memory address to copy bytes to. /// @param source memory address to copy bytes from. /// @param length number of bytes to copy. - function memcpy( + function memCopy( uint256 dest, uint256 source, uint256 length @@ -81,42 +81,42 @@ contract LibMem if (source > dest) { assembly { // Record the total number of full words to copy - let nwords := div(length, 32) + let nWords := div(length, 32) - // We subtract 32 from `send` and `dend` because it + // We subtract 32 from `sEnd` and `dEnd` because it // is easier to compare with in the loop, and these // are also the addresses we need for copying the // last bytes. length := sub(length, 32) - let send := add(source, length) - let dend := add(dest, length) + let sEnd := add(source, length) + let dEnd := add(dest, length) // Remember the last 32 bytes of source // This needs to be done here and not after the loop // because we may have overwritten the last bytes in // source already due to overlap. - let last := mload(send) + let last := mload(sEnd) // Copy whole words front to back - for {let i := 0} lt(i, nwords) {i := add(i, 1)} { + for {let i := 0} lt(i, nWords) {i := add(i, 1)} { mstore(dest, mload(source)) source := add(source, 32) dest := add(dest, 32) } // Write the last 32 bytes - mstore(dend, last) + mstore(dEnd, last) } } else { assembly { // Record the total number of full words to copy - let nwords := div(length, 32) + let nWords := div(length, 32) - // We subtract 32 from `send` and `dend` because those + // We subtract 32 from `sEnd` and `dEnd` because those // are the starting points when copying a word at the end. length := sub(length, 32) - let send := add(source, length) - let dend := add(dest, length) + let sEnd := add(source, length) + let dEnd := add(dest, length) // Remember the first 32 bytes of source // This needs to be done here and not after the loop @@ -125,10 +125,10 @@ contract LibMem let first := mload(source) // Copy whole words back to front - for {let i := 0} lt(i, nwords) {i := add(i, 1)} { - mstore(dend, mload(send)) - send := sub(send, 32) - dend := sub(dend, 32) + for {let i := 0} lt(i, nWords) {i := add(i, 1)} { + mstore(dEnd, mload(sEnd)) + sEnd := sub(sEnd, 32) + dEnd := sub(dEnd, 32) } // Write the first 32 bytes diff --git a/packages/contracts/test/libraries/lib_mem.ts b/packages/contracts/test/libraries/lib_mem.ts index efe719255..6291d3d08 100644 --- a/packages/contracts/test/libraries/lib_mem.ts +++ b/packages/contracts/test/libraries/lib_mem.ts @@ -27,7 +27,7 @@ describe('LibMem', () => { testLibMem = await TestLibMemContract.deployFrom0xArtifactAsync(artifacts.TestLibMem, provider, txDefaults); }); - describe('memcpy', () => { + describe('memCopy', () => { // Create memory 0x000102...FF const memSize = 256; const memory = new Uint8Array(memSize).map((_, i) => i); diff --git a/packages/order-utils/src/asset_proxy_utils.ts b/packages/order-utils/src/asset_proxy_utils.ts index e2b377899..ee5fff1d2 100644 --- a/packages/order-utils/src/asset_proxy_utils.ts +++ b/packages/order-utils/src/asset_proxy_utils.ts @@ -5,7 +5,7 @@ import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; const ERC20_ASSET_DATA_BYTE_LENGTH = 21; -const ERC721_ASSET_DATA_BYTE_LENGTH = 53; +const ERC721_ASSET_DATA_MINIMUM_BYTE_LENGTH = 53; const ASSET_DATA_ADDRESS_OFFSET = 0; const ERC721_ASSET_DATA_TOKEN_ID_OFFSET = 20; const ERC721_ASSET_DATA_RECEIVER_DATA_LENGTH_OFFSET = 52; @@ -96,7 +96,7 @@ export const assetProxyUtils = { }, decodeERC721AssetData(assetData: string): ERC721AssetData { const encodedAssetData = ethUtil.toBuffer(assetData); - if (encodedAssetData.byteLength < ERC721_ASSET_DATA_BYTE_LENGTH) { + if (encodedAssetData.byteLength < ERC721_ASSET_DATA_MINIMUM_BYTE_LENGTH) { throw new Error( `Could not decode ERC20 Proxy Data. Expected length of encoded data to be at least 53. Got ${ encodedAssetData.byteLength |