This package, `solidity-bytes-utils`, provides a comprehensive utility library for manipulating tightly packed `bytes` arrays within Ethereum smart contracts written in Solidity. It offers functionalities such as concatenation, slicing, and various type casting methods for `bytes` arrays stored in both memory and storage, enhancing low-level byte manipulation capabilities. The current stable version is `0.8.4`, which is designed to be fully compatible with Solidity `v0.8.x` compilers. Since version `v0.8.0`, the library has adopted a specific versioning system where its major version directly aligns with the compatible Solidity compiler's major version, providing a clear indication of compatibility for developers. It is distributed as an npm package and primarily consumed by importing its `.sol` files into Solidity projects via paths like `bytes/BytesLib.sol`, making it suitable for development environments like Hardhat or Truffle. The library is not intended for deployment on mainnet itself, as its methods are all internal. Historically, the project has addressed several critical bugs, particularly concerning the `slice` method, which have involved vulnerabilities related to arbitrary memory writes and issues with zero-length slices, emphasizing the importance of using the latest patched versions for security. Its key differentiator lies in providing robust, audited low-level byte manipulation primitives for Solidity, which are crucial for efficient and secure smart contract development.
npm install solidity-bytes-utilsVerified import paths — ran on the pinned version, not inferred.
This Solidity smart contract demonstrates the core functionalities of `solidity-bytes-utils`, including concatenating bytes arrays, slicing a portion, and type casting bytes into different unsigned integer types (uint256 and uint8). The code is written in Solidity for a `^0.8.0` compiler.
Upgrade your Solidity compiler to `^0.8.0` or ensure your `solidity-bytes-utils` version matches your compiler's major version. For older Solidity projects, install `solidity-bytes-utils@0.1.2`.
Review your code for usages of `equal_nonAligned` and remove or replace them. Consider standard Solidity equality checks or alternative byte comparison logic if non-aligned comparisons are critical.
If your project targets Solidity `<0.4.22`, downgrade `solidity-bytes-utils` to `0.0.6`. Otherwise, upgrade your Solidity compiler to `0.4.22` or later.
Immediately update `solidity-bytes-utils` to version `0.1.2` or any subsequent version (e.g., `0.8.x`). Recompile and redeploy affected contracts.
Upgrade your Solidity compiler to `^0.8.0` or downgrade the library version to one compatible with your compiler, for example, `npm install solidity-bytes-utils@0.1.2` for older Solidity projects.
Ensure `solidity-bytes-utils` is installed in your project's `node_modules` directory (`npm install solidity-bytes-utils` or `yarn add solidity-bytes-utils`). Verify that your Solidity file uses the correct import path: `import "bytes/BytesLib.sol";` and that your compiler configuration includes `node_modules` as a source mapping.
No dependency data recorded yet.