Feat/load test - #4
Conversation
- Without this, geth implicitly bumps the default cache to 4096MB when treating the setup as mainnet, which instantly exhausts Docker's memory limit (~8GB) when spinning up a 4-node local cluster.
- modify p2p address from localhost to use docker internal DNS name - only handle geth initialization, but not start the node
- Introduce `NODE_TYPE` and `NODE_INDEX` environment variables to uniquely identify each container and correctly mount its respective data dir (`.local/nodeX`).
- Makefile for lifecycle - docker initialization script "node_entrypoint.sh" for booting geth based on node type (validator, sentry, fullnode)
forces Geth to output logs to standard output instead of local files, enabling docker's default logging driver to capture
- Replaced `mv` with `cp` when extracting the compiled geth binary. prevent redundant rebuilds. - Removed unused `exit_previous` func - Add cluster-restart for fast restart without wiping blockchain data or trigger re-initialization.
- by adjusting fork delay and removing future hardfork flags - Remove unsupported hardfork overrides (osaka, mendel, pasteur, etc.)
- Enable all older protocol forks at Block 0 for full contract support - Disable newer time-based forks (bohr, feynman, etc.) that are not supported by the current node binary - Ensures Uniswap and other smart contracts can deploy without errors
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis pull request introduces a complete Docker-based cluster orchestration framework for local BSC node testing. It adds a Sequence Diagram(s)sequenceDiagram
participant User
participant Makefile
participant Toolbox as Toolbox Container
participant ComposeFile as docker compose
participant RPC as RPC Endpoint
participant StakeHub as StakeHub Service
participant Nodes as BSC Nodes
User->>Makefile: make cluster-up
Makefile->>Toolbox: docker run (ephemeral)<br/>./docker_cluster.sh prepare
Toolbox->>Toolbox: 1. Backup genesis templates
Toolbox->>Toolbox: 2. Reset genesis submodule
Toolbox->>Toolbox: 3. Install dependencies (poetry/npm)
Toolbox->>Toolbox: 4. Build geth binary
Toolbox->>Toolbox: 5. Generate validators.conf
Toolbox->>Toolbox: 6. Patch BSCValidatorSet.sol
Toolbox->>Toolbox: 7. Generate genesis.json
Toolbox->>Toolbox: 8. Initialize geth datadirs
Toolbox->>Toolbox: 9. Rewrite config.toml (DNS names)
Toolbox->>Toolbox: 10. Generate .env.cluster<br/>& docker-compose.cluster.yml
Makefile->>ComposeFile: docker compose up -d
ComposeFile->>Nodes: Start validators, sentries, full nodes
Nodes-->>Nodes: Initialize and sync
Makefile->>RPC: Poll /eth_blockNumber
RPC-->>Makefile: RPC ready
Makefile->>Toolbox: docker run --network bsc_cluster_network<br/>./docker_cluster.sh register
Toolbox->>StakeHub: register validator for each node
StakeHub-->>Toolbox: Validators registered
Makefile-->>User: Cluster ready
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Comment |
changes made to work with load tester
Summary by CodeRabbit
New Features
cluster-up,cluster-down,cluster-logs,cluster-clean, andcluster-restart.Documentation