Commit graph

7 commits

Author SHA1 Message Date
Steve Degosserie
387c056912
fix: Resolve Foundry build errors and apply code formatting (#241)
## Summary

Fixes the CI build failure in the `task-ts-build` workflow caused by
Foundry v1.4.2's Solar linter not being able to resolve Snowbridge's
context-specific import remappings.

## Problem

The Snowbridge submodule uses context-specific remappings (prefixed with
`:`) for its dependencies:
- `lib/snowbridge/contracts/:openzeppelin/` → OpenZeppelin contracts
- `lib/snowbridge/contracts/:prb/math/` → PRB Math library

Foundry v1.4.2's Solar linter doesn't understand these context-specific
remappings and fails with errors like:
```
error: file openzeppelin/utils/cryptography/MerkleProof.sol not found
error: file prb/math/src/UD60x18.sol not found
```

## Solution

Added global remappings that the linter can understand:
```toml
"openzeppelin/=lib/snowbridge/contracts/lib/openzeppelin-contracts/contracts/",
"prb/math/=lib/snowbridge/contracts/lib/prb-math/",
```

### Why This Works
- The linter can now resolve `openzeppelin/` and `prb/math/` imports
globally
- These global remappings take **lower precedence** than
context-specific ones during compilation
- The compiler still uses the context-specific remappings (with `:`)
when compiling Snowbridge contracts
- The linter uses the global remappings when checking all files

## Changes

### Commit 1: Add global remappings
- `contracts/foundry.toml`: Added 2 global remapping entries

### Commit 2: Apply forge fmt
- Applied automatic formatting via `forge fmt` to ensure code style
consistency
- Multi-line formatting for long import statements and function
signatures
- No functional changes - purely formatting updates

## Testing

 Local build succeeds with `forge build`
 No Snowbridge import resolution errors
 `forge fmt --check` passes with no formatting issues
 Only linting notes/warnings remain (not errors)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-20 11:20:59 +03:00
Gonza Montiel
5121ae002b
feat: Datahaven contracts deployment on public testnet (#123)
## Summary
This PR introduces support for deploying Datahaven contracts to
different chains (hoodi, holesky, mainnet), as well as a new cli command
to manage this deployment separately from the regular deployment, while
maintaining compatibility with it.

#### New CLI command
- **`bun cli contracts deploy`** - Deploy contracts to supported chains
(Hoodi, Holesky, Mainnet)
- **`bun cli contracts status`** - Check deployment configuration and
status
- **`bun cli contracts verify`** - Verify contracts on block explorers
- Commands need the chain parameter: `--chain <hoodi | holesky |
mainnet>`
- Right now only `hoodi` and `holesky` are supported

### Deployment

#### Hoodi & Holesky Network Support
- Added **DeployBase.s.sol** as common ground for
**DeployTestnet.s.sol** (also new) and **DeployLocal.s.sol** (existing).
- **Hoodi configuration** (`contracts/config/hoodi.json`) with deployed
EigenLayer contract addresses to reference.
- **Holesky configuration** (`contracts/config/hoodi.json`) with
deployed EigenLayer contract addresses to reference.

#### Contracts being deployed
- **DataHaven**: ServiceManager, VetoableSlasher, RewardsRegistry
- **Snowbridge**: BeefyClient, AgentExecutor, Gateway, RewardsAgent  
- **EigenLayer**: References existing deployed contracts (not
re-deployed)

#### Deployment files
When the deployment is done, a new file under `contracts/deployments` is
generated with the addresses of the deployed contracts, for each chain
(it will be overriden per chain if run multiple times). So we would have
one `anvil.json`, `hoodi.json`, `holesky.json`, etc, with the addresses
of the deployed contracts for reference and for later verification.

#### Todo
- [x] Test compatibility with existing `bun cli launch` and `bun cli
deploy` commands

#### For follow-up PRs
- Fix verification issue with `foundry verify-contracts` when specifying
the `chain` or `chain-id` parameter, needed for hoodi
(https://github.com/foundry-rs/foundry/issues/7466).
- Add `redeploy` feature to only override implementation contract and
leave the proxy address untouched

## Usage Examples
```bash
# Deploy to Hoodi network
bun cli contracts deploy --chain hoodi

# Check deployment status  
bun cli contracts status --chain hoodi

# Verify contracts on block explorer
bun cli contracts verify --chain hoodi
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added deployment and configuration support for new networks "hoodi"
and "holesky", including new configuration and deployment files.
* Introduced a CLI tool for managing contract deployments, status
checks, and verification across supported chains.
* Added example environment configuration and comprehensive deployment
documentation.
* Enabled contract verification and status reporting via the CLI with
support for block explorer integration.

* **Improvements**
* Refactored deployment scripts for modularity, supporting both local
and testnet environments.
* Centralized and extended configuration loading to support additional
contract addresses and network parameters.
* Enhanced deployment utilities and typings to support multi-network
deployments.

* **Bug Fixes**
* Improved input validation and error handling in CLI commands and
deployment scripts.
* Added explicit handling for zero address in operator strategy
retrieval.

* **Chores**
* Updated documentation and configuration templates for easier
onboarding and deployment management.
* Improved logging and output formatting for deployment and verification
processes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
Co-authored-by: Ahmad Kaouk <56095276+ahmadkaouk@users.noreply.github.com>
2025-08-21 10:02:31 +00:00
Facundo Farall
7e0f043d7f
feat: Add script to sign up operator to AVS (#37) 2025-04-11 20:54:20 -03:00
Facundo Farall
75e39ff98f
feat(contracts): 🚀 Implement deployment scripts for all contracts (#28)
In this PR:
1. Implement deployment script for all contracts involved. This includes
    1. EigenLayer core contracts.
    2. Snowbridge contracts.
    3. Our custom contracts to interact with both protocols.
4. Update README to document functionalities of `contracts` directory.

Future work:
1. Deployment of EigenLayer contracts should be conditional, as we
wouldn't deploy them in testnet or mainnet, but we would do it in an
internal stagenet.
5. Cleaning up unused smart contracts.
2025-04-03 14:06:32 -03:00
Facundo Farall
b4797cceef
build: Add Snowbridge contracts dependency to Foundry project (#5) 2025-03-14 10:47:33 -03:00
Facundo Farall
a78cb3ce41
feat: 🏗️ Setup basic AVS contract (#4)
* forge install: eigenlayer-contracts

v1.1.1

* fix: 🗑️ Cleanup dependencies from init

* forge install: forge-std

v1.9.6

* forge install: openzeppelin-contracts

v5.2.0

* forge install: openzeppelin-contracts-upgradeable

v5.2.0

* chore: 🙈 Ignore IDE directories

* chore: 🏗️ Modify config in `foundry.toml` based on EigenLayer's example

* feat: 🚧 Add `ServiceManagerBase` contract and dependencies based on eigenlayer-middleware

* feat: 🚧 Naive implementation of missing functions replacing AVSDirectory for AllocationManager

* docs: 📝 Add first draft of contracts diagram

* refactor: 🔥 Remove unnecessary functions and refactor most important ones to the top

* docs: 📝 Update contracts diagram

* docs: 📝 Update contracts diagram

* feat:  Implement basic mocked Service Manager

* test: 🚧 Cleanup and start testing setup for mock ServiceManagerBase

* test: 🤡 Add mocks to setup tests

* test: 🤡 Add deployment of RewardsCoordinator

* test:  Deploy EigenLayer mocked contracts in test

* revert:  Remove proglematic submodules

* revert:  Remove forge-std dependency

* forge install: forge-std

v1.9.6

* forge install: openzeppelin-contracts

v5.2.0

* forge install: openzeppelin-contracts-upgradeable

v5.2.0

* forge install: eigenlayer-contracts

v1.3.0

* revert:  Remove faulty dependency

* forge install: eigenlayer-contracts

v1.3.0

* revert:  remove added dependency

* forge install: eigenlayer-contracts

v1.3.0

* revert:  Remove openzeppelin dependencies from root project

* test: 🚧 Make test run after dependency mayhem

* test:  Add passing createOperatorSets test with empty params

* style: 🎨 Apply forge fmt
2025-03-11 17:16:16 -03:00
Facundo Farall
25160cd9b2
chore: 🏗️ Setup Foundry project for AVS contracts (#1)
* forge install: forge-std

v1.9.6

* chore: 🏗️ Add `forge-std` submodule

* chore: 🏗️ Setup foundry project for AVS contracts

* ci: 👷 Restrict push execution of CI to `main` branch

* ci: 💚 Put restriction to `main` branch in `push` not in `pull_request`
2025-03-06 14:35:05 -03:00