Skip to content

Add local anvil setup - #146

Merged
alexgex merged 50 commits into
developfrom
add-local-anvil-setup
Oct 28, 2025
Merged

alexgex merged 50 commits into
developfrom
add-local-anvil-setup

Conversation

@alexgex

@alexgex alexgex commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to the Ansible automation for SKALE node deployments, focusing on supporting the Anvil local Ethereum node, enhancing environment variable handling, and improving resource cleanup and migration flows. The changes streamline contract deployment, node migration, fund transfers, and validator setup, while ensuring robust configuration propagation and cleanup across the playbooks.

Anvil support and orchestration:

  • Added dedicated roles, tasks, and playbooks to start, configure, and clean up the Anvil container, including extracting and propagating the private key and endpoint to all nodes and group variables for subsequent plays. [1] [2] [3] [4]
  • Updated fund transfer logic to use Anvil’s private key, handle stale blockchain checks, and derive the target address if not provided, improving flexibility and reliability for local testing. [1] [2] [3]

Configuration propagation and environment management:

  • Improved propagation of critical variables (node_type, fair_contracts, allowed_ts_diff, endpoint, anvil_private_key) across all nodes and group variables, ensuring consistent state and easier debugging. [1] [2] [3] [4]
  • Enhanced cleanup tasks to remove obsolete variables and contract data from group variables and helper script directories, maintaining a clean environment between runs. [1] [2] [3]

Migration and deployment improvements:

  • Refined Fair node migration by setting node_type appropriately for migration and cleaning up Anvil resources post-migration. [1] [2] [3]
  • Added a wait step to ensure the chain is started on boot nodes before deploying Fair contracts, improving reliability of contract deployment.

Miscellaneous enhancements:

  • Updated Python scripts and requirements for compatibility and improved dry-run handling (e.g., in set_rng.py). [1] [2]
  • Ensured environment variables like ALLOWED_TS_DIFF are consistently set and passed to all relevant scripts and tasks. [1] [2] [3] [4]

These changes collectively make the deployment process more robust, testable, and maintainable, especially for local development and testing scenarios with Anvil.

References:
[1] [2] [3] [4] [5]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for running a local Anvil Ethereum node for testing and development, alongside improvements to environment variable handling, resource cleanup, and deployment orchestration. The changes enable developers to test SKALE node deployments locally using Anvil instead of requiring a remote Ethereum endpoint.

Key changes:

  • Added Anvil container orchestration with automatic private key extraction and distribution across all nodes
  • Enhanced environment variable propagation (node_type, fair_contracts, allowed_ts_diff, endpoint, anvil_private_key) to ensure consistent configuration state
  • Improved cleanup tasks to remove Anvil resources and obsolete variables after migration

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
set_fair_boot_node_type.yaml New playbook to set node type to fair_boot
run_fair_all.yaml Orchestrates full Fair node deployment including Anvil setup
run_anvil.yaml Playbook to run Anvil container on first node
roles/setup_validator/tasks/main.yaml Added ALLOWED_TS_DIFF environment variable
roles/set_fair_boot_node_type/tasks/main.yaml Sets and propagates fair_boot node type
roles/run_anvil/tasks/main.yaml Manages Anvil container lifecycle and key extraction
roles/link_addresses/tasks/link_addresses.yaml Added ALLOWED_TS_DIFF environment variable
roles/fair_migrate/tasks/main.yaml Updates node type for migration and cleans up Anvil resources
roles/deploy_fair/tasks/deploy_fair.yaml Waits for chain start and propagates fair_contracts
roles/deploy_contracts/tasks/transfer_funds.yaml Handles fund transfers from Anvil account with stale check handling
roles/deploy_contracts/tasks/manager.yaml Sets allowed_ts_diff and adds it to fix_zero_node script
roles/deploy_contracts/tasks/main.yaml Conditionally imports transfer_funds for Anvil
roles/deploy_contracts/tasks/ima.yaml Standardizes group_vars file handling
roles/create_chain/tasks/main.yaml Added ALLOWED_TS_DIFF environment variable
roles/cleanup_artifacts/tasks/main.yaml Expanded cleanup to include Anvil-related variables
requirements.txt Updated skale.py version
main.yaml Added run_anvil playbook import
files/transfer_funds.py Enhanced to support Anvil with stale check disabling and address derivation
files/set_rng.py Added skip_dry_run parameter
files/fix_zero_node_fair.py Commented out wait_for_next_block call
fair_migrate.yaml Sets node_type to fair during migration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread skale-nodes/ansible/roles/deploy_fair/tasks/deploy_fair.yaml
Comment thread skale-nodes/ansible/roles/run_anvil/tasks/main.yaml Outdated
Comment thread skale-nodes/ansible/fair_migrate.yaml Outdated
Comment thread skale-nodes/ansible/requirements.txt Outdated
@alexgex
alexgex merged commit 1c75cc4 into develop Oct 28, 2025
@alexgex
alexgex deleted the add-local-anvil-setup branch October 28, 2025 16:32
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.

Add local network option for skale-manager & IMA deployment for FAIR boot nodes

5 participants