-
Notifications
You must be signed in to change notification settings - Fork 40
Add Makefile targets for block producer operations #1221
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Documentation Commands Test | ||
|
||
on: | ||
push: | ||
branches: [ main, develop ] | ||
pull_request: | ||
paths: | ||
- 'Makefile' | ||
- 'docs/**' | ||
- 'CLAUDE.md' | ||
- '.github/workflows/doc-commands.yml' | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_BACKTRACE: full | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test-doc-commands: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup build dependencies | ||
uses: ./.github/actions/setup-build-deps | ||
|
||
- name: Setup Rust | ||
uses: ./.github/actions/setup-rust | ||
with: | ||
toolchain: nightly | ||
cache-prefix: test-doc-commands-v0 | ||
|
||
- name: Download circuits files | ||
uses: ./.github/actions/setup-circuits | ||
|
||
- name: Test generate-block-producer-key command | ||
run: | | ||
echo "Testing generate-block-producer-key command..." | ||
make generate-block-producer-key | ||
|
||
- name: Verify generated key file | ||
run: | | ||
echo "Verifying generated key file exists and has correct permissions..." | ||
if [ ! -f "./openmina-workdir/producer-key" ]; then | ||
echo "❌ Producer key file was not generated" | ||
exit 1 | ||
fi | ||
|
||
# Check file permissions (should be 600) | ||
PERMS=$(stat -c "%a" "./openmina-workdir/producer-key") | ||
if [ "$PERMS" != "600" ]; then | ||
echo "❌ Producer key file has incorrect permissions: $PERMS (expected: 600)" | ||
exit 1 | ||
fi | ||
|
||
# Check file is not empty | ||
if [ ! -s "./openmina-workdir/producer-key" ]; then | ||
echo "❌ Producer key file is empty" | ||
exit 1 | ||
fi | ||
|
||
echo "✅ Producer key file generated successfully with correct permissions" | ||
|
||
- name: Test key file can be read by run-block-producer | ||
run: | | ||
echo "Testing that generated key can be used by run-block-producer target..." | ||
# Run with --help to avoid actually starting the producer but verify | ||
# key validation passes | ||
timeout 30s make run-block-producer-devnet COINBASE_RECEIVER="test" || { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this On my machine the time to do the following is about 3 minutes:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's because the code is recompiled because of action_kind.rs being changed. Gotta fix that first. Good point. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be better now. I changed the target definition by relying on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW: you can always execute a CI job locally by using act. For instance, you can test locally the doc job using |
||
EXIT_CODE=$? | ||
if [ $EXIT_CODE -eq 124 ]; then | ||
echo "✅ Command started successfully (timed out as expected)" | ||
elif [ $EXIT_CODE -eq 1 ]; then | ||
echo "❌ Key validation failed" | ||
exit 1 | ||
else | ||
echo "✅ Command validation passed (exit code: $EXIT_CODE)" | ||
fi | ||
} | ||
|
||
- name: Test other documented make targets exist | ||
run: | | ||
echo "Testing that documented make targets exist..." | ||
make help | grep -E "(run-block-producer|generate-block-producer-key|run-archive)" || { | ||
echo "❌ Some documented make targets are missing from help output" | ||
exit 1 | ||
} | ||
echo "✅ All documented make targets are available" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,82 @@ Ensure Docker and Docker Compose are installed on your system - | |
[monitor sync](http://localhost:8070/dashboard) and | ||
[block production](http://localhost:8070/block-production). | ||
|
||
## Alternative: Using Make Command | ||
|
||
As an alternative to Docker Compose, you can run the block producer directly | ||
using the Makefile target. This method requires building from source. | ||
|
||
### Prerequisites | ||
|
||
- Rust toolchain installed | ||
- Git repository cloned and accessible | ||
|
||
### Setup and Run | ||
|
||
1. **Prepare Your Keys** | ||
|
||
You have two options for setting up your producer key: | ||
|
||
**Option A: Generate a new key pair** | ||
|
||
```bash | ||
make generate-block-producer-key | ||
``` | ||
|
||
This will create a new key pair and save the private key to | ||
`openmina-workdir/producer-key`. | ||
|
||
**Option B: Use an existing key** | ||
|
||
```bash | ||
mkdir -p openmina-workdir | ||
cp /path/to/your/private_key openmina-workdir/producer-key | ||
``` | ||
|
||
2. **Run Block Producer** | ||
|
||
For devnet (default): | ||
|
||
```bash | ||
make run-block-producer-devnet COINBASE_RECEIVER="YourWalletAddress" \ | ||
MINA_PRIVKEY_PASS="YourPassword" | ||
``` | ||
|
||
Or explicitly specify devnet: | ||
|
||
```bash | ||
make run-block-producer NETWORK=devnet COINBASE_RECEIVER="YourWalletAddress" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this kind of command, I will add later a script and add in the CI with a |
||
MINA_PRIVKEY_PASS="YourPassword" | ||
``` | ||
|
||
For mainnet (when supported): | ||
|
||
```bash | ||
make run-block-producer-mainnet COINBASE_RECEIVER="YourWalletAddress" \ | ||
MINA_PRIVKEY_PASS="YourPassword" | ||
``` | ||
|
||
Optional parameters: | ||
- `OPENMINA_LIBP2P_EXTERNAL_IP` - Sets external IP address | ||
- `OPENMINA_LIBP2P_PORT` - Sets libp2p communication port | ||
- `PRODUCER_KEY` - Path to producer key (default: | ||
`./openmina-workdir/producer-key`) | ||
|
||
Example with all options: | ||
|
||
```bash | ||
make run-block-producer-devnet \ | ||
COINBASE_RECEIVER="YourWalletAddress" \ | ||
MINA_PRIVKEY_PASS="YourPassword" \ | ||
OPENMINA_LIBP2P_EXTERNAL_IP="1.2.3.4" \ | ||
OPENMINA_LIBP2P_PORT="8302" | ||
``` | ||
|
||
3. **Monitor the Node** | ||
|
||
The node will start and listen on port 3000. You can monitor its status by | ||
checking the console output or connecting a frontend dashboard. | ||
|
||
### Access Logs | ||
|
||
Logs are stored in `openmina-workdir` with filenames like | ||
|
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.
The test doesn't set MINA_PRIVKEY_PASS which is required for the block producer to decrypt the private key. This could lead to misleading test results or expose error handling issues.
Copilot uses AI. Check for mistakes.