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.
91 lines
3.5 KiB
Solidity
Executable File
91 lines
3.5 KiB
Solidity
Executable File
// SPDX-License-Identifier: MIT
|
|
// OpenZeppelin Contracts (last updated v5.4.0) (metatx/ERC2771Context.sol)
|
|
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {Context} from "../utils/Context.sol";
|
|
|
|
/**
|
|
* @dev Context variant with ERC-2771 support.
|
|
*
|
|
* WARNING: Avoid using this pattern in contracts that rely in a specific calldata length as they'll
|
|
* be affected by any forwarder whose `msg.data` is suffixed with the `from` address according to the ERC-2771
|
|
* specification adding the address size in bytes (20) to the calldata size. An example of an unexpected
|
|
* behavior could be an unintended fallback (or another function) invocation while trying to invoke the `receive`
|
|
* function only accessible if `msg.data.length == 0`.
|
|
*
|
|
* WARNING: The usage of `delegatecall` in this contract is dangerous and may result in context corruption.
|
|
* Any forwarded request to this contract triggering a `delegatecall` to itself will result in an invalid {_msgSender}
|
|
* recovery.
|
|
*/
|
|
abstract contract ERC2771Context is Context {
|
|
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
address private immutable _trustedForwarder;
|
|
|
|
/**
|
|
* @dev Initializes the contract with a trusted forwarder, which will be able to
|
|
* invoke functions on this contract on behalf of other accounts.
|
|
*
|
|
* NOTE: The trusted forwarder can be replaced by overriding {trustedForwarder}.
|
|
*/
|
|
/// @custom:oz-upgrades-unsafe-allow constructor
|
|
constructor(address trustedForwarder_) {
|
|
_trustedForwarder = trustedForwarder_;
|
|
}
|
|
|
|
/**
|
|
* @dev Returns the address of the trusted forwarder.
|
|
*/
|
|
function trustedForwarder() public view virtual returns (address) {
|
|
return _trustedForwarder;
|
|
}
|
|
|
|
/**
|
|
* @dev Indicates whether any particular address is the trusted forwarder.
|
|
*/
|
|
function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
|
|
return forwarder == trustedForwarder();
|
|
}
|
|
|
|
/**
|
|
* @dev Override for `msg.sender`. Defaults to the original `msg.sender` whenever
|
|
* a call is not performed by the trusted forwarder or the calldata length is less than
|
|
* 20 bytes (an address length).
|
|
*/
|
|
function _msgSender() internal view virtual override returns (address) {
|
|
uint256 calldataLength = msg.data.length;
|
|
uint256 contextSuffixLength = _contextSuffixLength();
|
|
if (calldataLength >= contextSuffixLength && isTrustedForwarder(msg.sender)) {
|
|
unchecked {
|
|
return address(bytes20(msg.data[calldataLength - contextSuffixLength:]));
|
|
}
|
|
} else {
|
|
return super._msgSender();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @dev Override for `msg.data`. Defaults to the original `msg.data` whenever
|
|
* a call is not performed by the trusted forwarder or the calldata length is less than
|
|
* 20 bytes (an address length).
|
|
*/
|
|
function _msgData() internal view virtual override returns (bytes calldata) {
|
|
uint256 calldataLength = msg.data.length;
|
|
uint256 contextSuffixLength = _contextSuffixLength();
|
|
if (calldataLength >= contextSuffixLength && isTrustedForwarder(msg.sender)) {
|
|
unchecked {
|
|
return msg.data[:calldataLength - contextSuffixLength];
|
|
}
|
|
} else {
|
|
return super._msgData();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @dev ERC-2771 specifies the context as being a single address (20 bytes).
|
|
*/
|
|
function _contextSuffixLength() internal view virtual override returns (uint256) {
|
|
return 20;
|
|
}
|
|
}
|