Skip to content

Feat/load test - #4

Closed
IsaacTai13 wants to merge 13 commits into
mainfrom
feat/load-test
Closed

Feat/load test#4
IsaacTai13 wants to merge 13 commits into
mainfrom
feat/load-test

Conversation

@IsaacTai13

@IsaacTai13 IsaacTai13 commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

changes made to work with load tester

Summary by CodeRabbit

  • New Features

    • Added Make targets to manage a local BSC Docker-based cluster: cluster-up, cluster-down, cluster-logs, cluster-clean, and cluster-restart.
    • Introduced fully containerized cluster initialization and validator registration workflow, eliminating manual Docker container steps.
  • Documentation

    • Updated setup instructions with architecture workflow diagram.
    • Added quick command reference for cluster operations.
    • Included updated node port mappings and JSON-RPC call examples.
    • Improved logging guidance for Docker-based cluster monitoring.

- 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
@IsaacTai13 IsaacTai13 closed this Apr 6, 2026
@IsaacTai13
IsaacTai13 deleted the feat/load-test branch April 6, 2026 19:46
@coderabbitai

coderabbitai Bot commented Apr 6, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This pull request introduces a complete Docker-based cluster orchestration framework for local BSC node testing. It adds a Makefile with five new targets (cluster-up, cluster-down, cluster-logs, cluster-clean, cluster-restart) that manage a multi-container setup via Docker Compose. A new docker_cluster.sh script automates the end-to-end initialization pipeline: preparing validator/sentry/full node configurations, generating genesis artifacts, and registering validators on StakeHub. The new node_entrypoint.sh provides a container entrypoint that starts configured geth instances with appropriate mining and validation parameters. The bsc_cluster.sh script is enhanced with clearer phase documentation and additional Foundry dependency management. Documentation is rewritten to reflect the Makefile-driven workflow and updated node port mappings.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Feat/storage optimized and metrics access #2: Modifies cluster startup tooling (README, bsc_cluster.sh) with overlapping initNetwork() and start_node() function changes, indicating concurrent work on the cluster initialization pipeline.
🚥 Pre-merge checks | ✅ 5 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'Feat/load test' does not follow the required format and is missing the domain/package specification. Reformat the title to match the required pattern: feat(): . For example: 'feat(cluster): add Docker-based local BSC cluster lifecycle management' (must be under 72 characters).
Go Build And Test Rationale ⚠️ Warning Three new Go packages with critical business logic (validator registration, blob transactions, key management) are added without any test coverage, posing significant risks to production use. Add comprehensive unit tests for all three packages covering key loading, transaction creation, error handling, cryptographic operations, and RPC failures. Configure CI/CD to run tests before merge.
Security Considerations ⚠️ Warning Code contains multiple command injection and input validation vulnerabilities including unquoted glob patterns, missing file validation before sourcing, unquoted variable expansions, and timeout gaps. Quote all variable expansions, validate .env existence before sourcing, use find instead of glob patterns, add RPC loop timeout (120s), use set -u, and run shellcheck on all scripts.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Concurrency Safety ✅ Passed PR introduces sequential shell scripts and Docker orchestration with no goroutines, channels, or concurrent state access patterns.
Public Api Changes ✅ Passed No breaking changes to public APIs detected. New Makefile targets and scripts added; existing bsc_cluster.sh modified only internally without signature changes.
Rust Best Practices ✅ Passed The Rust best practices check is not applicable to this pull request as the repository contains no Rust files (*.rs) and all PR changes are limited to shell scripts, Makefile, and documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/load-test
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/load-test

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant