Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
61 lines
2.0 KiB
Solidity
Executable File
61 lines
2.0 KiB
Solidity
Executable File
// SPDX-License-Identifier: MIT
|
|
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/BitMaps.sol)
|
|
pragma solidity ^0.8.20;
|
|
|
|
/**
|
|
* @dev Library for managing uint256 to bool mapping in a compact and efficient way, provided the keys are sequential.
|
|
* Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
|
|
*
|
|
* BitMaps pack 256 booleans across each bit of a single 256-bit slot of `uint256` type.
|
|
* Hence booleans corresponding to 256 _sequential_ indices would only consume a single slot,
|
|
* unlike the regular `bool` which would consume an entire slot for a single value.
|
|
*
|
|
* This results in gas savings in two ways:
|
|
*
|
|
* - Setting a zero value to non-zero only once every 256 times
|
|
* - Accessing the same warm slot for every 256 _sequential_ indices
|
|
*/
|
|
library BitMaps {
|
|
struct BitMap {
|
|
mapping(uint256 bucket => uint256) _data;
|
|
}
|
|
|
|
/**
|
|
* @dev Returns whether the bit at `index` is set.
|
|
*/
|
|
function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
|
|
uint256 bucket = index >> 8;
|
|
uint256 mask = 1 << (index & 0xff);
|
|
return bitmap._data[bucket] & mask != 0;
|
|
}
|
|
|
|
/**
|
|
* @dev Sets the bit at `index` to the boolean `value`.
|
|
*/
|
|
function setTo(BitMap storage bitmap, uint256 index, bool value) internal {
|
|
if (value) {
|
|
set(bitmap, index);
|
|
} else {
|
|
unset(bitmap, index);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @dev Sets the bit at `index`.
|
|
*/
|
|
function set(BitMap storage bitmap, uint256 index) internal {
|
|
uint256 bucket = index >> 8;
|
|
uint256 mask = 1 << (index & 0xff);
|
|
bitmap._data[bucket] |= mask;
|
|
}
|
|
|
|
/**
|
|
* @dev Unsets the bit at `index`.
|
|
*/
|
|
function unset(BitMap storage bitmap, uint256 index) internal {
|
|
uint256 bucket = index >> 8;
|
|
uint256 mask = 1 << (index & 0xff);
|
|
bitmap._data[bucket] &= ~mask;
|
|
}
|
|
}
|