-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: use bitcoin core wallet script #3294
Conversation
📝 WalkthroughWalkthroughThis pull request introduces updates to configuration files related to the Zeta application and its local network setup. Specifically, the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
cmd/zetae2e/config/local.yml (1)
96-97
: Document the Bitcoin RPC authentication strategy.The implementation establishes a dual-user authentication system:
- Admin user (
admin:admin
) for privileged operations- Smoketest user (
smoketest:123
) for restricted accessConsider adding documentation that explains:
- The purpose and scope of each user
- Which components should use which credentials
- The RPC method restrictions for each user
Also applies to: 98-99, 209-215
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
cmd/zetae2e/config/local.yml
(1 hunks)cmd/zetae2e/config/localnet.yml
(1 hunks)contrib/localnet/docker-compose.yml
(1 hunks)
🔇 Additional comments (4)
contrib/localnet/docker-compose.yml (2)
209-215
: Review the dual-user RPC authentication setup.
The configuration establishes two sets of credentials:
- Admin user (
admin:admin
) for wallet management and mining - Smoketest user (
smoketest:123
) for restricted RPC access
This aligns with the PR objectives for separating privileges between wallet setup and client operations.
201-201
: Verify the bitcoin-core-docker image tag.
The image tag a94b52f
appears to be a commit hash. While this ensures reproducibility, we should verify that this is the intended version.
✅ Verification successful
Bitcoin Core Docker image tag is valid and contains required components
The image tag a94b52f
is confirmed to be a valid commit hash (a94b52f0c7b09824da227a4966cf30632f2b8688) in the bitcoin-core-docker repository, and the required wallet.sh
script is present at this commit. The image configuration appears to be properly set up for the intended functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the bitcoin-core-docker image tag exists and contains wallet.sh
gh api repos/zeta-chain/bitcoin-core-docker/commits/a94b52f --jq '.sha'
Length of output: 112
Script:
#!/bin/bash
# Check if wallet.sh exists in the repository
gh api repos/zeta-chain/bitcoin-core-docker/contents/wallet.sh?ref=a94b52f --jq '.name'
# Get the commit message to understand the changes
gh api repos/zeta-chain/bitcoin-core-docker/commits/a94b52f --jq '.commit.message'
Length of output: 275
cmd/zetae2e/config/localnet.yml (1)
96-97
: Verify the RPC credential usage scope.
The configuration uses the admin credentials (admin:admin
). Since this grants full access, verify that this configuration file is only used by components requiring administrative privileges (e.g., wallet setup, mining).
✅ Verification successful
Let me check the usage context in these Dockerfiles to understand if they're related to components requiring administrative access.
Let me check the orchestrator scripts to understand how the config is used.
Let me check the e2e test implementation to understand how these credentials are used.
RPC credentials are appropriately scoped for E2E testing environment
The admin credentials in localnet.yml
are used exclusively in the E2E testing environment where:
- The configuration is only referenced in Dockerfiles for E2E test containers
- The credentials are used to facilitate automated testing scenarios including wallet setup and blockchain operations
- The context is isolated to local development and testing environments, not production deployments
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check where localnet.yml is used
rg -l "localnet.yml" | grep -v "test"
Length of output: 106
Script:
#!/bin/bash
# Check contents of the Dockerfiles
echo "=== Dockerfile-localnet ==="
cat Dockerfile-localnet
echo -e "\n=== contrib/localnet/orchestrator/Dockerfile.fastbuild ==="
cat contrib/localnet/orchestrator/Dockerfile.fastbuild
Length of output: 4192
Script:
#!/bin/bash
# Check the orchestrator start script and any related e2e configurations
echo "=== contrib/localnet/orchestrator/start-zetae2e.sh ==="
cat contrib/localnet/orchestrator/start-zetae2e.sh
echo -e "\n=== Looking for zetae2e references ==="
rg -l "zetae2e" --type go
Length of output: 11401
Script:
#!/bin/bash
# Check e2e test implementation
echo "=== cmd/zetae2e/local/test_runner.go ==="
cat cmd/zetae2e/local/test_runner.go
echo -e "\n=== Looking for Bitcoin RPC usage in e2e tests ==="
rg -A 5 "bitcoin.*rpc" cmd/zetae2e/
Length of output: 2340
cmd/zetae2e/config/local.yml (1)
98-99
: Verify the RPC credential usage scope.
The configuration uses the admin credentials (admin:admin
). Similar to localnet.yml, we should verify that this configuration file is only used by components requiring administrative privileges.
✅ Verification successful
Let me check the usage context of local.yml in these files to understand if it's used appropriately.
Based on the analysis of the files, I can now generate the final response:
RPC credential usage scope is appropriate for local testing environment
The local.yml
configuration is exclusively used in development and testing contexts:
- Used by
zetae2e
CLI tool for local development testing - Referenced in debug and test execution scripts
- Only used in documentation related to local development
- The credentials are specifically for a local Bitcoin node in a development environment
The admin credentials are appropriate in this context as they are:
- Only used in local development/testing environments
- Not used in any production configurations
- Part of the standard local testing setup documented in LOCAL_TESTING.md
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check where local.yml is used
rg -l "local.yml" | grep -v "test"
Length of output: 128
Script:
#!/bin/bash
# Check content of files that reference local.yml
echo "=== cmd/zetae2e/README.md ==="
cat cmd/zetae2e/README.md
echo -e "\n=== docs/development/LOCAL_TESTING.md ==="
cat docs/development/LOCAL_TESTING.md
echo -e "\n=== e2e/scripts/debug.sh ==="
cat e2e/scripts/debug.sh
echo -e "\n=== e2e/scripts/run.sh ==="
cat e2e/scripts/run.sh
Length of output: 14797
Use the
/opt/wallet.sh
script from bitcoin-core-docker. This ensure that the rpc whitelist and credential generation is fully covered by node CI.We use the admin user in zetae2e since it needs to setup the wallet and mine blocks. We use the smoketest user in zetaclient which is limited to specific RPCs.
Related to zeta-chain/bitcoin-core-docker#16
Summary by CodeRabbit
local.yml
andlocalnet.yml
.docker-compose.yml
to change the Bitcoin service image and command, and added new environment variables.