-
Notifications
You must be signed in to change notification settings - Fork 18
feat: add ethlambda support #93
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
Draft
MegaRedHand
wants to merge
20
commits into
blockblaz:main
Choose a base branch
from
lambdaclass:add-ethlambda
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
ec88a40
chore: add ethlambda to local devnet validator config
MegaRedHand 647b728
chore: add ethlambda to client-cmds
MegaRedHand b90b2f0
chore: add genesis json flag
MegaRedHand 5fa7d2e
chore: add bootnodes-file option
MegaRedHand 24c752a
chore: change to validators-file
MegaRedHand 5727523
feat: add gossipsub-port flag
MegaRedHand adf2db9
feat: generate new privkey for validator
MegaRedHand c4c1275
fix: apply blockblaz/lean-quickstart#78
MegaRedHand 526dcb6
chore: remove stale TODO
MegaRedHand a1da7a6
Revert "fix: apply blockblaz/lean-quickstart#78"
MegaRedHand 56e93f2
Merge branch 'main' into add-ethlambda
MegaRedHand 4ddbb3e
chore: update flag for network config dir
MegaRedHand 420ab55
Merge branch 'main' into add-ethlambda
MegaRedHand e25b368
feat: add new flags
MegaRedHand 6510e67
chore: change ports to avoid collision with grandine
MegaRedHand a516fe4
feat: add docker command
MegaRedHand 04b8b62
chore: update image name and binary path
MegaRedHand b048d5b
Merge branch 'main' into add-ethlambda
MegaRedHand 8169cbe
feat: add ansible changes
MegaRedHand 680867a
fix: use metricsPort instead of privkey
MegaRedHand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| # Default variables for ethlambda role | ||
| # Note: These are fallback defaults. Actual values are extracted from client-cmds/ethlambda-cmd.sh | ||
| # in the tasks/main.yml file. These defaults are used if extraction fails. | ||
|
|
||
| ethlambda_docker_image: "ghcr.io/lambdaclass/ethlambda:latest" | ||
| deployment_mode: docker # docker or binary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| --- | ||
| # Ethlambda role: Deploy and manage Ethlambda nodes | ||
| # Converts client-cmds/ethlambda-cmd.sh logic to Ansible tasks | ||
|
|
||
| - name: Extract docker image from client-cmd.sh | ||
| shell: | | ||
| # Extract the first word (docker image) from node_docker line | ||
| # playbook_dir points to ansible/playbooks, go up two levels to reach project root | ||
| project_root="$(cd '{{ playbook_dir }}/../..' && pwd)" | ||
| grep -E '^node_docker=' "$project_root/client-cmds/ethlambda-cmd.sh" | head -1 | sed -E 's/.*node_docker="([^ "]+).*/\1/' | ||
| register: ethlambda_docker_image_raw | ||
| changed_when: false | ||
| delegate_to: localhost | ||
| run_once: true | ||
|
|
||
| - name: Extract deployment mode from client-cmd.sh | ||
| shell: | | ||
| # Extract the value from node_setup line | ||
| # playbook_dir points to ansible/playbooks, go up two levels to reach project root | ||
| project_root="$(cd '{{ playbook_dir }}/../..' && pwd)" | ||
| grep -E '^node_setup=' "$project_root/client-cmds/ethlambda-cmd.sh" | head -1 | sed -E 's/.*node_setup="([^"]+)".*/\1/' | ||
| register: ethlambda_deployment_mode_raw | ||
| changed_when: false | ||
| delegate_to: localhost | ||
| run_once: true | ||
|
|
||
| - name: Set docker image and deployment mode from client-cmd.sh | ||
| set_fact: | ||
| ethlambda_docker_image: "{{ ethlambda_docker_image_raw.stdout | trim | default('ghcr.io/lambdaclass/ethlambda:latest') }}" | ||
| deployment_mode: "{{ ethlambda_deployment_mode_raw.stdout | trim | default('docker') }}" | ||
|
|
||
| - name: Extract node configuration from validator-config.yaml | ||
| shell: | | ||
| yq eval ".validators[] | select(.name == \"{{ node_name }}\") | .{{ item }}" "{{ genesis_dir }}/validator-config.yaml" | ||
| register: ethlambda_node_config | ||
| changed_when: false | ||
| loop: | ||
| - enrFields.quic | ||
| - metricsPort | ||
| when: node_name is defined | ||
|
|
||
| - name: Set node ports | ||
| set_fact: | ||
| ethlambda_quic_port: "{{ ethlambda_node_config.results[0].stdout }}" | ||
| ethlambda_metrics_port: "{{ ethlambda_node_config.results[1].stdout }}" | ||
| when: ethlambda_node_config is defined | ||
|
|
||
| - name: Ensure node key file exists | ||
| stat: | ||
| path: "{{ genesis_dir }}/{{ node_name }}.key" | ||
| register: node_key_stat | ||
|
|
||
| - name: Debug node key file check | ||
| debug: | ||
| msg: "Checking for key file at {{ genesis_dir }}/{{ node_name }}.key - exists: {{ node_key_stat.stat.exists | default('undefined') }}" | ||
|
|
||
| - name: Fail if node key file is missing | ||
| fail: | ||
| msg: "Node key file {{ node_name }}.key not found in {{ genesis_dir }}" | ||
| when: not (node_key_stat.stat.exists | default(false)) | ||
|
|
||
| - name: Clean node data directory | ||
| file: | ||
| path: "{{ data_dir }}/{{ node_name }}" | ||
| state: absent | ||
| when: clean_data | default(false) | bool | ||
|
|
||
| - name: Create node data directory | ||
| file: | ||
| path: "{{ data_dir }}/{{ node_name }}" | ||
| state: directory | ||
| mode: "0755" | ||
|
|
||
| - name: Deploy Ethlambda node using Docker | ||
| block: | ||
| - name: Stop existing Ethlambda container (if any) | ||
| command: docker rm -f {{ node_name }} | ||
| register: ethlambda_stop | ||
| failed_when: false | ||
| changed_when: ethlambda_stop.rc == 0 | ||
|
|
||
| - name: Start Ethlambda container | ||
| command: >- | ||
| docker run -d | ||
| --pull=always | ||
| --name {{ node_name }} | ||
| --restart unless-stopped | ||
| --network host | ||
| -v {{ genesis_dir }}:/config:ro | ||
| -v {{ data_dir }}/{{ node_name }}:/data | ||
| {{ ethlambda_docker_image }} | ||
| --custom-network-config-dir /config | ||
| --gossipsub-port {{ ethlambda_quic_port }} | ||
| --node-id {{ node_name }} | ||
| --node-key /config/{{ node_name }}.key | ||
| --metrics-address 0.0.0.0 | ||
| --metrics-port {{ ethlambda_metrics_port }} | ||
| register: ethlambda_container | ||
| changed_when: ethlambda_container.rc == 0 | ||
| when: deployment_mode == 'docker' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/bin/bash | ||
|
|
||
| #-----------------------ethlambda setup---------------------- | ||
|
|
||
| binary_path="$scriptDir/../ethlambda/target/release/ethlambda" | ||
|
|
||
| # Command when running as binary | ||
| node_binary="$binary_path \ | ||
| --custom-network-config-dir $configDir \ | ||
| --gossipsub-port $quicPort \ | ||
| --node-id $item \ | ||
| --node-key $configDir/$item.key \ | ||
| --metrics-address 0.0.0.0 \ | ||
| --metrics-port $metricsPort" | ||
|
|
||
| # Command when running as docker container | ||
| node_docker="ghcr.io/lambdaclass/ethlambda:latest \ | ||
| --custom-network-config-dir /config \ | ||
| --gossipsub-port $quicPort \ | ||
| --node-id $item \ | ||
| --node-key /config/$item.key \ | ||
| --metrics-address 0.0.0.0 \ | ||
| --metrics-port $metricsPort" | ||
|
|
||
| node_setup="docker" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 IP address is set to a placeholder value "TBD" instead of an actual IP address. This should be replaced with the actual IP address for the ethlambda node in the ansible-devnet environment, similar to how other nodes in the file have actual IP addresses configured.