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.
49 lines
1.4 KiB
JavaScript
Executable File
49 lines
1.4 KiB
JavaScript
Executable File
//See: https://github.com/ethereum/wiki/wiki/RLP
|
|
import { getBytes } from "./data.js";
|
|
function arrayifyInteger(value) {
|
|
const result = [];
|
|
while (value) {
|
|
result.unshift(value & 0xff);
|
|
value >>= 8;
|
|
}
|
|
return result;
|
|
}
|
|
function _encode(object) {
|
|
if (Array.isArray(object)) {
|
|
let payload = [];
|
|
object.forEach(function (child) {
|
|
payload = payload.concat(_encode(child));
|
|
});
|
|
if (payload.length <= 55) {
|
|
payload.unshift(0xc0 + payload.length);
|
|
return payload;
|
|
}
|
|
const length = arrayifyInteger(payload.length);
|
|
length.unshift(0xf7 + length.length);
|
|
return length.concat(payload);
|
|
}
|
|
const data = Array.prototype.slice.call(getBytes(object, "object"));
|
|
if (data.length === 1 && data[0] <= 0x7f) {
|
|
return data;
|
|
}
|
|
else if (data.length <= 55) {
|
|
data.unshift(0x80 + data.length);
|
|
return data;
|
|
}
|
|
const length = arrayifyInteger(data.length);
|
|
length.unshift(0xb7 + length.length);
|
|
return length.concat(data);
|
|
}
|
|
const nibbles = "0123456789abcdef";
|
|
/**
|
|
* Encodes %%object%% as an RLP-encoded [[DataHexString]].
|
|
*/
|
|
export function encodeRlp(object) {
|
|
let result = "0x";
|
|
for (const v of _encode(object)) {
|
|
result += nibbles[v >> 4];
|
|
result += nibbles[v & 0xf];
|
|
}
|
|
return result;
|
|
}
|
|
//# sourceMappingURL=rlp-encode.js.map
|